Ghost Filler
Fill in ghosts by hand without misplacing anything.
Turn it on with the shortcut bar button or Shift+G. While it is on, the item in your hand only fills a ghost of that same entity and quality at that exact spot, and the ghost is built exactly as it was planned: its direction, its underground belt end and its settings are kept, whichever way you are holding the item. Every other placement is cancelled before the game builds, so:
- nothing lands on empty ground beside a ghost;
- a different item does not replace a ghost (in the base game an inserter placed on a belt ghost is built and the ghost is gone);
- a machine placed one tile off its ghost does not wipe the ghost out;
- the item stays in your hand, even with a full inventory.
Turn it off and building is exactly as in the base game.
Build all ghosts in reach
Press Ctrl+Shift+G to build every ghost within your build distance that you carry the items for, nearest first. Each one is built exactly as planned, the same way as above (direction, belt ends, settings, quality), and paid from your inventory or your hand. Ghosts you have no items for, or that something stands in the way of, stay ghosts. Tile ghosts (concrete, landfill and so on) are built too. This works whether the toggle is on or off.
What it leaves alone
- Shift-building (placing ghosts) works as normal while the toggle is on.
- Rails and vehicles are not restricted.
- Tiles (landfill, concrete and so on) are not restricted.
What counts as a match
- Same entity name, same quality, same position. A fast belt on a yellow belt ghost is not a match. A normal belt on an uncommon belt ghost is not a match.
- Direction does not have to match: the ghost's own direction is what gets built. (In the base game the direction comes from your hand, and the output end of an underground belt ghost is built as an input.)
- With the toggle on, fast-replacing an existing building by hand is blocked too, because there is no ghost there.
How it works
The game raises on_pre_build before it builds. If there is no matching ghost, the mod moves the stack out of your hand for that moment, which makes the game drop the build, and puts it back in the same tick. Nothing is built and undone, so no ghost is ever replaced or lost.
When there is a matching ghost, the mod revives the ghost itself, takes the item from your hand and drops the game's own build the same way. That is what keeps the direction and the belt end.
Notes
- Both keys can be changed under Settings, Controls, Mods.
- Built and tested on Factorio 2.1.24 (base game with Quality and Elevated Rails).
- Multiplayer is untested.