wulfrum rovers now have a tiny jump
This commit is contained in:
1 parent
d51beb131c
commit
462fa9fe25
1 file changed
+20
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user