Add optional MB_MINION_SPAWN_TIME override for guard and siege minion spawns

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MagicBotandClaude Opus 5.5 committed 2026-10-18 07:41:16 -04:00
1 parent 5c78bc7fa5
commit becab380d2
1 file changed
+22 -2
+22 -2
View File
@@ -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<Integer, Float> 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();