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

◆ CutTiles()

void Terraria.Projectile.CutTiles ( )
inlineprivate

Definition at line 13156 of file Projectile.cs.

13157 {
13158 if (!CanCutTiles())
13159 {
13160 return;
13161 }
13162 AchievementsHelper.CurrentlyMining = true;
13163 bool flag = true;
13164 bool[] tileCutIgnorance = Main.player[owner].GetTileCutIgnorance(allowRegrowth: false, trap);
13165 DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
13166 DelegateMethods.tileCutIgnore = tileCutIgnorance;
13168 if (type == 461 || type == 632 || type == 642)
13169 {
13170 Utils.PlotTileLine(base.Center, base.Center + velocity * localAI[1], (float)width * scale, DelegateMethods.CutTiles);
13171 }
13172 else if (ProjectileID.Sets.IsAWhip[type])
13173 {
13174 flag = false;
13177 Vector2 vector = new Vector2((float)width * scale / 2f, 0f);
13178 for (int i = 0; i < WhipPointsForCollision.Count; i++)
13179 {
13180 Utils.PlotTileLine(WhipPointsForCollision[i] - vector, WhipPointsForCollision[i] + vector, (float)height * scale, DelegateMethods.CutTiles);
13181 }
13182 }
13183 else if (type == 756)
13184 {
13185 Utils.PlotTileLine(base.Center, base.Center + velocity.SafeNormalize(-Vector2.UnitY) * 200f * scale, 22f * scale, DelegateMethods.CutTiles);
13186 }
13187 else if (type == 927)
13188 {
13189 Vector2 end = base.Center + velocity.SafeNormalize(Vector2.UnitX) * 220f * scale;
13190 Utils.PlotTileLine(base.Center, end, 80f * scale, DelegateMethods.CutTiles);
13191 }
13192 else if (type == 802 || type == 842 || type == 938 || type == 939 || type == 940 || type == 941 || type == 942 || type == 943 || type == 944 || type == 945)
13193 {
13194 Utils.PlotTileLine(base.Center, base.Center + velocity.SafeNormalize(-Vector2.UnitY) * 10f, 10f * scale, DelegateMethods.CutTiles);
13195 }
13196 else if (type == 611)
13197 {
13198 Utils.PlotTileLine(base.Center, base.Center + velocity + velocity.SafeNormalize(Vector2.Zero) * 48f, (float)width * scale, DelegateMethods.CutTiles);
13199 }
13200 else if (type == 697 || type == 707)
13201 {
13202 float num = 40f;
13203 if (type == 707)
13204 {
13205 num = 60f;
13206 }
13207 float f = rotation - (float)Math.PI / 4f * (float)Math.Sign(velocity.X);
13208 Utils.PlotTileLine(base.Center + f.ToRotationVector2() * (0f - num), base.Center + f.ToRotationVector2() * num, (float)width * scale, DelegateMethods.CutTiles);
13209 }
13210 else if (aiStyle == 190 || aiStyle == 191)
13211 {
13212 flag = false;
13213 Vector2 vector2 = (rotation - (float)Math.PI / 4f).ToRotationVector2() * 60f * scale;
13214 Vector2 vector3 = (rotation + (float)Math.PI / 4f).ToRotationVector2() * 60f * scale;
13215 float num2 = 60f * scale;
13216 Utils.PlotTileLine(base.Center + vector2, base.Center + vector3, num2, DelegateMethods.CutTiles);
13217 }
13219 {
13220 CutTilesAt(extensionBox.TopLeft(), extensionBox.Width, extensionBox.Height);
13221 }
13222 if (flag)
13223 {
13225 }
13226 AchievementsHelper.CurrentlyMining = false;
13227 }
const double PI
Definition Math.cs:16
static int Sign(decimal value)
Definition Math.cs:1202
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
static void FillWhipControlPoints(Projectile proj, List< Vector2 > controlPoints)
bool AI_019_Spears_GetExtensionHitbox(out Rectangle extensionBox)
List< Vector2 > WhipPointsForCollision
void CutTilesAt(Vector2 boxPosition, int boxWidth, int boxHeight)

References Terraria.Projectile.AI_019_Spears_GetExtensionHitbox(), Terraria.Projectile.aiStyle, Terraria.Projectile.CanCutTiles(), System.Collections.Generic.List< T >.Clear(), System.Collections.Generic.List< T >.Count, Terraria.DelegateMethods.CutTiles(), Terraria.Projectile.CutTilesAt(), Terraria.Projectile.FillWhipControlPoints(), Terraria.Entity.height, Terraria.ID.ProjectileID.Sets.IsAWhip, Terraria.Projectile.localAI, Terraria.Projectile.owner, System.Math.PI, Terraria.Main.player, Terraria.Utils.PlotTileLine(), Terraria.Entity.position, Terraria.Projectile.rotation, Terraria.Projectile.scale, System.Math.Sign(), Terraria.Projectile.trap, Terraria.Projectile.type, Microsoft.Xna.Framework.Vector2.UnitX, Microsoft.Xna.Framework.Vector2.UnitY, Terraria.Entity.velocity, Terraria.Projectile.WhipPointsForCollision, Terraria.Entity.width, Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.Projectile.Damage().