Page 1 of 1

Multiple calls of on_player_driving_changed_state on set_driver

Posted: Sat Sep 02, 2023 9:46 am
by S3bulon
My mod Railway Motor Car creates a locomotive at the players' position on demand and automatically enters it via entity.set_driver (scripts/use_equipment.lua:113).

If a (spider-)vehicle with allow_passengers=false is standing above the player, the player is ejected from the locomotive

The log shows multiple calls of events.on_player_driving_changed_state (entered and ejected), but since only a shrinked stack trace is shown, I cannot resolve this by myself.

There is no issue if the other vehicle is further away, see
player_changed_state_multi.mp4
(5.94 MiB) Downloaded 16 times

Re: [1.1.87] Multiple calls of on_player_driving_changed_state on set_driver

Posted: Sat Sep 02, 2023 5:28 pm
by Rseding91
Thanks for the report. That is working correctly. The issue you're having is:

* You made a custom hotkey to react when the toggle-driving hotkey is pressed
* When it's pressed your hotkey runs and you put the player in a vehicle
* The game's version of toggle-driving runs and sees "the player is in a vehicle; I should leave the vehicle"

The reason it only happens when near the other not-drivable vehicle is the game won't send the normal toggle-driving action if there isn't at least a vehicle somewhere near the player.

Re: Multiple calls of on_player_driving_changed_state on set_driver

Posted: Mon Sep 04, 2023 4:23 pm
by S3bulon
Yes, I had to modify the logic because the Steam-Release of 1.1.87 (1.1.80 - 1.1.87) broke my mod - see Version 0.4.0.
Possibly due to 106663.

Should I file a bug report for this?

Re: Multiple calls of on_player_driving_changed_state on set_driver

Posted: Mon Sep 04, 2023 4:41 pm
by Rseding91
S3bulon wrote:
Mon Sep 04, 2023 4:23 pm
Yes, I had to modify the logic because the Steam-Release of 1.1.87 (1.1.80 - 1.1.87) broke my mod - see Version 0.4.0.
Possibly due to 106663.

Should I file a bug report for this?
I have no idea what you're referring to so I have no idea if there's anything bugged or not.