From 06fa4569a857c8713a6cb1b0cb739a4b6157a955 Mon Sep 17 00:00:00 2001 From: FyloZ Date: Fri, 12 Jun 2020 19:28:38 -0400 Subject: [PATCH] Started work on Staff of Shifting Sands --- .../Weapons/DuneWyrm/StaffofShiftingSands.cs | 29 ++ .../Weapons/DuneWyrm/StaffofShiftingSands.png | Bin 0 -> 3481 bytes .../AncientTombCrawlerFriendly.cs | 146 ++++++ Lib/Items/DecimationWeapon.cs | 6 +- Lib/Projectile/WormProjectile.cs | 485 ++++++++++++++++++ Lib/Util/ProjectileUtils.cs | 12 + 6 files changed, 677 insertions(+), 1 deletion(-) create mode 100644 Content/Items/Weapons/DuneWyrm/StaffofShiftingSands.cs create mode 100644 Content/Items/Weapons/DuneWyrm/StaffofShiftingSands.png create mode 100644 Content/NPCs/DuneWyrm/AncientTombCrawler/AncientTombCrawlerFriendly.cs create mode 100644 Lib/Projectile/WormProjectile.cs create mode 100644 Lib/Util/ProjectileUtils.cs diff --git a/Content/Items/Weapons/DuneWyrm/StaffofShiftingSands.cs b/Content/Items/Weapons/DuneWyrm/StaffofShiftingSands.cs new file mode 100644 index 0000000..752c6f6 --- /dev/null +++ b/Content/Items/Weapons/DuneWyrm/StaffofShiftingSands.cs @@ -0,0 +1,29 @@ +using Decimation.Content.NPCs.DuneWyrm.AncientTombCrawler; +using Decimation.Lib.Items; +using Decimation.Lib.Util; +using Terraria; +using Terraria.ModLoader; + +namespace Decimation.Content.Items.Weapons.DuneWyrm +{ + public class StaffofShiftingSands : DecimationWeapon + { + protected override string ItemName => "Staff of Shifting Sands"; + protected override int Damages => 30; + protected override DamageType DamagesType => DamageType.Summon; + + protected override void InitWeapon() + { + item.width = 42; + item.height = 42; + item.rare = Rarity.LightRed.GetRarityValue(); + } + + public override bool UseItem(Player player) + { + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + + return true; + } + } +} \ No newline at end of file diff --git a/Content/Items/Weapons/DuneWyrm/StaffofShiftingSands.png b/Content/Items/Weapons/DuneWyrm/StaffofShiftingSands.png new file mode 100644 index 0000000000000000000000000000000000000000..f1584c42c1530d3ffaf6adf5400a0f6b467e8a3f GIT binary patch literal 3481 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 Hu0mjfbj*q# literal 0 HcmV?d00001 diff --git a/Content/NPCs/DuneWyrm/AncientTombCrawler/AncientTombCrawlerFriendly.cs b/Content/NPCs/DuneWyrm/AncientTombCrawler/AncientTombCrawlerFriendly.cs new file mode 100644 index 0000000..3e80df1 --- /dev/null +++ b/Content/NPCs/DuneWyrm/AncientTombCrawler/AncientTombCrawlerFriendly.cs @@ -0,0 +1,146 @@ +using System.IO; +using Decimation.Lib.NPCs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace Decimation.Content.NPCs.DuneWyrm.AncientTombCrawler +{ + + public class AncientTombCrawlerFriendlyHead : AncientTombCrawlerFriendly + { + public override void SetDefaults() + { + npc.damage = 50; + npc.defense = 5; + npc.width = 38; + npc.height = 38; + npc.value = Item.buyPrice(gold: 3); + npc.npcSlots = 1f; + npc.aiStyle = -1; + npc.dontTakeDamage = true; + } + + public override void Init() + { + base.Init(); + head = true; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Draw("Content/NPCs/DuneWyrm/AncientTombCrawler/AncientTombCrawlerHead", spriteBatch, drawColor); + + return false; + } + } + + public class AncientTombCrawlerFriendlyBody : AncientTombCrawlerFriendly + { + public override void SetDefaults() + { + npc.width = 24; + npc.height = 24; + npc.damage = 35; + npc.defense = 2; + npc.lifeMax = 1; + npc.dontCountMe = true; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Draw("Content/NPCs/DuneWyrm/AncientTombCrawler/AncientTombCrawlerBody", spriteBatch, drawColor); + + return false; + } + } + + public class AncientTombCrawlerFriendlyTail : AncientTombCrawlerFriendly + { + public override void SetDefaults() + { + npc.width = 20; + npc.height = 20; + npc.damage = 35; + npc.defense = 2; + npc.lifeMax = 1; + npc.dontCountMe = true; + } + + public override void Init() + { + base.Init(); + tail = true; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Draw("Content/NPCs/DuneWyrm/AncientTombCrawler/AncientTombCrawlerTail", spriteBatch, drawColor); + + return false; + } + } + + public abstract class AncientTombCrawlerFriendly : Worm + { + protected const float BaseSpeed = 10f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient Tomb Crawler"); + } + + public override void Init() + { + minLength = 8; + maxLength = 8; + tailType = ModContent.NPCType(); + bodyType = ModContent.NPCType(); + headType = ModContent.NPCType(); + speed = BaseSpeed; + turnSpeed = 0.045f; + npc.scale = 1.5f; + npc.lavaImmune = true; + npc.noGravity = true; + npc.noTileCollide = true; + npc.behindTiles = true; + npc.knockBackResist = 0f; + npc.netAlways = true; + npc.DeathSound = SoundID.NPCDeath18; + npc.HitSound = SoundID.NPCHit1; + undergroundSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Earthquake"); + } + + protected override void SendSoundPacket() + { + // GetPacket(AncientTombCrawlerMessageType.UndergroundSound).Send(); + } + + private ModPacket GetPacket(AncientTombCrawlerMessageType type) + { + ModPacket packet = mod.GetPacket(); + // packet.Write((byte) DecimationModMessageType.AncientTombCrawler); + // packet.Write(npc.whoAmI); + // packet.Write((byte) type); + return packet; + } + + public void HandlePacket(BinaryReader reader) + { + // AncientTombCrawlerMessageType type = (AncientTombCrawlerMessageType) reader.ReadByte(); + // switch (type) + // { + // case AncientTombCrawlerMessageType.UndergroundSound: + // Main.PlaySound(undergroundSound, npc.Center); + // break; + // } + } + + public override bool ShouldRun() + { + return false; + } + } +} \ No newline at end of file diff --git a/Lib/Items/DecimationWeapon.cs b/Lib/Items/DecimationWeapon.cs index 94e643d..4a5c356 100644 --- a/Lib/Items/DecimationWeapon.cs +++ b/Lib/Items/DecimationWeapon.cs @@ -11,7 +11,8 @@ namespace Decimation.Lib.Items Melee, Magic, Throw, - Ranged + Ranged, + Summon } protected virtual DamageType DamagesType { get; } = DamageType.Melee; @@ -43,6 +44,9 @@ namespace Decimation.Lib.Items case DamageType.Throw: item.thrown = true; break; + case DamageType.Summon: + item.summon = true; + break; default: item.melee = true; break; diff --git a/Lib/Projectile/WormProjectile.cs b/Lib/Projectile/WormProjectile.cs new file mode 100644 index 0000000..718ae54 --- /dev/null +++ b/Lib/Projectile/WormProjectile.cs @@ -0,0 +1,485 @@ +using System; +using Decimation.Content.Projectiles; +using Decimation.Lib.Util; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; + +namespace Decimation.Lib.projectiles +{ + public abstract class WormProjectile : DecimationProjectile + { + // protected int BodyType; + // protected bool Directional = false; + // + // protected bool Flies = false; + // + // /* ai[0] = follower + // * ai[1] = following + // * ai[2] = distanceFromTail + // * ai[3] = head + // */ + // protected bool Head; + // protected int HeadType; + // protected int MaxLength; + // protected int MinLength; + // protected float Speed; + // protected bool Tail; + // protected int TailType; + // + // protected float TurnSpeed; + // + // protected int Target; + // protected int RealLife; + // + // public override void AI() + // { + // if (projectile.localAI[1] == 0f) + // { + // projectile.localAI[1] = 1f; + // Init(); + // } + // + // if (projectile.ai[3] > 0f) RealLife = (int) projectile.ai[3]; + // if (!Head && projectile.timeLeft < 300) projectile.timeLeft = 300; + // if (Target < 0 || Target == 255 || Main.player[Target].dead) + // TargetClosest(); + // if (Main.player[Target].dead && projectile.timeLeft > 300) projectile.timeLeft = 300; + // if (Main.netMode != 1) + // { + // if (!Tail && projectile.ai[0] == 0f) + // { + // if (Head) + // { + // projectile.ai[3] = projectile.whoAmI; + // RealLife = projectile.whoAmI; + // projectile.ai[2] = Main.rand.Next(MinLength, MaxLength + 1); + // projectile.ai[0] = Projectile.NewProjectile( + // (int) (projectile.position.X + projectile.width / 2f), + // (int) (projectile.position.Y + projectile.height), + // 0f, + // 0f, + // BodyType, + // 0, + // 0f, + // projectile.owner + // ); + // } + // else if (projectile.ai[2] > 0f) + // { + // projectile.ai[0] = Projectile.NewProjectile( + // (int) (projectile.position.X + projectile.width / 2f), + // (int) (projectile.position.Y + projectile.height), + // 0f, + // 0f, + // projectile.type, + // 0, + // 0f, + // projectile.owner + // ); + // } + // else + // { + // projectile.ai[0] = Projectile.NewProjectile( + // (int) (projectile.position.X + projectile.width / 2f), + // (int) (projectile.position.Y + projectile.height), + // 0f, + // 0f, + // TailType, + // 0, + // 0f, + // projectile.whoAmI + // ); + // } + // + // Main.projectile[(int) projectile.ai[0]].ai[3] = projectile.ai[3]; + // ((WormProjectile) Main.projectile[(int) projectile.ai[0]].modProjectile).RealLife = RealLife; + // Main.projectile[(int) projectile.ai[0]].ai[1] = projectile.whoAmI; + // Main.projectile[(int) projectile.ai[0]].ai[2] = projectile.ai[2] - 1f; + // projectile.netUpdate = true; + // } + // + // if (!Head && (!Main.projectile[(int) projectile.ai[1]].active || + // Main.projectile[(int) projectile.ai[1]].type != HeadType && + // Main.projectile[(int) projectile.ai[1]].type != BodyType)) + // { + // // projectile.life = 0; + // // projectile.HitEffect(); + // projectile.active = false; + // } + // + // if (!Tail && (!Main.projectile[(int) projectile.ai[0]].active || + // Main.projectile[(int) projectile.ai[0]].type != BodyType && + // Main.projectile[(int) projectile.ai[0]].type != TailType)) + // { + // // projectile.life = 0; + // // projectile.HitEffect(); + // projectile.active = false; + // } + // + // if (!projectile.active && Main.netMode == 2) + // NetMessage.SendData(28, -1, -1, null, projectile.whoAmI, -1f); + // } + // + // var num180 = (int) (projectile.position.X / 16f) - 1; + // var num181 = (int) ((projectile.position.X + projectile.width) / 16f) + 2; + // var num182 = (int) (projectile.position.Y / 16f) - 1; + // var num183 = (int) ((projectile.position.Y + projectile.height) / 16f) + 2; + // if (num180 < 0) num180 = 0; + // if (num181 > Main.maxTilesX) num181 = Main.maxTilesX; + // if (num182 < 0) num182 = 0; + // if (num183 > Main.maxTilesY) num183 = Main.maxTilesY; + // var flag18 = Flies; + // if (!flag18) + // for (var num184 = num180; num184 < num181; num184++) + // for (var num185 = num182; num185 < num183; num185++) + // if (Main.tile[num184, num185] != null && + // (Main.tile[num184, num185].nactive() && + // (Main.tileSolid[Main.tile[num184, num185].type] || + // Main.tileSolidTop[Main.tile[num184, num185].type] && Main.tile[num184, num185].frameY == 0) || + // Main.tile[num184, num185].liquid > 64)) + // { + // Vector2 vector17; + // vector17.X = num184 * 16; + // vector17.Y = num185 * 16; + // if (projectile.position.X + projectile.width > vector17.X && + // projectile.position.X < vector17.X + 16f && + // projectile.position.Y + projectile.height > vector17.Y && + // projectile.position.Y < vector17.Y + 16f) + // { + // flag18 = true; + // // if (Main.rand.NextBool(100) && projectile.behindTiles && + // // Main.tile[num184, num185].nactive()) + // // WorldGen.KillTile(num184, num185, true, true); + // if (Main.netMode != 1 && Main.tile[num184, num185].type == 2) + // { + // var arg_BFCA_0 = Main.tile[num184, num185 - 1].type; + // } + // } + // } + // + // if (!flag18 && Head) + // { + // var rectangle = new Rectangle((int) projectile.position.X, (int) projectile.position.Y, + // projectile.width, projectile.height); + // var num186 = 1000; + // var flag19 = true; + // for (var num187 = 0; num187 < 255; num187++) + // if (Main.player[num187].active) + // { + // var rectangle2 = new Rectangle((int) Main.player[num187].position.X - num186, + // (int) Main.player[num187].position.Y - num186, num186 * 2, num186 * 2); + // if (rectangle.Intersects(rectangle2)) + // { + // flag19 = false; + // break; + // } + // } + // + // if (flag19) flag18 = true; + // } + // + // if (Directional) + // { + // if (projectile.velocity.X < 0f) + // projectile.spriteDirection = 1; + // else if (projectile.velocity.X > 0f) projectile.spriteDirection = -1; + // } + // + // var num188 = Speed; + // var num189 = TurnSpeed; + // var vector18 = new Vector2(projectile.position.X + projectile.width * 0.5f, + // projectile.position.Y + projectile.height * 0.5f); + // var num191 = Main.player[Target].position.X + Main.player[Target].width / 2; + // var num192 = Main.player[Target].position.Y + Main.player[Target].height / 2; + // num191 = (int) (num191 / 16f) * 16; + // num192 = (int) (num192 / 16f) * 16; + // vector18.X = (int) (vector18.X / 16f) * 16; + // vector18.Y = (int) (vector18.Y / 16f) * 16; + // num191 -= vector18.X; + // num192 -= vector18.Y; + // var num193 = (float) Math.Sqrt(num191 * num191 + num192 * num192); + // if (projectile.ai[1] > 0f && projectile.ai[1] < Main.projectile.Length) + // { + // try + // { + // vector18 = new Vector2(projectile.position.X + projectile.width * 0.5f, + // projectile.position.Y + projectile.height * 0.5f); + // num191 = Main.projectile[(int) projectile.ai[1]].position.X + + // Main.projectile[(int) projectile.ai[1]].width / 2 - + // vector18.X; + // num192 = Main.projectile[(int) projectile.ai[1]].position.Y + + // Main.projectile[(int) projectile.ai[1]].height / 2 - + // vector18.Y; + // } + // catch + // { + // } + // + // projectile.rotation = (float) Math.Atan2(num192, num191) + 1.57f; + // num193 = (float) Math.Sqrt(num191 * num191 + num192 * num192); + // int num194 = projectile.width; + // num193 = (num193 - num194) / num193; + // num191 *= num193; + // num192 *= num193; + // projectile.velocity = Vector2.Zero; + // projectile.position.X = projectile.position.X + num191; + // projectile.position.Y = projectile.position.Y + num192; + // if (Directional) + // { + // if (num191 < 0f) projectile.spriteDirection = 1; + // if (num191 > 0f) projectile.spriteDirection = -1; + // } + // } + // else + // { + // if (!flag18) + // { + // TargetClosest(); + // projectile.velocity.Y = projectile.velocity.Y + 0.11f; + // if (projectile.velocity.Y > num188) projectile.velocity.Y = num188; + // if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < num188 * 0.4) + // { + // if (projectile.velocity.X < 0f) + // projectile.velocity.X = projectile.velocity.X - num189 * 1.1f; + // else + // projectile.velocity.X = projectile.velocity.X + num189 * 1.1f; + // } + // else if (projectile.velocity.Y == num188) + // { + // if (projectile.velocity.X < num191) + // projectile.velocity.X = projectile.velocity.X + num189; + // else if (projectile.velocity.X > num191) projectile.velocity.X = projectile.velocity.X - num189; + // } + // else if (projectile.velocity.Y > 4f) + // { + // if (projectile.velocity.X < 0f) + // projectile.velocity.X = projectile.velocity.X + num189 * 0.9f; + // else + // projectile.velocity.X = projectile.velocity.X - num189 * 0.9f; + // } + // } + // else + // { + // if (!Flies && projectile.BehindTiles() && projectile.soundDelay == 0) + // if (Main.netMode != NetmodeID.MultiplayerClient) + // { + // projectile.soundDelay = 120; + // + // Main.PlaySound(undergroundSound, projectile.position); + // if (Main.netMode == NetmodeID.Server) SendSoundPacket(); + // } + // + // num193 = (float) Math.Sqrt(num191 * num191 + num192 * num192); + // var num196 = Math.Abs(num191); + // var num197 = Math.Abs(num192); + // var num198 = num188 / num193; + // num191 *= num198; + // num192 *= num198; + // if (ShouldRun()) + // { + // if (Main.netMode != 1 && + // projectile.position.Y / 16f > (Main.rockLayer + Main.maxTilesY) / 2.0) + // { + // projectile.active = false; + // var num200 = (int) projectile.ai[0]; + // while (num200 > 0 && num200 < 200 && Main.projectile[num200].active && + // Main.projectile[num200].aiStyle == projectile.aiStyle) + // { + // var num201 = (int) Main.projectile[num200].ai[0]; + // Main.projectile[num200].active = false; + // projectile.life = 0; + // if (Main.netMode == 2) NetMessage.SendData(23, -1, -1, null, num200); + // num200 = num201; + // } + // + // if (Main.netMode == 2) NetMessage.SendData(23, -1, -1, null, projectile.whoAmI); + // } + // + // num191 = 0f; + // num192 = num188; + // } + // + // var flag21 = false; + // if (projectile.type == 87) + // { + // if ((projectile.velocity.X > 0f && num191 < 0f || projectile.velocity.X < 0f && num191 > 0f || + // projectile.velocity.Y > 0f && num192 < 0f || projectile.velocity.Y < 0f && num192 > 0f) && + // Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) > num189 / 2f && + // num193 < 300f) + // { + // flag21 = true; + // if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < num188) + // projectile.velocity *= 1.1f; + // } + // + // if (projectile.position.Y > Main.player[Target].position.Y || + // Main.player[Target].position.Y / 16f > Main.worldSurface || + // Main.player[Target].dead) + // { + // flag21 = true; + // if (Math.Abs(projectile.velocity.X) < num188 / 2f) + // { + // if (projectile.velocity.X == 0f) + // projectile.velocity.X = projectile.velocity.X - projectile.direction; + // projectile.velocity.X = projectile.velocity.X * 1.1f; + // } + // else + // { + // if (projectile.velocity.Y > -num188) + // projectile.velocity.Y = projectile.velocity.Y - num189; + // } + // } + // } + // + // if (!flag21) + // { + // if (projectile.velocity.X > 0f && num191 > 0f || projectile.velocity.X < 0f && num191 < 0f || + // projectile.velocity.Y > 0f && num192 > 0f || projectile.velocity.Y < 0f && num192 < 0f) + // { + // if (projectile.velocity.X < num191) + // { + // projectile.velocity.X = projectile.velocity.X + num189; + // } + // else + // { + // if (projectile.velocity.X > num191) + // projectile.velocity.X = projectile.velocity.X - num189; + // } + // + // if (projectile.velocity.Y < num192) + // { + // projectile.velocity.Y = projectile.velocity.Y + num189; + // } + // else + // { + // if (projectile.velocity.Y > num192) + // projectile.velocity.Y = projectile.velocity.Y - num189; + // } + // + // if (Math.Abs(num192) < num188 * 0.2 && + // (projectile.velocity.X > 0f && num191 < 0f || + // projectile.velocity.X < 0f && num191 > 0f)) + // { + // if (projectile.velocity.Y > 0f) + // projectile.velocity.Y = projectile.velocity.Y + num189 * 2f; + // else + // projectile.velocity.Y = projectile.velocity.Y - num189 * 2f; + // } + // + // if (Math.Abs(num191) < num188 * 0.2 && + // (projectile.velocity.Y > 0f && num192 < 0f || + // projectile.velocity.Y < 0f && num192 > 0f)) + // { + // if (projectile.velocity.X > 0f) + // projectile.velocity.X = projectile.velocity.X + num189 * 2f; + // else + // projectile.velocity.X = projectile.velocity.X - num189 * 2f; + // } + // } + // else + // { + // if (num196 > num197) + // { + // if (projectile.velocity.X < num191) + // projectile.velocity.X = projectile.velocity.X + num189 * 1.1f; + // else if (projectile.velocity.X > num191) + // projectile.velocity.X = projectile.velocity.X - num189 * 1.1f; + // if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < num188 * 0.5) + // { + // if (projectile.velocity.Y > 0f) + // projectile.velocity.Y = projectile.velocity.Y + num189; + // else + // projectile.velocity.Y = projectile.velocity.Y - num189; + // } + // } + // else + // { + // if (projectile.velocity.Y < num192) + // projectile.velocity.Y = projectile.velocity.Y + num189 * 1.1f; + // else if (projectile.velocity.Y > num192) + // projectile.velocity.Y = projectile.velocity.Y - num189 * 1.1f; + // if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < num188 * 0.5) + // { + // if (projectile.velocity.X > 0f) + // projectile.velocity.X = projectile.velocity.X + num189; + // else + // projectile.velocity.X = projectile.velocity.X - num189; + // } + // } + // } + // } + // } + // + // projectile.rotation = (float) Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; + // if (Head) + // { + // if (flag18) + // { + // if (projectile.localAI[0] != 1f) projectile.netUpdate = true; + // projectile.localAI[0] = 1f; + // } + // else + // { + // if (projectile.localAI[0] != 0f) projectile.netUpdate = true; + // projectile.localAI[0] = 0f; + // } + // + // if ((projectile.velocity.X > 0f && projectile.oldVelocity.X < 0f || + // projectile.velocity.X < 0f && projectile.oldVelocity.X > 0f || + // projectile.velocity.Y > 0f && projectile.oldVelocity.Y < 0f || + // projectile.velocity.Y < 0f && projectile.oldVelocity.Y > 0f) && !projectile.justHit) + // { + // projectile.netUpdate = true; + // return; + // } + // } + // } + // + // CustomBehavior(); + // } + // + // public virtual void Init() + // { + // } + // + // public virtual bool ShouldRun() + // { + // return false; + // } + // + // public virtual void CustomBehavior() + // { + // } + // + // public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + // { + // return Head ? (bool?) null : false; + // } + // + // protected void Draw(string texturePath, SpriteBatch spriteBatch, Color drawColor) + // { + // var frameSize = new Vector2(projectile.width, projectile.height); + // var texture = mod.GetTexture(texturePath); + // + // spriteBatch.Draw + // ( + // texture, + // new Vector2( + // projectile.position.X - Main.screenPosition.X + frameSize.X / 2, + // projectile.position.Y - Main.screenPosition.Y + frameSize.Y / 2 + // ), + // projectile.frame, + // drawColor, + // projectile.rotation, + // frameSize * 0.5f, + // projectile.scale, + // SpriteEffects.None, + // 0f + // ); + // } + // + // protected abstract void SendSoundPacket(); + } +} \ No newline at end of file diff --git a/Lib/Util/ProjectileUtils.cs b/Lib/Util/ProjectileUtils.cs new file mode 100644 index 0000000..d0ffca1 --- /dev/null +++ b/Lib/Util/ProjectileUtils.cs @@ -0,0 +1,12 @@ +using Terraria; + +namespace Decimation.Lib.Util +{ + public static class ProjectileUtils + { + public static bool BehindTiles(this Projectile projectile) + { + return Main.tile[(int) projectile.position.X, (int) projectile.position.Y].type == -1; // TODO ? + } + } +} \ No newline at end of file