factoriax.playground.editor.slot_display#

The slot layout that the editor draws for each machine.

The module gives the number of slots for each machine kind. It also gives the part that each slot has in the recipe, with the label and the color of the badge for that part.

None of this reaches the simulation. A level records the contents of a machine by item, and records no slot. A slot is therefore a view that the editor draws, and factoriax.playground.editor.state builds that view from the items.

factoriax.engine.levels gives each item a slot by its own rules, and never reads the layout here. The meaning of each part is with SlotRole.

Module Attributes

MACHINE_NUM_SLOTS

Slot count per machine, indexed by Machine value.

MAX_MACHINE_INVENTORY_SLOTS

Slot count of the widest machine.

MACHINE_SLOT_ROLES

Slot roles per machine, shape (len(Machine), MAX_MACHINE_INVENTORY_SLOTS), numpy int32 holding SlotRole values.

SLOT_ROLE_LABELS

Badge text per SlotRole value.

SLOT_ROLE_COLORS

Badge fill colour per SlotRole value, as RGB in 0..255.

factoriax.playground.editor.slot_display.MACHINE_NUM_SLOTS = array([0, 1, 1, 1, 3, 0, 0, 3, 2, 1, 2], dtype=int32)#

Slot count per machine, indexed by Machine value. Shape (len(Machine),), numpy int32. Zero for a machine the editor shows no slots for, including ARM, which carries an item in transit rather than storing one.

factoriax.playground.editor.slot_display.MACHINE_SLOT_ROLES = array([[0, 0, 0],        [2, 0, 0],        [3, 0, 0],        [3, 0, 0],        [1, 1, 2],        [0, 0, 0],        [0, 0, 0],        [1, 1, 2],        [1, 1, 0],        [3, 0, 0],        [3, 3, 0]], dtype=int32)#

Slot roles per machine, shape (len(Machine), MAX_MACHINE_INVENTORY_SLOTS), numpy int32 holding SlotRole values. Columns past a machine’s slot count are SlotRole.NONE, marking a slot that does not exist.

factoriax.playground.editor.slot_display.MAX_MACHINE_INVENTORY_SLOTS: int = 3#

Slot count of the widest machine. Fixes the row width of MACHINE_SLOT_ROLES and of the editor’s per-tile slot arrays, which are rectangular and so pad every machine out to this many slots.

factoriax.playground.editor.slot_display.SLOT_ROLE_COLORS: dict[int, tuple[int, int, int]] = {0: (40, 40, 40), 1: (190, 120, 40), 2: (40, 170, 140), 3: (80, 115, 175), 4: (200, 60, 60)}#

Badge fill colour per SlotRole value, as RGB in 0..255.

factoriax.playground.editor.slot_display.SLOT_ROLE_LABELS: dict[int, str] = {0: '', 1: 'IN', 2: 'OUT', 3: 'STORE', 4: 'FUEL'}#

Badge text per SlotRole value. NONE maps to the empty string, so a padding slot draws no badge.