Stack Combinator

by modo_lv

An arithmetic combinator that performs stack size multiplication/division/rounding on item signals. Features signal inversion and output display, compatible with Picker Dollies and Nullius.

21 days ago
1.1
3900
Owner:
modo_lv
Source:
https://github.com/modo-lv/factorio-m...
Homepage:
N/A
License:
CreativeCommonds BY-NC 4.0
Created:
1 year, 4 months ago
Latest Version:
1.2.13 (21 days ago)
Factorio version:
1.1
Downloaded:
3900 times

Stack Combinator

A mod for Factorio that adds a new type of circuit network combinator to research and craft: a stack combinator. This combinator modifies each item signal it receives according to that item's stack size and selected operation. For example, if the stack size for Coal is 50 and you send a Coal signal with value 2 and * (multiplication) selected, a stack combinator will output Coal×100 signal.

Features

  • Item signal stackification. Each item signal sent to the stack combinator input is output with its amount modified according to that item's stack size (non-item signals are output unchanged), depending on the selected operation:
    • Multiplication
    • Division
    • Rounding to full stack: up (away from zero), down (towards zero) or both (whichever is closer)
  • Signal inversion. Each combinator can also be configured to invert input signals (green, red or both), which treats positive input signal amounts as negative and vice-versa.
  • Output signal display. Opening the stack combinator shows all output signals, even if the combinator's output isn't connected to anything. The display includes "raw" output signals — what stack combinator is sending (displayer in silver), and "network" output signals — what the final signals are on the output wire, taking into account any other connected signal sources.

Compatibility & balancing

  • Works with blueprints.
  • Shouldn't break anything. Stack combinator is based on the arithmetic and constant combinators, and does not involve any other entities or game objects.
  • Other mods:
  • Research costs are calculated dynamically based on circuit network technology costs, so it should fit in naturally with balance changes introduced by other mods.
  • Crafting costs are an arithmetic combinator and a repair pack (copper cable in Nullius).
  • Multiplayer hasn't been tested, but the mod doesn't do anything incompatible that I know of, so it should be OK.

Limitations

  • Due to the way game works, the maximum amount of output signals is initially limited to 40 — twice the capacity of a vanilla constant combinator, meaning one StaCo can process up to two full constant combinator outputs. You can increase the limit in startup settings, but it may affect performance (according to Larger Constant Combinator's changelog; I haven't tested any large amounts myself).
    • If a static combinator receives more signals than it can output, it won't output anything and raise an alert (so you can see on the map which combinator is having the problem and where).

Discussion & bug reports

Acknowledgements

  • This is my first serious mod (Declutter was a trivial couple of lines), and the mod that helped me figure out most of what I needed to get started was Filter Combinator by gcascaes.
  • Big thanks to Picker Dollies for making it not only possible, but trivially easy to add support for it in other mods.
  • Thanks to therax for the idea on how to semi-automatically restore circuit wiring if it's removed.
  • I also had a look at:

Screenshots