Page 1 of 1

[0.15.10] Weird behaviour using "LuaControl.riding_state"

Posted: Thu May 11, 2017 10:10 pm
by Arcitos
Hello devs,

i'm not sure if this is a bug or just the outcome of an undocumented change in the lua api, but in version 0.15.10 i suddenly experienced problems with my mod that sets LuaControl.riding_state to achieve automated acceleration of the player's vehicle.

Until 0.15.9 it was necessary to set the riding_state property each tick using

Code: Select all

riding_state(acceleration = defines.riding.acceleration.accelerating; direction = player.vehicle.direction)
Therefore it was unnecessary to set riding_state to nothing, as the vehicle would reset its state on its own the tick after.
Apparently this has changed: It seems that there is no longer a reset of the acceleration state to "defines.riding.acceleration.nothing" per tick, resulting in ongoing acceleration until i press one of the WASD keys (this seems to reset the riding_state). Is this behaviour intended?

How to reproduce:

- Start a sandbox world with the attached mod and give all techs
- Set "Mod-Settings/Per Player/Alternative toggle mode for cruise control" to true (this makes it easier to show the differences)
- Place a car and get in, make sure there is enough space for the car to accelerate
- Press [CTRL+O] to set the cruise control speed to 200
- Press [W] one time, the car will accelerate now
- Press [O] to disable cruise control:

-> In 0.15.9, the car will now slowly decelerate
-> in 0.15.10, the car will continue to accelerate until one of the WASD keys is pressed

Re: [0.15.10] Weird behaviour using "LuaControl.riding_state"

Posted: Fri May 12, 2017 1:30 am
by Rseding91
That's by design. The behavior pre 0.15.10 was broken.

The riding state stays to what ever the script sets it unless the player intervenes and changes it.

Re: [0.15.10] Weird behaviour using "LuaControl.riding_state"

Posted: Fri May 12, 2017 6:14 am
by Arcitos
Oh ok, thanks for this information.