[0.15.16] Locomotive loses power in the tick fuel runs out
Posted: Thu Jun 01, 2017 7:16 pm
I was just doing some testing with a long, straight section of track and a circuit-network-based timer, in order to determine the relationship between prototype configuration values and train speed (and ultimately arrive at a formula for train speed over time for any combo of locomotives and cars). I noticed that over my 1,016-rail-segment test track (I've confirmed this measurement), a singular rocket-fuel-filled locomotive would take either 1,473 or 1,474 ticks to run the length at full speed (298.1 kph). A later test with a wood-fueled locomotive, not even on the test track (just in the pre-acceleration loop), indicated that the speed would drop every time a piece of wood was consumed.
I haven't slowed down the game clock to test, but my theory as to what's happening is basically
In other words, it seems like a locomotive will either apply tractive effort or consume a piece of fuel; it won't do both.
EDIT: in code, s/move/accelerate/g
I haven't slowed down the game clock to test, but my theory as to what's happening is basically
Code: Select all
if (loco.wants_to_accelerate) {
if (loco.has_fuel_in_bar) {
loco.subtract_fuel_bar()
loco.accelerate()
} else {
loco.consume_fuel()
}
}
EDIT: in code, s/move/accelerate/g