[Rseding91] [0.16.30] Character Corpse Position Issue

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
Cooldude2606
Inserter
Inserter
Posts: 43
Joined: Sat Sep 16, 2017 9:04 pm
Contact:

[Rseding91] [0.16.30] Character Corpse Position Issue

Post by Cooldude2606 » 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.

Code: Select all

entity = surface.create_entity{name="character-corpse", position={0,0}} 
game.print(type(surface.find_entity(entity.name, entity.position)))
While this returns the transport belt entity.

Code: Select all

entity = surface.create_entity{name="transport-belt", position={0,0}}
game.print(type(surface.find_entity(entity.name, entity.position)))
Note, this one does return the entiy and not nil.

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])
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.
--- Developer for Explosive Gaming factorio community. Please contact me via our discord ---

Valansch
Inserter
Inserter
Posts: 23
Joined: Fri Jun 23, 2017 12:00 pm
Contact:

Re: [0.16.30] Character Corpse Position Issue

Post by Valansch » Fri Mar 16, 2018 4:30 pm

I found that find_entity doesnt work for any entity that doesnt have a hitbox. I tested it with:
  • defender
    destroyer
    distractor
    construction-robot
    acid-splash-purple
    behemoth-biter-corpse
    big-biter-corpse
    big-worm-corpse
    medium-biter-corpse
    medium-remnants
    medium-spitter-corpse
    medium-worm-corpse
    small-biter-corpse
    small-remnants
    small-spitter-corpse
    small-worm-corpse
    hidden-electric-energy-interface
    big-artillery-explosion
    big-explosion
    blood-explosion-big
    blood-explosion-huge
    blood-explosion-small
    explosion
    explosion-hit
    ground-explosion
    laser-bubble
    massive-explosion
    medium-explosion
    uranium-cannon-explosion
    uranium-cannon-shell-explosion
    water-splash
    fire-flame
    fire-flame-on-tree
    construction-robot
    straight-rail-remnants
    construction-robot
    logistic-robot
Admin and Developer for RedMew

Rseding91
Factorio Staff
Factorio Staff
Posts: 9478
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [Rseding91] [0.16.30] Character Corpse Position Issue

Post by Rseding91 » Fri Mar 16, 2018 4:41 pm

Thanks for the report. I've changed it so find_entity will match either the entity.position == position or entity.bounding_box.contains(position) for the next version of 0.16.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Resolved Problems and Bugs”

Who is online

Users browsing this forum: Bing [Bot]