Wire
namespace Griff.Modules.Contraptions;
public sealed class Wire : Component, IDrawableConnects 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.
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.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”public Color Color { get; set; }The wire’s color.
public string? From { get; set; }The entity it comes from, by name. The nearest one with that name is used.
public string? Input { get; set; }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).
Output
Section titled “Output”public string? Output { get; set; }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).
Signal
Section titled “Signal”public float Signal { get; }What it’s carrying right now.
Visible
Section titled “Visible”public bool Visible { get; set; }Draw the wire. Untick it to hide the wiring behind a finished contraption.
Methods
Section titled “Methods”FormerInputs
Section titled “FormerInputs”public IReadOnlyList<string> FormerInputs()The names its entity’s actions had before (see FormerNameAttribute): still right for an Input, though not offered.
InputChoices
Section titled “InputChoices”public IReadOnlyList<string> InputChoices()The inputs its entity has, that Input can name: “Power” and “Show”, its parts’ own (a gate’s “A” and “B”, a lamp’s or switch’s “On”, a display’s “Value”, a light’s “Brightness”), then each of its components’ actions.
LinkLabel
Section titled “LinkLabel”public override string? LinkLabel(string property)