From 9aff208403e43351e50228a1d5ea13ff508cdff1 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 2 Sep 2023 19:43:40 -0500 Subject: [PATCH] guard captains to move tot heir first patrol point right away --- src/engine/gameManager/NPCManager.java | 2 +- src/engine/objects/Mob.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/engine/gameManager/NPCManager.java b/src/engine/gameManager/NPCManager.java index 65719d21..bce31627 100644 --- a/src/engine/gameManager/NPCManager.java +++ b/src/engine/gameManager/NPCManager.java @@ -341,7 +341,7 @@ public enum NPCManager { mob.patrolPoints.add(newPatrolPoint); if (i == 1) { - mob.loc = newPatrolPoint; + mob.setLoc(newPatrolPoint); mob.endLoc = newPatrolPoint; } } diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 31ca46ce..38bfa974 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -20,6 +20,7 @@ import engine.jobs.DeferredPowerJob; import engine.jobs.UpgradeNPCJob; import engine.math.Bounds; import engine.math.Vector3fImmutable; +import engine.mobileAI.utilities.MovementUtilities; import engine.net.ByteBufferWriter; import engine.net.Dispatch; import engine.net.DispatchMessage; @@ -427,6 +428,7 @@ public class Mob extends AbstractIntelligenceAgent { else mobile.contractUUID = contract.getContractID(); + return mobile; } @@ -1678,6 +1680,16 @@ public class Mob extends AbstractIntelligenceAgent { if (this.agentType.equals(AIAgentType.MOBILE)) NPCManager.AssignPatrolPoints(this); + if (this.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) { + + Building barracks = this.building; + + if (barracks != null && barracks.patrolPoints != null && !barracks.getPatrolPoints().isEmpty()) { + this.patrolPoints = barracks.patrolPoints; + MovementUtilities.aiMove(this, this.patrolPoints.get(0), true); + } + } + this.deathTime = 0; }