Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TripWire()

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

Definition at line 499 of file Wiring.cs.

500 {
501 if (Main.netMode == 1)
502 {
503 return;
504 }
505 running = true;
506 if (_wireList.Count != 0)
507 {
508 _wireList.Clear(quickClear: true);
509 }
510 if (_wireDirectionList.Count != 0)
511 {
513 }
514 Vector2[] array = new Vector2[8];
515 int num = 0;
516 for (int i = left; i < left + width; i++)
517 {
518 for (int j = top; j < top + height; j++)
519 {
520 Point16 back = new Point16(i, j);
521 Tile tile = Main.tile[i, j];
522 if (tile != null && tile.wire())
523 {
524 _wireList.PushBack(back);
525 }
526 }
527 }
528 _teleport[0].X = -1f;
529 _teleport[0].Y = -1f;
530 _teleport[1].X = -1f;
531 _teleport[1].Y = -1f;
532 if (_wireList.Count > 0)
533 {
534 _numInPump = 0;
535 _numOutPump = 0;
536 HitWire(_wireList, 1);
537 if (_numInPump > 0 && _numOutPump > 0)
538 {
539 XferWater();
540 }
541 }
542 array[num++] = _teleport[0];
543 array[num++] = _teleport[1];
544 for (int k = left; k < left + width; k++)
545 {
546 for (int l = top; l < top + height; l++)
547 {
548 Point16 back = new Point16(k, l);
549 Tile tile2 = Main.tile[k, l];
550 if (tile2 != null && tile2.wire2())
551 {
552 _wireList.PushBack(back);
553 }
554 }
555 }
556 _teleport[0].X = -1f;
557 _teleport[0].Y = -1f;
558 _teleport[1].X = -1f;
559 _teleport[1].Y = -1f;
560 if (_wireList.Count > 0)
561 {
562 _numInPump = 0;
563 _numOutPump = 0;
564 HitWire(_wireList, 2);
565 if (_numInPump > 0 && _numOutPump > 0)
566 {
567 XferWater();
568 }
569 }
570 array[num++] = _teleport[0];
571 array[num++] = _teleport[1];
572 _teleport[0].X = -1f;
573 _teleport[0].Y = -1f;
574 _teleport[1].X = -1f;
575 _teleport[1].Y = -1f;
576 for (int m = left; m < left + width; m++)
577 {
578 for (int n = top; n < top + height; n++)
579 {
580 Point16 back = new Point16(m, n);
581 Tile tile3 = Main.tile[m, n];
582 if (tile3 != null && tile3.wire3())
583 {
584 _wireList.PushBack(back);
585 }
586 }
587 }
588 if (_wireList.Count > 0)
589 {
590 _numInPump = 0;
591 _numOutPump = 0;
592 HitWire(_wireList, 3);
593 if (_numInPump > 0 && _numOutPump > 0)
594 {
595 XferWater();
596 }
597 }
598 array[num++] = _teleport[0];
599 array[num++] = _teleport[1];
600 _teleport[0].X = -1f;
601 _teleport[0].Y = -1f;
602 _teleport[1].X = -1f;
603 _teleport[1].Y = -1f;
604 for (int num2 = left; num2 < left + width; num2++)
605 {
606 for (int num3 = top; num3 < top + height; num3++)
607 {
608 Point16 back = new Point16(num2, num3);
609 Tile tile4 = Main.tile[num2, num3];
610 if (tile4 != null && tile4.wire4())
611 {
612 _wireList.PushBack(back);
613 }
614 }
615 }
616 if (_wireList.Count > 0)
617 {
618 _numInPump = 0;
619 _numOutPump = 0;
620 HitWire(_wireList, 4);
621 if (_numInPump > 0 && _numOutPump > 0)
622 {
623 XferWater();
624 }
625 }
626 array[num++] = _teleport[0];
627 array[num++] = _teleport[1];
628 running = false;
629 for (int num4 = 0; num4 < 8; num4 += 2)
630 {
631 _teleport[0] = array[num4];
632 _teleport[1] = array[num4 + 1];
633 if (_teleport[0].X >= 0f && _teleport[1].X >= 0f)
634 {
635 Teleport();
636 }
637 }
638 PixelBoxPass();
640 }
static DoubleStack< byte > _wireDirectionList
Definition Wiring.cs:23
static void HitWire(DoubleStack< Point16 > next, int wireType)
Definition Wiring.cs:811
static void Teleport()
Definition Wiring.cs:2776
static int _numInPump
Definition Wiring.cs:45
static void PixelBoxPass()
Definition Wiring.cs:642
static void LogicGatePass()
Definition Wiring.cs:656
static bool running
Definition Wiring.cs:17
static DoubleStack< Point16 > _wireList
Definition Wiring.cs:21
static Vector2[] _teleport
Definition Wiring.cs:37
static int _numOutPump
Definition Wiring.cs:51
static void XferWater()
Definition Wiring.cs:449

References Terraria.Wiring._numInPump, Terraria.Wiring._numOutPump, Terraria.Wiring._teleport, Terraria.Wiring._wireDirectionList, Terraria.Wiring._wireList, System.array, Terraria.Wiring.HitWire(), Terraria.Wiring.LogicGatePass(), Terraria.Main.netMode, Terraria.Wiring.PixelBoxPass(), Terraria.Wiring.running, Terraria.Wiring.Teleport(), Terraria.Main.tile, Terraria.Tile.wire(), System.X, and Terraria.Wiring.XferWater().

Referenced by Terraria.Wiring.HitSwitch(), Terraria.Wiring.LogicGatePass(), and Terraria.Wiring.UpdateMech().