Then var.inbound_manifest_checked = false end - reset for the next arrivalĭelay = 2 * 60 - check on cargo loading every other second Out = train_loaded and train_unloaded - HONK! Train_unloaded = inbound_cargo ~= var.inbound_cargo - that's "not equals" in Lua Var.coal, var.barrels = red.coal, red.barrel - remember for the next check Or (var.coal = red.coal and var.barrels = red.barrel) - no change since last check Note how outputs persist until they are changed/reset Emit alarm signal for underloaded train arrival while it's on station Local train_loaded, train_unloaded - locals get forgotten between runs Local our_train = 17 - hover over train to find out its ID number +1 counter every tick while signal-W input is non-zero: delay, irq, out.wood = 2^30, 'signal-W', out.wood + 1ĭifferent value on each output wire: out, out = -3, 10Ĭlick in-game "Quick Reference" button in combinator window for a full list of all special values and APIs there, default hotkeys and other general info. Update counter once per second (see game tick): delay, out.wood = 60, out.wood + 1 Simple arithmetic on an input: out.wood = red.wood * 5Įver-increasing output counter: out.wood = out.wood + 1 Set constant output signal value: out.wood = 1 This mod allows using it to script factorio circuit network logic directly from within the game. Lua is a very simple and easy-to-use programming language, which fits entirely on a couple pages. Which kinda breaks basic game mechanics in a way similar to various "Long Reach" mods,īut can be useful if code breaks too often and is hard to reach for debugging all the time. There is an optional hotkey (Ctrl-E) for opening these combinators from anywhere on the map, UI hotkeys can also be customized in the Settings - Controls game menu. If you don't use these buttons to undo minor changes (they still keep history of saved changes), be sure to uncheck this. Toggles between smooth and pleasant editing or undo/redo buttons on top working for all non-saved code changes. Note that with higher interval values, signals flapping on/off synced to it will be impossible to notice there. Default is 1 - update signal side-window on every tick. Only relevant when main combinator UI window is actually open. Interval in game ticks (60 ticks = 1 second at 1x game speed) between updating signal table in the UI. Note that red/green input tables are always available in the environment too, for better code/snippet compability. These can be useful when playing with other mods that change colors, for labels to match those. Green Wire Label - same as Red Wire Label, but for the other wire color.Red Wire Label - Lua environment name for in-game "red" circuit network values."Moon Logic" Combinator is because it's programmed in Lua - "moon" in portugese (as Lua itself originates in Brazil). Mostly created because I like using such Lua combinators myself, and all other mods for them seemed to be broken and abandoned atm.įixing/maintaining these is much easier without few thousand lines of extra complexity in there. General principle is that it's not a replacement for Vim/Emacs or some IDE, but just a window where you paste some Lua code/logic or type/edit a couple of lines.Īnd not a mod development framework either - only a combinator to convert circuit network inputs to outputs, nothing more. no syntax highlighting, code formatting, binding to factorio events, etc. Mod code uses things which are likely to desync mp games, and I only test singleplayer, so it's highly unlikely that it will "just work" in mp.Īdds Moon Logic Combinator that runs Lua code that can read red/green wire signal inputs and set outputs.īased on other LuaCombinator mods, but instead of adding more complexity and features, mostly removes them to keep it simple and clean. Connected Red/Green wires are highlighted when hovering over a combinator or entity connected to the circuit network.Important: This mod should probably cause desyncs in multiplayer games.When connecting circuit wires, the wire will re-anchor to the last entity clicked.To remove all wire connections from a power pole (including copper wire), shift click the affected pole. To remove connections, hold the red wire in-hand, then click the two entities you would like to remove the connection from. Then, when the blueprint is filled out by construction robots or by hand, no wire is consumed. One unit of wire is needed for each connection between two points, unless a wire is included in a blueprint. This also works on electric poles, so they can be used to connect the wire over longer distances. To form connections, entities capable of using a circuit network can be left clicked while holding the wire. Red wire is used to connect devices to a red circuit network.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |