[Request] Better train control via mods
Posted: Mon Mar 13, 2017 2:26 pm
Hello,
I've spent some time for searching by forum but I'm unable to find this kind of questions/requests, so I've created this topic.
I'm wondering if it possible to provide more train control to scripts? I mean, for example, add some properties/actions/events? As for me, this may be something like below:
Properties:
train_path which will return, for example, array of rail segments/blocks where train is planning to go on his way to target station
brake_point which will return the point/rail segment where train would stop if begin braking immediately
locomotive_frontmovers and (optionally) locomotive_backmovers which will return an array of locomotives in the train, which have positive (and negative) speed at the request moment (or will have in few ticks) so it would be easier to understand, which loco is moving forward, for example, avoiding questions like this: viewtopic.php?t=34250&p=214801 (sorry that this isn't a link, this is my first post). May be this would be a good idea to refresh this value when train changed state (wants to start moving), but still have 0 speed
Events:
on_path_calculated - fires when train is calculating/recalculating his path
on_locomotive_movers_changed - fires when locomotive_[front|back]movers are changed (but, possibly, this will be overkill when another events like on_train_changed_state)
Actions:
force_path_recalculate(train) - allow train to re-calculate path on demand, for example to change route/choose different station with the same name of original one is became occupied without waiting until trains arrives at signal (or whenever path is recalculating in current version).
force_stop(train) and force_start(train) - request trains to stop and resume their movement not only on signals and stations. Possibly, would be useful for train hijacking for player resupplying/train taxi servicing or even to stop being killed by train:)
May be also something to control railroad signals, for example with circuit logic (like add conditions for changing signals state)
I hope these additions required not only by me so this list may be extended by other users.
Small topic related off-topic: I think that it would be perfect idea to add condition for train to start moving in addition to existing leaving conditions. Such as Move to the station in plan only when some condition is true. That would allow train to start moving only when needed (for example, simplest "if fuel < X then station named XXX became available" will cause skipping station XXX in schedule when train has enough fuel and move to that station when this station is next in schedule and fuel is going to be depleted, but such kind of condition should be as wide as possible, for example, including cargo's content)
I've spent some time for searching by forum but I'm unable to find this kind of questions/requests, so I've created this topic.
I'm wondering if it possible to provide more train control to scripts? I mean, for example, add some properties/actions/events? As for me, this may be something like below:
Properties:
train_path which will return, for example, array of rail segments/blocks where train is planning to go on his way to target station
brake_point which will return the point/rail segment where train would stop if begin braking immediately
locomotive_frontmovers and (optionally) locomotive_backmovers which will return an array of locomotives in the train, which have positive (and negative) speed at the request moment (or will have in few ticks) so it would be easier to understand, which loco is moving forward, for example, avoiding questions like this: viewtopic.php?t=34250&p=214801 (sorry that this isn't a link, this is my first post). May be this would be a good idea to refresh this value when train changed state (wants to start moving), but still have 0 speed
Events:
on_path_calculated - fires when train is calculating/recalculating his path
on_locomotive_movers_changed - fires when locomotive_[front|back]movers are changed (but, possibly, this will be overkill when another events like on_train_changed_state)
Actions:
force_path_recalculate(train) - allow train to re-calculate path on demand, for example to change route/choose different station with the same name of original one is became occupied without waiting until trains arrives at signal (or whenever path is recalculating in current version).
force_stop(train) and force_start(train) - request trains to stop and resume their movement not only on signals and stations. Possibly, would be useful for train hijacking for player resupplying/train taxi servicing or even to stop being killed by train:)
May be also something to control railroad signals, for example with circuit logic (like add conditions for changing signals state)
I hope these additions required not only by me so this list may be extended by other users.
Small topic related off-topic: I think that it would be perfect idea to add condition for train to start moving in addition to existing leaving conditions. Such as Move to the station in plan only when some condition is true. That would allow train to start moving only when needed (for example, simplest "if fuel < X then station named XXX became available" will cause skipping station XXX in schedule when train has enough fuel and move to that station when this station is next in schedule and fuel is going to be depleted, but such kind of condition should be as wide as possible, for example, including cargo's content)