loneguardian / TCS-Refuel-Compatibility

GNU General Public License v3.0
0 stars 0 forks source link

Cybersyn, Unexpected return to depot. #1

Closed HEROgold closed 1 year ago

HEROgold commented 1 year ago

I have played a little bit with this mod, and i've noticed that when using the Fuel signal from TCS on the set fuel station, it most likely is to skip that station, because its fuel is not yet depleted enough.

Here in lies the issue i've found. The station is added as the very last one the train goes to, (schedule created by Cybersyn) When the train skip the fuel station, becaust its full. every train goes back to the Depot station directly. When they arive, Cybersyn throws the message, train returned unexpectedly. Because of this, the Cybersyn setting for bypassing depot won't work anymore.

This causes (almost) every train to return to the station, instead of it skipping the depot, and getting a new schedule.

My theory would be, by adding the fuel station anywhere else in the schedule, once it leaves it last station, it won't cause this issue.

loneguardian commented 1 year ago

This mod was created before Cybersyn has its refuel function. It has a prerequisite of disabling Cybersyn's depot bypass function otherwise it will not work with TCS's refuel ability. This is because schedule is reset by Cybersyn whenever a bypass occurs, or when the train arrives at depot.

That is the limitation of this compatibility mod and I do not intend to solve it by working around Cybersyn's design.

TLDR: I suggest designing your train system around Cybersyn's refuel feature if possible.

HEROgold commented 1 year ago

Ah, but in the Aditional instructions part, clearly it states Cybersyn User: Make sure the setting - "Depot Bypass Threshold" is set at 1. 1 is what i would interpret as "on", since binary 0 means false or off. and 1 true or on. Thanks for the info.

loneguardian commented 1 year ago

Ye it is a little bit unintuitive in this way but my instruction of setting it to 1 to disable it should still be true, based on the following logic:

In Cybersyn, the threshold value, let's say t, where 0 ≤ t ≤ 1, is the value used by the mod to check whether a train is able to bypass based on its fuel level, say x. If the current fuel level of a train x, is higher than t, the train is eligible for bypass. Hence setting t = 1 effectively means the bypass mechanism is disabled.

Hope that clears it up. That being said, I have been inactive in Factorio hence I am unsure whether the bypass mechanism has been changed in Cybersyn.