Skip siege guard tasks when working.
This commit is contained in:
		| @@ -68,6 +68,7 @@ public class SiegeGuards extends AbstractNpcAI | ||||
| 	}; | ||||
| 	//@formatter:on | ||||
| 	private static final Map<Integer, List<Npc>> RESIDENCE_GUARD_MAP = new HashMap<>(); | ||||
| 	private static final Map<Integer, Boolean> RESIDENCE_WORKING = new HashMap<>(); | ||||
| 	 | ||||
| 	public SiegeGuards() | ||||
| 	{ | ||||
| @@ -83,6 +84,7 @@ public class SiegeGuards extends AbstractNpcAI | ||||
| 		 | ||||
| 		// Start task for unknown residences. | ||||
| 		RESIDENCE_GUARD_MAP.put(0, new CopyOnWriteArrayList<>()); | ||||
| 		RESIDENCE_WORKING.put(0, false); | ||||
| 		ThreadPool.scheduleAtFixedRate(new AggroCheckTask(0), 0, 3000); | ||||
| 		 | ||||
| 		// Start tasks for castles. | ||||
| @@ -90,6 +92,7 @@ public class SiegeGuards extends AbstractNpcAI | ||||
| 		{ | ||||
| 			final int residenceId = castle.getResidenceId(); | ||||
| 			RESIDENCE_GUARD_MAP.put(residenceId, new CopyOnWriteArrayList<>()); | ||||
| 			RESIDENCE_WORKING.put(residenceId, false); | ||||
| 			ThreadPool.scheduleAtFixedRate(new AggroCheckTask(residenceId), residenceId * 100, 3000); | ||||
| 		} | ||||
| 	} | ||||
| @@ -106,6 +109,12 @@ public class SiegeGuards extends AbstractNpcAI | ||||
| 		@Override | ||||
| 		public void run() | ||||
| 		{ | ||||
| 			if (RESIDENCE_WORKING.get(_residenceId)) | ||||
| 			{ | ||||
| 				return; | ||||
| 			} | ||||
| 			RESIDENCE_WORKING.put(_residenceId, true); | ||||
| 			 | ||||
| 			final List<Npc> guards = RESIDENCE_GUARD_MAP.get(_residenceId); | ||||
| 			for (Npc guard : guards) | ||||
| 			{ | ||||
| @@ -149,6 +158,8 @@ public class SiegeGuards extends AbstractNpcAI | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 			 | ||||
| 			RESIDENCE_WORKING.put(_residenceId, false); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment