[0.16.16] Player death on vehicle swap

Bugs that are actually features.
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 716
Joined: Sun Nov 23, 2014 11:57 am
Contact:

[0.16.16] Player death on vehicle swap

Post by Earendel »

Creating a vehicle on top of a player is fine.

Calling .destroy() on a vehicle with a player inside is fine.

Creating a vehicle on top of a vehicle and calling .destroy() is fine.

Creating a vehicle on top of a vehicle with a player inside and calling .destroy() kills the player.

Code: Select all

/c p = game.player s = p.surface v1 = s.create_entity{name="car", position=p.position, force=p.force} v1.set_driver(p) v2 = s.create_entity{name="car", position=p.position, force=p.force} v1.destroy()
Also, if you try to move the driver/passenger into the vehicle that is not being destroyed the player still dies, even though it shouldn't be in that vehicle anymore:

Code: Select all

/c p = game.player s = p.surface v1 = s.create_entity{name="car", position=p.position, force=p.force} v1.set_driver(p) v2 = s.create_entity{name="car", position=p.position, force=p.force} v2.set_driver(p) v1.destroy()
Rseding91
Factorio Staff
Factorio Staff
Posts: 14339
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.16.16] Player death on vehicle swap

Post by Rseding91 »

thanks for the report. You need to eject the player first before making the second car or it doesn't work (as you've seen).
If you want to get ahold of me I'm almost always on Discord.
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 716
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [0.16.16] Player death on vehicle swap

Post by Earendel »

Eject the player with v1.set_driver(nil)?
The problem is that's not possible to do in the same tick. If you try and eject the player they still die:

Code: Select all

/c p = game.player s = p.surface v1 = s.create_entity{name="car", position=p.position, force=p.force} v1.set_driver(p) v2 = s.create_entity{name="car", position=p.position, force=p.force} v1.set_driver(nil) v2.set_driver(p) v1.destroy()
It seems like there's a delayed effect in actually ejecting the player.
This is a really big problem if you're trying to swap the vehicle the player is driving.
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 716
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [0.16.16] Player death on vehicle swap

Post by Earendel »

This thread is the 'Not a bug' section now and the problem is a bit different from the title, it's more complicated so maybe I should make a new thread?
Post Reply

Return to “Not a bug”