Skip to content

WireGate

A logic gate or bit of math for wiring contraptions: inputs A and B, output Out. Something counts as on when it’s more than 0, and gates that answer on or off give 1 or 0. An input with no wire keeps the value set here.

Part of the Contraptions module: Contraptions, Garry’s Mod and Wiremod style: building tools used while the game runs (SandboxTools), welds, ropes and thrusters, wiring with buttons, sensors, gates, lamps and displays, and the Contraption template.

Draws itself over the whole world, under what’s pinned to the screen.

Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.

  • kind: one of And, Or, Not, Xor, Nand, Nor, Add, Subtract, Multiply, Divide, Greater, Less, Equal, Constant, Toggle, Latch, Delay, Clock, Counter = “And”. What it works out from its inputs A and B: logic (And, Or, Not…), sums or comparisons. (Field: one of its values.)
  • a: a number = 0. Input A. Wire something to it, or set it. (Field: a number.)
  • b: a number = 0. Input B. Wire something to it, or set it. (Field: a number.)
  • value: a number = 1. The number a Constant gives, or the seconds of a Delay or Clock. (Field: a number.)

What anything can read with no code: a Counter’s, Bar’s or Text’s output, a Contraptions Wire’s output as its signal; Text shows names too, the rest read numbers, true as 1.

  • Out (a number). Its output, worked out every frame.

Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.

  • out: a number. Its output, worked out every frame.
  • label: text. What it’s labeled with in the game: “AND”, “+”, “DELAY”.

Scripts use it as WireGate: its methods, events and values that aren’t saved with the scene.