Page 1 of 1

[0.15.X][Modding] Player ejected from vehicle unexpectedly

Posted: Wed May 17, 2017 9:44 pm
by DedlySpyder
In my Avatars mod, the player jumps into a car typed entity to control the avatars. When they pick an avatar to control, I switch their character for it. In 0.14.X, their original character would stay inside the car entity, now in 0.15.X their original character is ejected.

Steps to reproduce:
Place a car

(Save your character if you want to go back)

Code: Select all

/c CHARACTER=game.player.character
Spawn a player

Code: Select all

/c NEW_PLAYER=game.player.surface.create_entity{name="player", position=game.player.position}
Get inside the car

Swap to the NEW_PLAYER

Code: Select all

/c game.player.character = NEW_PLAYER

When testing like this the original character turns blue while swapped, but even if you swap back it will still be outside of the car.

Re: [0.15.X][Modding] Player ejected from vehicle unexpectedly

Posted: Wed May 17, 2017 10:53 pm
by Rseding91
This is working as intended.

Switching the character entity switches the controller the player is using and when that happens it ejects the player from any vehicle they're in to make sure the state remains correct on the character entity, the vehicle, and the player.

In 0.14 and previous it would leave the character in an invalid state.