Page 1 of 1

[1.1.72] If 2 car entities are on top of each other the player can't get out

Posted: Thu Nov 17, 2022 9:51 pm
by Muppet9010
When 2 cars are created on top of each other and the player is driving one of them things go a bit odd when trying to leave. I appreciate this is an odd situation, but encountered when modding and swapping a vehicle a player was in for another one and wanting to eject the player during this process.


If the player tries to leave the car by pressing "enter" they are unable too. Effectively stuck inside their vehicle. Same if you use a script to set the player to not be driving.

Code: Select all

/sc
local character = game.player.character
local surface = character.surface
local carPosition = {10,10}
local car1 = surface.create_entity({ name = "car", position = carPosition, force = character.force, create_build_effect_smoke = false, raise_built = true })
car1.set_driver(character)
--[[ Without car2 this places the player normally --]]
local car2 = surface.create_entity({ name = "car", position = carPosition, force = character.force, create_build_effect_smoke = false, raise_built = true })
game.player.driving = false

If you kick the player out via script from the car by setting the driver to nil the player is placed inside the collision box of the car.

Code: Select all

/sc
local character = game.player.character
local surface = character.surface
local carPosition = {10,10}
local car1 = surface.create_entity({ name = "car", position = carPosition, force = character.force, create_build_effect_smoke = false, raise_built = true })
car1.set_driver(character)
--[[ Without car2 this places the player normally --]]
local car2 = surface.create_entity({ name = "car", position = carPosition, force = character.force, create_build_effect_smoke = false, raise_built = true })
car1.set_driver(nil)

Re: [1.1.72] If 2 car entities are on top of each other all sorts of odd things happen

Posted: Fri Nov 18, 2022 6:57 pm
by Rseding91
Thanks for the report however this is "working correctly" The issue is when leaving or entering a vehicle the player is not allowed to teleport over other entities. Because there are two cars directly on top of each other the player collides with the car it isn't in and as a result there's a colliding entity in all directions from the vehicle. The same will happen if you teleport the car directly on top of something like a rocket silo or assembling machine.