Răsfoiți Sursa

AI Task start if isInActiveRegion, improve server performance over time

Maneco2 2 ani în urmă
părinte
comite
c5a8ef81e3

+ 1 - 1
src/main/java/com/l2jserver/gameserver/ai/L2AttackableAI.java

@@ -286,7 +286,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable {
 	
 	public void startAITask() {
 		// If not idle - create an AI task (schedule onEvtThink repeatedly)
-		if (_aiTask == null) {
+		if ((_aiTask == null) && (_actor.isInActiveRegion())) {
 			_aiTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(this, 1000, 1000);
 		}
 	}

+ 1 - 1
src/main/java/com/l2jserver/gameserver/ai/L2FortSiegeGuardAI.java

@@ -210,7 +210,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable {
 		super.changeIntention(intention, arg0, arg1);
 		
 		// If not idle - create an AI task (schedule onEvtThink repeatedly)
-		if (_aiTask == null) {
+		if ((_aiTask == null) && (_actor.isInActiveRegion())) {
 			_aiTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(this, 1000, 1000);
 		}
 	}

+ 1 - 1
src/main/java/com/l2jserver/gameserver/ai/L2SiegeGuardAI.java

@@ -203,7 +203,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable {
 		super.changeIntention(intention, arg0, arg1);
 		
 		// If not idle - create an AI task (schedule onEvtThink repeatedly)
-		if (_aiTask == null) {
+		if ((_aiTask == null) && (_actor.isInActiveRegion())) {
 			_aiTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(this, 1000, 1000);
 		}
 	}