[Feature request] Prevent vehicle spawns/edits instead of deleting the vehicle
Fill out general information
OS: Ubuntu container
BeamMP-Server Version: v3.4.1
Describe the bug When cancelling a vehicle spawn, the player's vehicle will be deleted.
When cancelling a vehicle edit, the player's vehicle will be deleted after some delay (~5 seconds, maybe).
To Reproduce
Steps to reproduce the onVehicleSpawned problem:
- Return
1from aonVehicleSpawnhandler
- Returning
math.random(2) == 1may make the effect more obvious, as it is not just preventing the spawn of a car, it is actually deleting your vehicle if you already have one. Using a randomizer allows you to somewhat easily get a vehicle spawned in first, (hopefully) and then reject the change of that vehicle.
- Keep spawning a vehicle until you actually get one and it is not rejected
- Try changing vehicle (not spawning new)
- Notice that it did not just prevent the vehicle from changing, but it actually deleted your current vehicle.
Steps to reproduce the onVehicleEdit problem:
- Return
1from aonVehicleEditedhandler - Try editing your vehicle
- Wait for multiple seconds, maybe 5-10.
- Your vehicle will have been deleted.
Expected behavior I didn't expect cancelling to just delete the player's vehicle. I thought it would either prevent the spawn/edit from occurring at all (all clients), or at least prevent propagation at the server (to other clients) and then ask the initial player's client to revert the changes/spawn.
Is the current behaviour as-designed? It was very unexpected for me, as I assumed spawning/editing would first ask the server for permission before the client proceeded with the operation, due to it being cancellable. I can see how that could be slow and possibly hard to achieve in BeamNG, so perhaps just performing a “patch” after a cancelled event to resync the initial client would be best?
you are correct about the current behavior, the event is sent to the server after it has already happened clientside. I am not sure about any concrete plans to change this