tModLoader v2024.04
A mod to make and play Terraria mods
Wiring Class Reference

Static Public Member Functions

static bool Actuate (int i, int j)
 
static void ActuateForced (int i, int j)
 
static bool CheckMech (int i, int j, int time)
 Returns true if the wiring cooldown has been reached for the provided tile coordinates. The time parameter will set the cooldown if wiring cooldown has elapsed. Use larger values for less frequent activations. Use this method to limit how often mechanisms can be triggerd. Item.MechSpawn(float, float, int) and NPC.MechSpawn(float, float, int) should also be checked for mechanisms spawning items or NPC, such as Statues. More...
 
static void ClearAll ()
 
static void DeActive (int i, int j)
 
static IEntitySource GetItemSource (int sourceTileX, int sourceTileY)
 
static IEntitySource GetNPCSource (int sourceTileX, int sourceTileY)
 
static IEntitySource GetProjectileSource (int sourceTileX, int sourceTileY)
 
static void HitSwitch (int i, int j)
 
static void Initialize ()
 
static void MassWireOperation (Point ps, Point pe, Player master)
 
static void PokeLogicGate (int lampX, int lampY)
 
static void ReActive (int i, int j)
 
static void SetCurrentUser (int plr=-1)
 
static void SkipWire (int x, int y)
 Use to prevent wire signals from running for the provided coordinates. Typically used in multi-tiles to prevent a wire touching multiple tiles of the multi-tile from erroneously running wire code multiple times. In ModTile.HitWire(int, int), call SkipWire for all the coordinates the tile covers. More...
 
static void SkipWire (Point16 point)
 
static void Toggle2x2Light (int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn, bool doSkipWires)
 
static void ToggleCampFire (int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn, bool doSkipWires)
 
static void ToggleCandle (int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn)
 
static void ToggleChandelier (int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn, bool doSkipWires)
 
static void ToggleFirePlace (int i, int j, Tile theBlock, bool? forcedStateWhereTrueIsOn, bool doSkipWires)
 
static void ToggleHangingLantern (int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn, bool doSkipWires)
 
static void ToggleHolidayLight (int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn)
 
static void ToggleLamp (int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn, bool doSkipWires)
 
static void ToggleLampPost (int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn, bool doSkipWires)
 
static void ToggleTorch (int i, int j, Tile tileCache, bool? forcedStateWhereTrueIsOn)
 
static void TripWire (int left, int top, int width, int height)
 Used to send a single to wiring wired up to the specified area. The parameters represent the tile coordinates where wire signals will be sent. Mechanism tiles such as TileID.Switches, TileID.PressurePlates, TileID.Timers, and TileID.LogicSensor use this method as part of their interaction code. More...
 
static void UpdateMech ()
 

Static Public Attributes

static int _currentWireColor
 
static Queue< Point16_GatesNext
 
static int[] _inPumpX
 
static int[] _inPumpY
 
static Queue< Point16_LampsToCheck
 
static int _numInPump
 
static int _numOutPump
 
static int[] _outPumpX
 
static int[] _outPumpY
 
static Vector2[] _teleport
 
static Dictionary< Point16, byte > _toProcess
 
static DoubleStack< byte > _wireDirectionList
 
static DoubleStack< Point16_wireList
 
static bool blockPlayerTeleportationForOneIteration
 
static bool running
 True while wiring pulse code is running, which happens in TripWire. Check this before calling Wiring.SkipWire(int, int) in any code that is shared between wiring and other interactions to prevent buggy behavior.

For example, the code in ExampleCampfireneeds to check running because the code is shared between wiring and right click interactions.
 

Member Function Documentation

◆ CheckMech()

static bool Wiring.CheckMech ( int  i,
int  j,
int  time 
)
static

Returns true if the wiring cooldown has been reached for the provided tile coordinates. The time parameter will set the cooldown if wiring cooldown has elapsed. Use larger values for less frequent activations. Use this method to limit how often mechanisms can be triggerd. Item.MechSpawn(float, float, int) and NPC.MechSpawn(float, float, int) should also be checked for mechanisms spawning items or NPC, such as Statues.

Parameters
i
j
time
Returns

◆ SkipWire()

static void Wiring.SkipWire ( int  x,
int  y 
)
static

Use to prevent wire signals from running for the provided coordinates. Typically used in multi-tiles to prevent a wire touching multiple tiles of the multi-tile from erroneously running wire code multiple times. In ModTile.HitWire(int, int), call SkipWire for all the coordinates the tile covers.

Parameters
x
y

◆ TripWire()

static void Wiring.TripWire ( int  left,
int  top,
int  width,
int  height 
)
static

Used to send a single to wiring wired up to the specified area. The parameters represent the tile coordinates where wire signals will be sent. Mechanism tiles such as TileID.Switches, TileID.PressurePlates, TileID.Timers, and TileID.LogicSensor use this method as part of their interaction code.

Parameters
left
top
width
height