A small set of ComputerCraft: Tweaked programs for running a factory control room.
This repo is designed to be a mini framework to be forked and extended according to your own needs. See the Workflows section below for info.
All the below workflows are to be run in a CraftOS environment.
Fetch deployment script installer
wget https://raw.githubusercontent.com/jclicodes/factory/refs/heads/main/install.lua
Then run it:
install
First, ensure deployment scripts are available:
list deploy
Then, use the manager or wall script depending on which you are deploying:
deploy/deploy_manager
or
deploy/deploy_wall
First, ensure deployment scripts are available:
list deploy
Then, use the endpoint deployment script:
deploy/deploy_endpoint
Edit the resulting config.lua with a unique system hostname, and any other relevant configuration.
Right now, I'm only controlling some mob spawners with this system, but it's built to be easily extensible.
To onboard a new endpoint, fork this repo and create a new directory under endpoints/. E.g. endpoints/reactor/
You can copy the contents of mob_farm and edit them based on your needs for your new endpoint. Ensure you specify startup and shutdown handlers and use the configuration file to manage differences between deployments (e.g. hostnames, redstone directions, etc.). Use the mob farm as an example.
You will also want to create a new panel for controlling how the status information of your endpoint is displayed on the Wall. Simply add a new .lua file under wall/panels - e.g. wall/panels/reactor.lua. Then register the new panel in wall/wall.lua.
No need to modify the deployment scripts to support your new endpoint - it is supported automatically. Just do:
deploy/deploy_endpoint <your-endpoint>
to deploy it across different computers!
I highly recommend VS Code (I know, I know) for working with ComputerCraft as there are many great development tools for quickly iterating - such as mounting the virtual filesystem and emulating/forwarding the in-game terminal.
https://marketplace.visualstudio.com/items?itemName=lemmmy.computercraft-extension-pack
If you're on another editor that supports the Language Server Protocol (LSP) e.g. Neovim or Zed - please at least install lua-language-server (sumneko)! It makes implementing your own endpoints and panels much easier since my custom types will be picked up.