[2.0.65] LuaSegmentedUnit.speed effectively doesn't change speed in some cases
Posted: Mon Aug 25, 2025 8:35 pm
I created a mod that changes demolisher update_effects to raise a script trigger event. In control stage, i then listen to that event and set the segmented unit's speed to 100.
Expected result: the speed is set to 100 and, assuming no further script intervention, is then decelerated to match the speed as defined by unit's AI settings, but not by more than the prototype's acceleration rate per tick.
Actual result: the speed is set to 100, but on the next tick, acceleration is -99.9, and no actual speed change is observed. You can see the script prints acceleration and speed values Note that if instead of on_script_trigger_effect, on_tick is used, then the behaviour is correct, which suggests it might be related to at what point in the tick the script runs.
Expected result: the speed is set to 100 and, assuming no further script intervention, is then decelerated to match the speed as defined by unit's AI settings, but not by more than the prototype's acceleration rate per tick.
Actual result: the speed is set to 100, but on the next tick, acceleration is -99.9, and no actual speed change is observed. You can see the script prints acceleration and speed values Note that if instead of on_script_trigger_effect, on_tick is used, then the behaviour is correct, which suggests it might be related to at what point in the tick the script runs.