Page 1 of 1

More information for train state

Posted: Fri Nov 17, 2017 11:38 pm
by d3x0r
re viewtopic.php?f=28&t=27024 and viewtopic.php?f=28&t=51175

It woudl be nice to be able to get. in script, whether a train is accelerating, cruising, stopping, or stopped. I don't know if the engine internally uses cruising, or just always is accelerating along a long path, and if it uses a passive deceleration curve before hard braking....
Really the only state I'd really require is if it is accelerating. THis would greatly simplify the guessing I do in https://mods.factorio.com/mods/d3x0r/tr ... ed-limiter and the accuracy ( found while further tweaking train paramteers that there were certain deceleration rates/transitions between tracks that could make the train far exceed its regular acceleration, and even when decelerating the guess would be that it was still accelerating and the train could not stop.
On the deceleration side, I really don't want to apply the track speed penalty, or the train can end up crawling to a stop long before is intended stop.

Re: More information for train state

Posted: Fri Nov 17, 2017 11:52 pm
by quyxkh
Unless I'm misinterpreting the request you can already get enroute, stopping and stopped directly from train_changed_state monitors, the only thing kindahard to distinguish is whether an enroute train still accelerating or cruising, but you can check its current speed against its top speed (you'd need maybe a hand-coded table of top speed by fuel, and check its fuel loadout when it changes from a waiting state?).

Re: More information for train state

Posted: Sat Nov 18, 2017 6:01 pm
by Rseding91
I've added support to read the train riding state for 0.16 which lets you check if the train is accelerating, braking, or just coasting.