There are mods that need to be informed runtime when player enters a vehicle. I have my VehicleSnap listen to a lot of different driving and surface related events, but none of them trigger when player enters a tank from remote view. However it does trigger when player leaves it...
I would assume the related event to be added here is: on_player_driving_changed_state
[Genhis][2.0.13] No LUA event triggers when player drives remotely
Re: [Raiguard] [2.0.13] No LUA event triggers when player drives remotely
This is a bit tricky; Lua events can cause all sorts of wacky changes to the game state, so raising an event requires us to implement a whole lot of checks to make sure that the Lua code didn't i.e. delete the whole surface as a reaction to the player exiting a vehicle. Unfortunately, that means this is a relatively low priority.
Don't forget, you're here forever.
-
- Long Handed Inserter
- Posts: 72
- Joined: Wed May 03, 2017 2:57 pm
- Contact:
Re: [Genhis][2.0.13] No LUA event triggers when player drives remotely
I realize this is low priority, but I could really this too. Instead, I'm having to just scan vehicles on tick, which doesn't feel great. (Though my checks are pretty cheap, and I spread individual checks over multiple ticks, so it's not too bad in my case.)
To expand on the bugginess: I've noticed that the on_player_driving_changed_state is never triggered on remote entry to any vehicle. (Tank, Spidertron, or Train.) However, it is triggered on remote exit of a vehicle, but only if you hit the exit vehicle key. If you hit the escape key, it doesn't trigger. And just to wrinkle things even more, it is triggered on exit of a train if you hit escape, but only if you initially hit the "Drive Remotely" button in the train's UI. And any vehicle will trigger the event if you hit the "Stop Driving" button in the UI. (All of this behavior was tested in 2.0.55.)
EDIT: To summarize, since that got a bit messy: on_player_driving_changed_state is fired when:
To expand on the bugginess: I've noticed that the on_player_driving_changed_state is never triggered on remote entry to any vehicle. (Tank, Spidertron, or Train.) However, it is triggered on remote exit of a vehicle, but only if you hit the exit vehicle key. If you hit the escape key, it doesn't trigger. And just to wrinkle things even more, it is triggered on exit of a train if you hit escape, but only if you initially hit the "Drive Remotely" button in the train's UI. And any vehicle will trigger the event if you hit the "Stop Driving" button in the UI. (All of this behavior was tested in 2.0.55.)
EDIT: To summarize, since that got a bit messy: on_player_driving_changed_state is fired when:
- You physically enter or exit a vehicle.
- You remotely exit a vehicle by pressing the "Stop Driving" UI button.
- You remotely exit a vehicle by pressing the "Enter/leave vehicle" control.
- You remotely exit a train by pressing the Escape key, but only if you pressed the train's "Drive Remotely" UI button first. (I assume because the Train's UI is open. You can "dodge" the event by opening Remote View instead.)