I've run into a weird problem trying to build a mod. Here's the code I'm using:
Code: Select all
if roboport.surface.can_place_entity{name="tile-ghost", position={roboport.position.x + xx, roboport.position.y + yy}, inner_name="concrete", force=roboport.force} then
roboport.surface.create_entity{name="tile-ghost", position={roboport.position.x + xx, roboport.position.y + yy}, inner_name="concrete", force=roboport.force}
The check is being made based on the 2x2 placement tool for concrete so the check is failing on every other xx/yy in my loop. Additionally, it's being returned as true on the water, which should not happen.
As a side note, I also discovered this test to be very CPU intensive as running it a few thousand times per second really slows down the game. Shouldn't be a big deal as it won't run nearly this often outside of my testing but just a random remark.