Lua command to place ghost landfill?

Place to get help with not working mods / modding interface.
Post Reply
boernsen2
Inserter
Inserter
Posts: 21
Joined: Thu Dec 02, 2021 5:36 pm
Contact:

Lua command to place ghost landfill?

Post 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!!!

PFQNiet
Filter Inserter
Filter Inserter
Posts: 289
Joined: Sat Sep 05, 2020 7:48 pm
Contact:

Re: Lua command to place ghost landfill?

Post by PFQNiet »

You'd need to create a "tile-ghost" entity for each tile.

boernsen2
Inserter
Inserter
Posts: 21
Joined: Thu Dec 02, 2021 5:36 pm
Contact:

Re: Lua command to place ghost landfill?

Post 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 1040 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}

boernsen2
Inserter
Inserter
Posts: 21
Joined: Thu Dec 02, 2021 5:36 pm
Contact:

Re: Lua command to place ghost landfill?

Post by boernsen2 »

I've found out already that I placed multiple tiles over each other. This is why it's looking differently.

Post Reply

Return to “Modding help”