Page 1 of 1

[0.17.58] corpse player_index is 1 higher after creation of corpse

Posted: Sun Jul 21, 2019 7:45 pm
by Zerot
The following code should create a corpse with the player index of 1, but the resulting corpse has player index 2

Code: Select all

/c local c = game.player.surface.create_entity{name = "character-corpse", position = game.player.character.position, force = game.player.force, inventory_size = 0, player_index = 1}; game.print(c.character_corpse_player_index)
If I want to create a corpse for the local player, then I need to do `player_index = game.player.index - 1`.

This seems illogical to me.

Re: [0.17.58] corpse player_index is 1 higher after creation of corpse

Posted: Sun Jul 21, 2019 7:48 pm
by I_IBlackI_I
Can confirm this is the case. The effect in single player is that it will create a character corpse, if you use index 0 (remember lua is 1 based indexing) it will create a I_IBlackI_I corpse.

Re: [0.17.58] corpse player_index is 1 higher after creation of corpse

Posted: Sun Jul 21, 2019 8:32 pm
by Rseding91
Thanks for the report. It's now fixed for the next version of 0.17.