diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index a2511d5d..6b2e6f96 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -41,6 +41,9 @@ import static java.lang.Math.toIntExact; public class Mob extends AbstractIntelligenceAgent implements Delayed { private static int staticID = 0; + + // Optional env var (seconds) to shorten guard/siege minion spawns for testing; not in the ConfigManager enum, which requires every entry. + private static final String MINION_SPAWN_TIME_FLAG = "MB_MINION_SPAWN_TIME"; //mob specific public final ConcurrentHashMap playerAgroMap = new ConcurrentHashMap<>(); //key = Player value = hate value @@ -436,6 +439,23 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { return mobile; } + private static int minionSpawnDelay(int defaultDelay) { + + String overrideValue; + + overrideValue = ConfigManager.configMap.get(MINION_SPAWN_TIME_FLAG); + + if (overrideValue == null || overrideValue.isEmpty()) + return defaultDelay; + + try { + return Integer.parseInt(overrideValue.trim()); + } catch (NumberFormatException e) { + Logger.warn(MINION_SPAWN_TIME_FLAG + " is not a number: " + overrideValue); + return defaultDelay; + } + } + public static synchronized Mob createGuardMinion(Mob guardCaptain, short level, String minionName) { Mob minionMobile; @@ -455,7 +475,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { minionMobile.deathTime = System.currentTimeMillis(); minionMobile.guardCaptain = guardCaptain; - minionMobile.spawnDelay = (int) (-2.500 * guardCaptain.building.getRank() + 22.5) * 60; + minionMobile.spawnDelay = minionSpawnDelay((int) (-2.500 * guardCaptain.building.getRank() + 22.5) * 60); minionMobile.behaviourType = mbEnums.MobBehaviourType.GuardMinion; minionMobile.agentType = AIAgentType.GUARDMINION; minionMobile.guardedCity = guardCaptain.guardedCity; @@ -514,7 +534,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { siegeMinion.behaviourType = MobBehaviourType.SiegeEngine; siegeMinion.agentType = AIAgentType.SIEGEENGINE; siegeMinion.bindLoc = Vector3fImmutable.ZERO; - siegeMinion.spawnDelay = (60 * 15); + siegeMinion.spawnDelay = minionSpawnDelay(60 * 15); siegeMinion.runAfterLoad();