Source-checkedBuilding & decoration

FactoriOS - Lua-Powered Command Blocks

by deleted_6804353e55ed · for Factorio

Adds a new scriptable block that allows for event-driven-scripting to orchestrate factories.

66Downloads
18 mo agoLast updated
LGPL-3.0License
Factorio Mod PortalSource

About FactoriOS - Lua-Powered Command Blocks

From Factorio Mod Portal

Adds a new scriptable block that allows for event-driven-scripting to orchestrate factories.

DEPRECATED WORKING ON REWRITE

FactoriOS - Lua-Powered Command Blocks

This mod adds a new block called a Command Block that allows for high performance factory scripting in Lua. Has been battletested to orchestrate 40k furances/assemblers/labs with minimal lag.


As of now, here are the core things the api gives access to:

TaskModule - Allows for dynamic tick scheduling

HookModule - Allows for hooking onto some game events and custom events.

OutModule - Allows for basic debug printing

WireModule - Allows for circuitry operations like traversing a wire system or signal stuff.

InvModule - Allows for basic inventory operations

AssemblerModule - Allows for basic assembling machine operations

BankModule - Allows for a virtual item storage that simplifies a lot of the complexities of scripting.

core/modules


It also gives access to:

Full access to the global scripting interface (game), including player data, surfaces, and entity control.

Allows reading prototype definitions like items, recipes, entities, and more.

In game entity debugger


Steps To Run Scripts:

  1. Craft a Command Block from the Unsorted category (1 Iron Plate for now).
  2. Open the GUI.
  3. Create a empty script.
  4. Paste in some code (hello_world.lua is good).
  5. Toggle the block to ON.
  6. Click Select Current Script.
  7. Click Compile All.
  8. Close the GUI and you should see Hello world on the block.

Examples:

hello_world.lua

---@param api API
---@param caller CB
local function main(api, caller)
  api.out.print(caller, "Hello world")
end

return main
Screenshot 2025-05-10 180250

inspect.lua

---@param api API
---@param caller CB
local function main(api, caller)
    api.task.schedule(caller, 1, function() -- 1 tick delay before ran
        api.out.print(caller, "Bank Contents:\n" .. api.bank.inspect()) -- prints contents of the bank
        return 60 -- 1 second intervals
    end)
end

return main
Screenshot 2025-05-10 180140

drill.lua

---@param api API
---@param caller CB
local function main(api, caller)
    local drills = api.wire.bfs_wire_wl(caller.ent, "green", {["mining-drill"] = true}) -- finds all drills in green wire
    local chests = api.wire.bfs_wire_wl(caller.ent, "red", {container = true}) -- finds all chests in red wire


    api.task.schedule(caller, 1, function()
        for _, ent in ipairs(drills) do
            local fuel = api.inv.get_inv(ent, "fuel") -- gets fuel inventory

            -- drains then sets fuel to exactly 2 coal
            api.bank.inv_drain(fuel)
            api.bank.inv_move("coal", 2, fuel)
        end

        for _, ent in ipairs(chests) do
            local chest = api.inv.get_inv(ent, "chest")
            api.bank.inv_drain(chest) -- drains mined ore from chest into bank
        end

        return 480 -- 8 second intervals
    end)
end

return main
Screenshot 2025-05-10 180058

output_to_chest.lua

-- pumps out 50 iron ore from the bank into a chest
local output_ores = {"iron-ore"}
local count = 50

---@param api API
---@param caller CB
local function main(api, caller)
    local cached_ents = api.wire.bfs_wire_wl(caller.ent, "green", {container = true})

    api.task.schedule(caller, 1, function()
        for _, ent in pairs(cached_ents) do
            local chest = api.inv.get_inv(ent, "chest")

            for _, ore in pairs(output_ores) do
                api.bank.inv_move(ore, count, chest)
            end
        end

        return 240
    end)
end

return main


Future Plans:

  1. More Modules – Expand the API with additional building blocks.
  2. Custom Art – Add proper sprites and visual polish.
  3. Improved UI – Enhance the in-game editor and scripting interface for better usability.

Highlights

From source data

Footprint

Rated a light load on a server.

License

Published under LGPL-3.0.

Last update

Its author last shipped an update 18 mo ago.

FactoriOS - Lua-Powered Command Blocks on Nxeon

From our catalogue
One-click install
Supported on Nxeon Factorio servers. We download it from Factorio Mod Portal, place it, and restart the server.
Server side
Required on the server
Server load
light
Smallest plan we suggest
Factorio — 2 GB (2 GB RAM). This follows our own load rating above, not a benchmark.
Latest build
1.0.3, released 2025-05-11

Recent builds

BuildReleasedGame versionsLoaders
1.0.32025-05-112.0n/a
1.0.22025-05-092.0n/a
1.0.12025-05-092.0n/a

Run FactoriOS - Lua-Powered Command Blocks on a Factorio server

Pick a server or deploy a new one above; it is installed in one click.

What kind of mod it is

From the catalog
Listed on Factorio Mod Portal as “Mods”

Building & decoration

Blocks, furniture, decorations and building tools.

Runs on your server

From source side support

Factorio Mod Portal lists FactoriOS - Lua-Powered Command Blocks as required on the server. Check its Factorio Mod Portal page to see whether players need it too.

Compatibility

Game
Factorio
Runs on
Serverrequired on the server

Verified at the source

  • ✓Factorio Mod PortalOfficial listing, checked 2026-10-09Open ↗
  • ✓Authordeleted_6804353e55ed, as published on Factorio Mod Portal
  • ✓LicenseLGPL-3.0Free

FactoriOS - Lua-Powered Command Blocks, answered

Generated from the mod’s own source data.

Do my players need to install FactoriOS - Lua-Powered Command Blocks?

Factorio Mod Portal lists FactoriOS - Lua-Powered Command Blocks as required on the server. Check its Factorio Mod Portal page to see whether players need it too.

Is it free?

Yes. FactoriOS - Lua-Powered Command Blocks is free to download from Factorio Mod Portal. Its license is LGPL-3.0.

How do I add it to my Nxeon server?

Use “Add to a server” on this page, or open NxLabs from your dashboard. We install it, restart your server and switch it on.

NxLabs

Run FactoriOS - Lua-Powered Command Blocks on a Factorio server.

Deploy in about a minute from $2.99 a month, then add FactoriOS - Lua-Powered Command Blocks in one click.