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

◆ UpdateNPC_UpdateTrails()

void Terraria.NPC.UpdateNPC_UpdateTrails ( )
inlineprivate

Definition at line 87556 of file NPC.cs.

87557 {
87558 int num = NPCID.Sets.TrailingMode[type];
87559 if (num == 0)
87560 {
87561 if (localAI[3] <= 0f)
87562 {
87563 localAI[3] = 2f;
87564 for (int num2 = oldPos.Length - 1; num2 > 0; num2--)
87565 {
87566 oldPos[num2] = oldPos[num2 - 1];
87567 }
87568 oldPos[0] = position + netOffset;
87569 }
87570 localAI[3] -= 1f;
87571 }
87572 if (num == 1)
87573 {
87574 for (int num3 = oldPos.Length - 1; num3 > 0; num3--)
87575 {
87576 oldPos[num3] = oldPos[num3 - 1];
87577 }
87578 oldPos[0] = position + netOffset;
87579 }
87580 if (num == 2)
87581 {
87582 if ((int)ai[0] == 4 || ai[0] == 5f || ai[0] == 6f)
87583 {
87584 for (int num4 = oldPos.Length - 1; num4 > 0; num4--)
87585 {
87586 oldPos[num4] = oldPos[num4 - 1];
87587 oldRot[num4] = oldRot[num4 - 1];
87588 }
87589 oldPos[0] = position + netOffset;
87590 oldRot[0] = rotation;
87591 }
87592 else
87593 {
87594 for (int num5 = oldPos.Length - 1; num5 >= 0; num5--)
87595 {
87597 oldRot[num5] = rotation;
87598 }
87599 }
87600 }
87601 if (num == 3)
87602 {
87603 for (int num6 = oldPos.Length - 1; num6 > 0; num6--)
87604 {
87605 oldPos[num6] = oldPos[num6 - 1];
87606 oldRot[num6] = oldRot[num6 - 1];
87607 }
87608 oldPos[0] = position + netOffset;
87609 oldRot[0] = rotation;
87610 }
87611 switch (num)
87612 {
87613 case 4:
87614 {
87615 for (int num9 = oldPos.Length - 1; num9 > 0; num9--)
87616 {
87617 oldPos[num9] = oldPos[num9 - 1];
87618 Lighting.AddLight((int)position.X / 16, (int)position.Y / 16, 0.3f, 0f, 0.2f);
87619 }
87620 oldPos[0] = position + netOffset;
87621 break;
87622 }
87623 case 5:
87624 {
87625 for (int num8 = oldPos.Length - 1; num8 > 0; num8--)
87626 {
87627 oldPos[num8] = oldPos[num8 - 1];
87628 }
87629 oldPos[0] = position + netOffset;
87630 break;
87631 }
87632 case 6:
87633 {
87634 for (int num10 = oldPos.Length - 1; num10 > 0; num10--)
87635 {
87636 oldPos[num10] = oldPos[num10 - 1];
87637 }
87638 oldPos[0] = position + netOffset;
87639 break;
87640 }
87641 case 7:
87642 {
87643 for (int num7 = oldPos.Length - 1; num7 > 0; num7--)
87644 {
87645 oldPos[num7] = oldPos[num7 - 1];
87646 oldRot[num7] = oldRot[num7 - 1];
87647 }
87648 oldPos[0] = position + netOffset;
87649 oldRot[0] = rotation;
87650 break;
87651 }
87652 }
87653 }
Vector2 position
Definition Entity.cs:14
static int[] TrailingMode
Definition NPCID.cs:4162
Vector2 netOffset
Definition NPC.cs:103
float[] localAI
Definition NPC.cs:449
float[] oldRot
Definition NPC.cs:157
float[] ai
Definition NPC.cs:447
int type
Definition NPC.cs:445
float rotation
Definition NPC.cs:501
Vector2[] oldPos
Definition NPC.cs:155

References Terraria.Lighting.AddLight(), Microsoft.Xna.Framework.Vector2.Length(), Terraria.ID.NPCID.Sets.TrailingMode, and System.type.