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

◆ AI_118_Seahorses()

void Terraria.NPC.AI_118_Seahorses ( )
inlineprivate

Definition at line 48722 of file NPC.cs.

48723 {
48724 //IL_000d: Unknown result type (might be due to invalid IL or missing references)
48725 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
48726 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
48727 //IL_01a1: Unknown result type (might be due to invalid IL or missing references)
48728 //IL_01ab: Unknown result type (might be due to invalid IL or missing references)
48729 //IL_01b0: Unknown result type (might be due to invalid IL or missing references)
48730 //IL_00cb: Unknown result type (might be due to invalid IL or missing references)
48731 //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
48732 //IL_00e2: Unknown result type (might be due to invalid IL or missing references)
48733 //IL_00e7: Unknown result type (might be due to invalid IL or missing references)
48734 //IL_00ec: Unknown result type (might be due to invalid IL or missing references)
48735 //IL_020a: Unknown result type (might be due to invalid IL or missing references)
48736 //IL_020f: Unknown result type (might be due to invalid IL or missing references)
48737 //IL_0243: Unknown result type (might be due to invalid IL or missing references)
48738 //IL_0254: Unknown result type (might be due to invalid IL or missing references)
48739 //IL_0264: Unknown result type (might be due to invalid IL or missing references)
48740 //IL_0269: Unknown result type (might be due to invalid IL or missing references)
48741 noGravity = wet;
48742 Collision.GetWaterLineIterate(base.Center.ToTileCoordinates(), out var waterLineHeight);
48743 bool flag = waterLineHeight > 0f && base.Top.Y - waterLineHeight < 20f;
48744 if (!wet)
48745 {
48746 if (velocity.Y == 0f)
48747 {
48748 velocity.X *= 0.95f;
48749 }
48750 rotation += (velocity.X + velocity.Y) / 2f * 0.05f;
48751 }
48752 else
48753 {
48754 ai[1] -= 1f;
48755 if (ai[1] <= 0f)
48756 {
48757 velocity += ai[0].ToRotationVector2() * 0.06f;
48758 float num = ((Vector2)(ref velocity)).Length();
48759 if (num > 3f || num < -3f)
48760 {
48761 velocity.X = Math.Min(3f, Math.Max(-3f, velocity.X));
48762 ai[1] = Main.rand.Next(450, 600);
48763 ai[0] = Main.rand.NextFloat() * ((float)Math.PI * 2f);
48764 if (flag && ai[0] > (float)Math.PI)
48765 {
48766 ai[0] -= (float)Math.PI;
48767 }
48768 netUpdate = true;
48769 }
48770 }
48771 else
48772 {
48773 velocity *= 0.95f;
48774 }
48775 rotation = velocity.X * 0.1f;
48776 }
48777 bool flag2 = collideY && wet && (!flag || velocity.Y < 0f);
48778 if (collideX || flag2)
48779 {
48780 Vector2 v = ai[0].ToRotationVector2();
48781 if (collideX)
48782 {
48783 v.X *= -1f;
48784 }
48785 if (flag2)
48786 {
48787 v.Y *= -1f;
48788 }
48789 ai[0] = v.ToRotation();
48790 velocity = ai[0].ToRotationVector2() * ((Vector2)(ref velocity)).Length();
48791 netUpdate = true;
48792 }
48793 }
bool wet
The Entity is currently in water. Projectile: Affects movement speed and some projectiles die when ...
Definition Entity.cs:57
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
bool noGravity
If true, the npc will not be affected by gravity. Demon Eyes and other floating npc use this....
Definition NPC.cs:1122
float[] ai
An array with 4 slots used for any sort of data storage, which is occasionally synced from the server...
Definition NPC.cs:997
bool collideX
Definition NPC.cs:1134
bool collideY
Definition NPC.cs:1136
float rotation
Definition NPC.cs:1116
bool netUpdate
Definition NPC.cs:1130

References Terraria.NPC.ai, Terraria.NPC.collideX, Terraria.NPC.collideY, Terraria.Collision.GetWaterLineIterate(), Terraria.NPC.netUpdate, Terraria.NPC.noGravity, Terraria.Main.rand, Terraria.NPC.rotation, Terraria.Entity.velocity, and Terraria.Entity.wet.

Referenced by Terraria.NPC.VanillaAI_Inner().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: