[0.15.33] .set_tiles should clean more entities up

Bugs that are actually features.
Post Reply
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

[0.15.33] .set_tiles should clean more entities up

Post by eradicator »

When using surface.set_tiles(tiles,true) the game does not remove ore/trees from the tiles it corrects internally (i.e. not the ones that were explicitly changed by .set_tiles, but the adjacent ones).
Picture
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [0.15.33] .set_tiles should clean more entities up

Post by eradicator »

Erm. If this is "not a bug" then how am i supposed to handle this?

The only method available for tile reading is a one-position-per-call function. This means after changing a chunk of 32x32 tiles i'd then have to call get_tile on the outside of all four edges of the chunk, that's 34*2*4=272 calls _per chunk_ (assuming correct_tiles corrects up to 2 tiles outside of the area of the original set_tiles). And then i'd have to further call find_entities on every single tile that has been changed and then further try to determine if whatever entities i find are allowed on the new tile type (probably via prototype collision mask comparison?).

Given the fact that your already removing entities on the area affected by set_tiles directly it seems odd that i'd need to reimplement that behavior for the tiles affected by correct_tiles.

Edit:
Just to clarify, it's not just weird transitions, the ore is actually on top of the water tiles (==unwalkable, unbuildable).
Picture
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5156
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.15.33] .set_tiles should clean more entities up

Post by Klonan »

You can use find_entities_filtered{} to cleanup your mess

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [0.15.33] .set_tiles should clean more entities up

Post by eradicator »

Well. Even assuming i was just looking for trees and ore and doodads, i'd still have to call those 272 get_tiles because i don't know which tiles were corrected. Meh :/.

Mh. I looked up the definition for water tiles and they _do_ collide with the resource-layer. So this is clearly ore where it shouldn't be. And as i have no control over what correct_tiles does after my set_tiles call i still think this is your mess :?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Not a bug”