currently i am working on a mod that adds an elevator to the game.
The elevator is actually a (invisible) car, i insert and eject the player (as a passenger) via scripts, and control the elevators movements too. This works pretty well actually.
However there are 2 corner cases that i cannot handle nicely: the player can jump out of the elevator in mid-air, and if lucky enough can enter a moving elevator as a driver and then 'steal' it.
The proposal:
I would like to specify that a player cannot enter or leave a vehicle.For me it is not relevant if this is in the 'data' or 'control' time.
so it could be for example in the car/vehicle data prototype two entries:
allow_player_enter=false
allow_player_exit=false
But maybe someone could find a use for it changing dynamically, so it could also be
LuaEntity::vehicle_interaction_enter_allowed=false
LuaEntity::vehicle_interaction_exit_allowed=false
(or some other better name for it)
if they are set to false, it should still be possible to insert/eject a player via scripts set_passenger/set_driver; just the 'enter/leave vehicle' key should be prevented.
The workarounds:
As suggested inviewtopic.php?f=28&t=31459
i can 'prevent' a player from entering, by throwing them out after they have entered the driver seat. maybe i could also force a player back into a car when they left too early.
(i made a seperate request thread as the other post did not request to prevent exit too)