Don't clear entities when calling set_tiles

Post Reply
User avatar
Sirenfal
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Tue Jan 10, 2017 1:42 am
Contact:

Don't clear entities when calling set_tiles

Post by Sirenfal »

I have several placable-off-grid entities placed by script, and if I set tiles under them they're deleted. Right now I'm going to just move those entities away and put them back after calling set_tiles, but it'd be nice to have a flag to disable this behavior

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

Re: Don't clear entities when calling set_tiles

Post by Rseding91 »

Entities are cleared only if they collide with the tile: putting water under a building for instance will delete the building.

If you don't want your entities to be deleted don't make them collide with the tile type you're putting under them.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Sirenfal
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Tue Jan 10, 2017 1:42 am
Contact:

Re: Don't clear entities when calling set_tiles

Post by Sirenfal »

They have to collide because they're placed by a script in a location where players shouldn't be able to place buildings.

User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 711
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: Don't clear entities when calling set_tiles

Post by Earendel »

You could move them away, set the tile, then move them back.

User avatar
Sirenfal
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Tue Jan 10, 2017 1:42 am
Contact:

Re: Don't clear entities when calling set_tiles

Post by Sirenfal »

That is exactly what I did :)

Thanks anyway <3

Bilka
Factorio Staff
Factorio Staff
Posts: 3135
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Don't clear entities when calling set_tiles

Post by Bilka »

This was added at some point, https://lua-api.factorio.com/latest/Lua ... .set_tiles - remove_colliding_entities parameter
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Implemented mod requests”