From e52a340f13fdab2bf2460b22207ce5319172a7e1 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 8 Jul 2022 22:43:57 -0400 Subject: [PATCH] REIMPLEMENTED commit d34eef95a4ead14963fdfd7bf79212e1c621f4b3 --- Items/Accessories/WulfrumAcrobaticsPack.cs | 18 +++++++++++++++--- Items/Fishing/FishingRods/WulfrumRod.cs | 2 +- Items/Tools/WulfrumDiggingTurtle.cs | 7 ++++++- Items/Tools/WulfrumDrill.cs | 4 ++-- Projectiles/Typeless/WulfrumHook.cs | 9 +++++++++ Tiles/WulfrumPipes.cs | 2 +- 6 files changed, 34 insertions(+), 8 deletions(-) diff --git a/Items/Accessories/WulfrumAcrobaticsPack.cs b/Items/Accessories/WulfrumAcrobaticsPack.cs index 5acdda656a..0ed24584e8 100644 --- a/Items/Accessories/WulfrumAcrobaticsPack.cs +++ b/Items/Accessories/WulfrumAcrobaticsPack.cs @@ -209,7 +209,15 @@ namespace CalamityMod.Items.Accessories hookCache = -1; if (Grappled) - SimulateMovement(Main.projectile[Grapple]); + { + if ((Main.projectile[Grapple].Center - Player.Center).Length() > SwingLenght + 80f) + { + SoundEngine.PlaySound(WulfrumAcrobaticsPack.ReleaseSound, Main.projectile[Grapple].Center); + Main.projectile[Grapple].Kill(); + } + else + SimulateMovement(Main.projectile[Grapple]); + } } public void SimulateMovement(Projectile grapple) @@ -309,11 +317,11 @@ namespace CalamityMod.Items.Accessories if (collisionVector.Y < Player.velocity.Y) { imminentDanger = true; - checkedPlayerPosition += Player.velocity; + checkedPlayerPosition += collisionVector; break; } - checkedPlayerPosition += Player.velocity; + checkedPlayerPosition += collisionVector; } if (!imminentDanger) @@ -365,6 +373,10 @@ namespace CalamityMod.Items.Accessories } } + //Reset the players fall height, because if they take fall dmg in teh frame right after this one it may have a chance of still killing the player due to the + //code where the grapple resets the players fall speed hasnt been called yet + Player.fallStart = (int)(Player.position.Y / 16); + if (Player.whoAmI == Main.myPlayer) { Projectile.NewProjectile(Player.GetSource_ItemUse(PackItem), bestGrapplePos.ToWorldCoordinates(), Vector2.Zero, ProjectileType(), 3, 0, Player.whoAmI); diff --git a/Items/Fishing/FishingRods/WulfrumRod.cs b/Items/Fishing/FishingRods/WulfrumRod.cs index e0fce5c5a9..159dc4111b 100644 --- a/Items/Fishing/FishingRods/WulfrumRod.cs +++ b/Items/Fishing/FishingRods/WulfrumRod.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Fishing.FishingRods { SacrificeTotal = 1; DisplayName.SetDefault("Wulfrum Fishing Pole"); - Tooltip.SetDefault("This barely works, but it's better than nothing."); + Tooltip.SetDefault("This barely works, but it's better than nothing"); } public override void SetDefaults() diff --git a/Items/Tools/WulfrumDiggingTurtle.cs b/Items/Tools/WulfrumDiggingTurtle.cs index 111af79ad7..46bfb38ed5 100644 --- a/Items/Tools/WulfrumDiggingTurtle.cs +++ b/Items/Tools/WulfrumDiggingTurtle.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Tools { DisplayName.SetDefault("Wulfrum Digging Turtle"); Tooltip.SetDefault("Throws a rickety mining contraption to dig out a small tunnel\n" + - "In case of an emergency, right click to instantly detonate all your digging turtles."); + "In case of an emergency, right click to instantly detonate all your digging turtles"); SacrificeTotal = 10; } @@ -38,6 +38,11 @@ namespace CalamityMod.Items.Tools public override bool AltFunctionUse(Player player) => true; + public override bool ConsumeItem(Player player) + { + return player.altFunctionUse != 2; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { // Play a sound and detonate all owned turtles. diff --git a/Items/Tools/WulfrumDrill.cs b/Items/Tools/WulfrumDrill.cs index 24a77e24a3..c9a662177b 100644 --- a/Items/Tools/WulfrumDrill.cs +++ b/Items/Tools/WulfrumDrill.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Tools public override void SetStaticDefaults() { SacrificeTotal = 1; - DisplayName.SetDefault("Wulfrum Pickaxe"); + DisplayName.SetDefault("Wulfrum Drill"); } public override void SetDefaults() @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Tools Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item23; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); /// + Item.shoot = ModContent.ProjectileType(); Item.channel = true; Item.noMelee = true; diff --git a/Projectiles/Typeless/WulfrumHook.cs b/Projectiles/Typeless/WulfrumHook.cs index cd0d7ac34d..be860d851f 100644 --- a/Projectiles/Typeless/WulfrumHook.cs +++ b/Projectiles/Typeless/WulfrumHook.cs @@ -67,6 +67,8 @@ namespace CalamityMod.Projectiles.Typeless Lighting.AddLight(Projectile.Center, Color.DeepSkyBlue.ToVector3()); Vector2 BetweenOwner = Owner.Center - Projectile.Center; + Main.instance.MouseText(Owner.Center.ToString()); + if (Owner.dead || Owner.stoned || Owner.webbed || Owner.frozen || BetweenOwner.Length() > 1500) { Projectile.Kill(); @@ -114,6 +116,13 @@ namespace CalamityMod.Projectiles.Typeless else { + float lenghtToOwner = BetweenOwner.Length(); + + if (lenghtToOwner > Owner.GetModPlayer().SwingLenght + 60f) + { + State = HookState.Retracting; + } + Point tilePos = Projectile.Center.ToTileCoordinates(); Tile tile = Main.tile[tilePos]; if (!tile.HasUnactuatedTile || !tile.CanTileBeLatchedOnTo() || Owner.IsBlacklistedForGrappling(tilePos)) diff --git a/Tiles/WulfrumPipes.cs b/Tiles/WulfrumPipes.cs index 04c4a9f8c5..1c7b8f45ed 100644 --- a/Tiles/WulfrumPipes.cs +++ b/Tiles/WulfrumPipes.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Tiles public override void NumDust(int i, int j, bool fail, ref int num) { - num = Main.rand.NextBool(3) ? 0 : 1; + num = Main.rand.NextBool(3) ? 3 : Main.rand.NextBool(3) ? 1 : 2; } public override void PlaceInWorld(int i, int j, Item item)