From 462fa9fe259ebe4de323fa6025f0160c5ec40460 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Thu, 6 Jan 2022 23:09:10 -0500 Subject: [PATCH] wulfrum rovers now have a tiny jump --- NPCs/NormalNPCs/WulfrumRover.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/NPCs/NormalNPCs/WulfrumRover.cs b/NPCs/NormalNPCs/WulfrumRover.cs index 1bfa46ce8a..4c2124e656 100644 --- a/NPCs/NormalNPCs/WulfrumRover.cs +++ b/NPCs/NormalNPCs/WulfrumRover.cs @@ -12,6 +12,12 @@ namespace CalamityMod.NPCs.NormalNPCs { public class WulfrumRover : ModNPC { + public float TimeSpentStuck + { + get => npc.ai[0]; + set => npc.ai[0] = value; + } + public float SuperchargeTimer { get => npc.ai[3]; @@ -22,6 +28,7 @@ namespace CalamityMod.NPCs.NormalNPCs public const float PlayerSearchDistance = 500f; public const float StuckJumpPromptTime = 90f; public const float MaxMovementSpeedX = 6f; + public const float JumpSpeed = -4f; public bool Supercharged => SuperchargeTimer > 0; public override void SetStaticDefaults() @@ -91,6 +98,19 @@ namespace CalamityMod.NPCs.NormalNPCs npc.netUpdate = true; } + if (npc.oldPosition == npc.position) + { + TimeSpentStuck++; + if (Main.netMode != NetmodeID.MultiplayerClient && TimeSpentStuck > StuckJumpPromptTime) + { + npc.velocity.Y = JumpSpeed; + TimeSpentStuck = 0f; + npc.netUpdate = true; + } + } + else + TimeSpentStuck = 0f; + npc.spriteDirection = -npc.direction; npc.velocity.X = MathHelper.Lerp(npc.velocity.X, MaxMovementSpeedX * npc.direction, 0.0125f); }