[Rseding91] [0.16.30] Character Corpse Position Issue
Posted: Fri Mar 16, 2018 4:15 pm
Problem either with the position of the character corpse or the surface.find_entity function:
This will return nil.
While this returns the transport belt entity.
Note, this one does return the entiy and not nil.
Just a quality of life thing: could on_player_died event include the corpse entity so that this function does not need to be ran.
This will return nil.
Code: Select all
entity = surface.create_entity{name="character-corpse", position={0,0}}
game.print(type(surface.find_entity(entity.name, entity.position)))
Code: Select all
entity = surface.create_entity{name="transport-belt", position={0,0}}
game.print(type(surface.find_entity(entity.name, entity.position)))
Code: Select all
local entity = surface.create_entity{name="character-corpse", position={0,0}}
local o = entity.position
game.print(type(surface.find_entities_filtered{area={{o.x-1,o.y-1},{o.x+1,o.y+1}},name='character-corpse'}[1])