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

◆ AI_015_HandleMovementCollision()

void Terraria.Projectile.AI_015_HandleMovementCollision ( ref Vector2 wetVelocity,
ref Vector2 lastVelocity )
inlineprivate

Definition at line 35725 of file Projectile.cs.

35726 {
35727 int num = 10;
35728 int num2 = 0;
35730 float num3 = 0.2f;
35731 if (ai[0] == 1f || ai[0] == 5f)
35732 {
35733 num3 = 0.4f;
35734 }
35735 if (ai[0] == 6f)
35736 {
35737 num3 = 0f;
35738 }
35739 if (lastVelocity.X != velocity.X)
35740 {
35741 if (Math.Abs(lastVelocity.X) > 4f)
35742 {
35743 num2 = 1;
35744 }
35745 velocity.X = (0f - lastVelocity.X) * num3;
35746 localAI[0] += 1f;
35747 }
35748 if (lastVelocity.Y != velocity.Y)
35749 {
35750 if (Math.Abs(lastVelocity.Y) > 4f)
35751 {
35752 num2 = 1;
35753 }
35754 velocity.Y = (0f - lastVelocity.Y) * num3;
35755 localAI[0] += 1f;
35756 }
35757 if (ai[0] == 1f)
35758 {
35759 ai[0] = 5f;
35760 localNPCHitCooldown = num;
35761 netUpdate = true;
35762 Point scanAreaStart = base.TopLeft.ToTileCoordinates();
35763 Point scanAreaEnd = base.BottomRight.ToTileCoordinates();
35764 num2 = 2;
35767 position -= vector;
35768 }
35769 if (num2 > 0)
35770 {
35771 netUpdate = true;
35772 for (int i = 0; i < num2; i++)
35773 {
35774 Collision.HitTiles(position, vector, width, height);
35775 }
35776 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
35777 }
35778 if (ai[0] != 3f && ai[0] != 0f && ai[0] != 5f && ai[0] != 6f && localAI[0] >= 10f)
35779 {
35780 ai[0] = 4f;
35781 netUpdate = true;
35782 }
35783 if (wet)
35784 {
35786 }
35787 }
static double Abs(double value)
static void PlaySound(int type, Vector2 position, int style=1)
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
void CreateImpactExplosion(int dustAmountMultiplier, Vector2 explosionOrigin, ref Point scanAreaStart, ref Point scanAreaEnd, int explosionRange, out bool causedShockwaves)
void CreateImpactExplosion2_FlailTileCollision(Vector2 explosionOrigin, bool causedShockwaves, Vector2 velocityBeforeCollision)

References System.Math.Abs(), Terraria.Collision.HitTiles(), Terraria.Audio.SoundEngine.PlaySound(), Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Y.

Referenced by Terraria.Projectile.HandleMovement().