Asaduzzaman Pavel

Notes on My First Factorio Mod: Why I Stopped Trusting the Shift-Click Dance

If you’re running 32-wagon trains with 4 chests per wagon (2 on each side), you’re managing 128 chests that all have to stay perfectly in sync. I used to do the "Shift-click dance"—Shift+Right Click to copy an inserter, then Shift+Left Click down the line 128 times to paste the stack size.

Factorio Silo - A massive 32-wagon train docking at a high-speed loading station

But if you miss just one inserter in that line, the whole station is compromised. One chest fills up with too much of one item, the wagon finishes late, and the 32-wagon beast sits in the docking bay like a stuck semi-truck at an Amazon warehouse, blocking the entire intake until the throughput drops and the whole base stalls.

I’ve seen factories get so backed up from a single mismatched inserter that it was honestly easier to nuke the whole thing and start over. I wrote this mod because I realized I couldn't trust my own hands to do the paste-dance 128 times without a mistake.

The GUI switchboard mess

I assumed Factorio's GUI API would have some kind of modern data binding. I was wrong. It’s a manual state machine where you’re basically hand-wiring a physical switchboard. If you want a slider and a text box to stay in sync, you have to write an event handler for the slider to push its value to the text, and another for the text to push its value to the slider.

-- This feels like wiring an actual dashboard with copper cables
if element.name == "issm_slider" then
    M.gui.elements.textfield.text = tostring(element.slider_value)
end

I spent more time fighting with on_gui_value_changed than I did on the actual logic of the mod. It’s one of those things where you feel like you’re writing software in the 2020s, but the API expects you to be a 1990s desktop dev.

Batch-Applying Sanity to 128 Chests

There is something incredibly satisfying about dragging a green box over a 32-wagon station and seeing 128 inserters instantly snap to the correct stack size. It’s the moment the game stops being a chore and starts being an engineering tool again. When you're managing a 32-wagon beast, you aren't just playing a game; you're maintaining a massive, high-speed logistics pipe where every single one of those 128 chests has to be perfectly balanced.

The selection-tool is the perfect primitive for this. Instead of me writing code to find every inserter near the player, I let the Factorio engine handle the spatial math. The engine hands me a table of every entity in that green box, and I just filter for if entity.type == "inserter". It turns a ten-minute error-prone clicking marathon into a half-second batch update. It’s the only way to ensure that every chest stays in sync without losing your mind.

The Silent Failure of the Inventory

To make the tool usable, I added a keybind to grab it instantly, which calls player.clear_cursor(). But I noticed that if the player's inventory is full, clear_cursor() just fails silently. You press the hotkey, nothing happens, and you’re left wondering if the mod just crashed. I still haven't figured out the "right" way to handle this—maybe spawning the tool on the ground? But that seems like its own kind of mess.

It’s a tiny mod, and the code is definitely "first-mod" quality. It isn't trying to be some massive game-altering expansion; it's just a simple tool that gets a very specific job done. But honestly, now that I’ve survived the GUI and the selection API, I’m kind of hooked. If I ever find myself back in a 32-wagon megabase, I think my next project will be something much more complex—maybe something that actually alters the game's logistics engine rather than just cleaning up my own manual mistakes. It’s the only way to manage a 32-wagon station without the constant fear of a single mis-click nuking my entire production line.

Asaduzzaman Pavel

About the Author

Asaduzzaman Pavel is a Software Engineer who actually enjoys the friction of a well-architected system. He has over 15 years of experience building high-performance backends and infrastructure that can actually handle the real-world chaos of scale.

Currently looking for new opportunities to build something amazing.