LuaTrain-Attributes forward_acceleration ... etc

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Godmave
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Tue Nov 15, 2016 3:52 pm
Contact:

LuaTrain-Attributes forward_acceleration ... etc

Post by Godmave »

I did not, yet, try to calculate them myself, but I think it would be rather expensive doing it lua side. (https://wiki.factorio.com/Locomotive#Maximum_speed)
And since the game has to calculate those anyway for it's own speed change calculations I nurtured hope that it would be possible to get them via new attributes :)

forward_acceleration --- speed difference per tick when moving forward
backward_acceleration --- speed difference per tick when moving backward
forward_deceleration --- speed difference per tick when braking while moving forward
backward_deceleration --- speed difference per tick when braking while moving backward

Use-case I would like to correct the speed for my parted trains in the tunnel mod, so that single detached locos don't accelerate more than the complete train would.
It would also help a little bit with collision detection to have thresholds for normal speed change behavior.

It would also allow me to set the correct speed for my subtrains, because currently they get the last speed from the control train. Which causes the control train to "run away" causing teleported rolling stock on long trains not connecting anymore because the distance is too big.
I could read the riding_state of the control train and if it says accelerating add it's acceleration to the speed I set on the other subtrains. If it is braking subtract the deceleration from the current speed.
At least I hope that this will work :D

Edit: Initially I wrote maximum_* but I am not sure if I will need last_* or next_*. Logically I would say next_* since I get the current speed and need to calculate the next-tick-speed.

Post Reply

Return to “Modding interface requests”