Multiple calls of on_player_driving_changed_state on set_driver

Place to get help with not working mods / modding interface.
Post Reply
S3bulon
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Nov 29, 2021 7:08 pm
Contact:

Multiple calls of on_player_driving_changed_state on set_driver

Post 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
Attachments
allow_passengers_bug.zip
(1.18 MiB) Downloaded 16 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.87] Multiple calls of on_player_driving_changed_state on set_driver

Post 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.
If you want to get ahold of me I'm almost always on Discord.

S3bulon
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Nov 29, 2021 7:08 pm
Contact:

Re: Multiple calls of on_player_driving_changed_state on set_driver

Post 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?

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Multiple calls of on_player_driving_changed_state on set_driver

Post 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.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Modding help”