Skip to content

Wire

Connects an output of another entity to an input of this one, so one drives the other: a button’s “On” to a lamp’s “On”, a sensor to a door’s “Power”, a board’s “Score” to a display’s “Value”. Every entity has the inputs “Power” (switches it on and off as a Switch does) and “Show”; the parts in Wiring add their own, and every component’s actions are inputs too.

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.

Outputs are what components know (see component_describe’s Outputs), numbers and true or false: a button’s or switch’s “On”, a gate’s “Out”, a sensor’s “Out” and “Count”, a body’s “Speed” and “Height”, health’s “Health”, a counter’s “Count” and “Reached”, a board’s “Score”, a dungeon’s “Floor”, a beat clock’s “Beat”, a faction’s “Amount:Gold”, and a script’s own. Inputs: “Power”, “Show”, a gate’s “A” and “B”, a lamp’s “On”, a thruster’s “Power”, a display’s “Value”, a switch’s “On”, a light’s “Brightness”, and any action. Several wires into one input add up.

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.

  • input: text = “Power”. The input on this entity it drives: “Power” or “Show” (held while the signal is on), a part’s own such as a lamp’s “On”, or one of its components’ actions, e.g. “Spawn”, “Fire” or “Damage”, done once each time the signal comes on (with the signal as its amount). (Names one of its entity’s inputs: Power, Show, its parts’ own (a gate’s A and B, a lamp’s On…) or one of its actions; the Inspector picks from them and flags a name that isn’t one. Empty for none.) (Field: its own editor: Choice Of.)
  • from: text = null. The entity it comes from, by name. The nearest one with that name is used. (Names an entity.) (Field: an entity’s name.)
  • output: text = “Out”. The output it carries from there, e.g. a button’s “On”, a gate’s “Out”, a board’s “Score” or a faction’s “Amount:Gold”: one that gives a number or true or false (1 or 0). (Names an output of the entity from names, or without one this entity or the nearest it’s inside with it: one component_describe lists under Outputs, a number or true or false, e.g. “Score”, “MatchBoard.Score” for one component’s, or “Amount:Gold” for one read by a name.) (Field: an output’s name.)
  • color: a color, “#RRGGBB” or “#RRGGBBAA” = “#E35B5BFF”. The wire’s color. (Field: a color.)
  • visible: true or false = true. Draw the wire. Untick it to hide the wiring behind a finished contraption. (Field: on or off.)

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

  • signal: a number. What it’s carrying right now.

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