Try   HackMD

Wire Panel Normalization

Background

Outside of the Airlock and APC, four machines implment the same idea of a 'wire panel'; i.e. a maintenance panel, exposed with a screwdriver, with wires inside for cutting and pusling. There is a lot of copy-paste code between them, resulting in patchwork functionality and bug fixes. There's no clear path towards which pattern to use, and how each wire works on each machine requires investigating the whole of the object code. This makes changes to the existing system very difficult, and makes adding wire panels to new machines a daunting process.

Goals

  1. Reduce code duplication
  2. Clearer what wires change on a machine
  3. Create a common baseline for future changes

Non-goals

  1. Change the intended mechanics of wire panel interaction on any existing machine

Milestones

M0: Define a "Wire Panel"

A wire panel:

  1. Exists on a machine
  2. Has a cover
    • States: open, closed(, broken, locked)
  3. Has a list of wires
    • Per-wire set of actions: cut, mend, pulse(, bite, signaler)
  4. Has static information between rounds
    • Per machine type: The pool of colors to use in this panel
    • Per machine type per wire: Map of action on wire to machine behavior flag changes
  5. Has static information per-round
    • Per machine type per wire: Mapping of wire to order
    • Per machine type per wire: Mapping of wire to color
  6. Has information each machine needs to track
    • Per instance per behavior: Changed behavior
    • Per instance per wire: Cut wires

M1: Wired Machine Controls Normalization

A common set of names for behavior wires can control makes it easier to reason about the expected/intended behavior of an action on a wire across implementations. Machines do not need to consider how every flag may affect them, just those they implement.

Proposed weapon_stand seed_vendor vending manufacturer
INERT INERT INERT
SHOCK MALF MALF SHOCK SHOCK
POWER POWER POWER POWER
EXTEND EXTEND EXTEND EXTEND
ACCESS EXTEND SCANID
SAFETY SHOOTINV MALF
SILICON SCANID

M2: Mapping Wire Actions to Machine Control Flag changes

Not every wire affects controls the same way. Some controls are only changed on pulse, while others require a pulse to break, but a mend to fix. Some wires change multiple controls, while others none. A common format to describe what actions on a wire will support goals 1 and 2.

generalized form

wire,

weapon_stand

WIRE_INERT,
WIRE_SHOCK,
WIRE_POWER,
WIRE_ACCESS,

seed_manipulator

vending

manufacturer

M3: Common Implementation of Wire Panels

  • Handles logic based on

M4: Common Wire Panel UI