Files
Server/src/engine/mobileAI/Threads/MobAIThread.java
T

47 lines
1.3 KiB
Java
Raw Normal View History

2023-08-01 20:13:23 -05:00
package engine.mobileAI.Threads;
import engine.mobileAI.MobAI;
import engine.gameManager.ZoneManager;
import engine.objects.Mob;
import engine.objects.Zone;
import org.pmw.tinylog.Logger;
public class MobAIThread implements Runnable{
public static int AI_BASE_AGGRO_RANGE = 60;
public static int AI_DROP_AGGRO_RANGE = 60;
public static int AI_PULSE_MOB_THRESHOLD = 200;
public static int AI_PATROL_DIVISOR = 15;
2023-08-06 19:44:20 -05:00
public static int AI_POWER_DIVISOR = 20;
2023-08-01 20:13:23 -05:00
// Thread constructor
public MobAIThread() {
Logger.info(" MobAIThread thread has started!");
}
@Override
public void run() {
while (true) {
for (Zone zone : ZoneManager.getAllZones()) {
for (Mob mob : zone.zoneMobSet) {
try {
if (mob != null)
MobAI.DetermineAction(mob);
} catch (Exception e) {
Logger.error("Mob: " + mob.getName() + " UUID: " + mob.getObjectUUID() + " ERROR: " + e);
e.printStackTrace();
}
}
}
}
}
public static void startAIThread() {
Thread aiThread;
aiThread = new Thread(new MobAIThread());
aiThread.setName("aiThread");
aiThread.start();
}
}