[0.16.7 Stacking ghosts with LuaSurface::create_entity

Bugs that are actually features.
Jelmergu
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Mon Apr 04, 2016 8:49 am
Contact:

[0.16.7 Stacking ghosts with LuaSurface::create_entity

Post by Jelmergu »

I am making a mod where I do something with ghost. I noticed that it is possible to stack ghosts on top of eachother using LuaSurface::create_entity in on_built_item(possibly in the other events too). This is a bug in my mod ofcourse but I also think it is a bug in the placing of a ghost. Two(or as in the picture 5 or 6 or more) equal ghosts on top of each other does not seem like a viable thing to me.

What I did
Removing the created entity using event.created_entity.destroy()
Recreating a previous ghost using game.players[event.player_index].sursurface.create_entity(entityToCreate)

What I expect
The old ghost being destroyed by the created_entity (this is where I have a bug in my mod)
A new copy of the old ghost being placed.

What did I get
A new copy on top of the old ghost
A brighter ghost.
Attachments
20171221223343_1.jpg
20171221223343_1.jpg (841.95 KiB) Viewed 1013 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 15438
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.16.7 Stacking ghosts with LuaSurface::create_entity

Post by Rseding91 »

Thanks for the report. If you don't want the ghosts to stack you need to use LuaSurface::can_place_entity to check if the entity is valid to be placed at that location normally.

Scripts are allowed to stack entities on top of each other provided it won't corrupt the game which is what you're seeing.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Not a bug”