Page 1 of 1

Lua command to place ghost landfill?

Posted: Thu Dec 02, 2021 5:43 pm
by boernsen2
Does anybody know the lua command to place ghost landfill?

I found this command to place normal landfill assuming the position is on water and it works:

Code: Select all

some_entity.surface.set_tiles({{name = "landfill", position = {-59,70}}}, true)
How about ghost tiles though? For entities such as inserters etc., I use

Code: Select all

some_entity.surface.create_entity{name="entity-ghost", position={-15,51}, inner_name="straight-rail", force=some_entity.force, direction=defines.direction.west}
For tiles, I couldn't find such a functionality. Does anybody know how to do that? Any help or hint is much appreciated!!!

Re: Lua command to place ghost landfill?

Posted: Thu Dec 02, 2021 7:06 pm
by PFQNiet
You'd need to create a "tile-ghost" entity for each tile.

Re: Lua command to place ghost landfill?

Posted: Thu Dec 02, 2021 7:53 pm
by boernsen2
Thank you very much, that helps! Do you also know why the created ghost tile looks different to a landfill ghost placed by the cursor manually?
The screenshot shows a ghost landfill entity placed manually (top-left), a "tile-ghost" landfill entity placed by the mod (middle), and a landfill tile placed by the mod (bottom-right).
landfill_screenshot.png
landfill_screenshot.png (93.53 KiB) Viewed 1102 times
The tile-ghost has been placed by:

Code: Select all

spidertron.surface.create_entity{name="tile-ghost", position={-60,69}, inner_name="landfill", force=spidertron.force, direction=defines.direction.west}

Re: Lua command to place ghost landfill?

Posted: Thu Dec 02, 2021 8:01 pm
by boernsen2
I've found out already that I placed multiple tiles over each other. This is why it's looking differently.