Ai Players
This commit is contained in:
@@ -60,9 +60,11 @@ public class AiPlayer {
|
||||
}
|
||||
|
||||
public void runAfterLoad(){
|
||||
WorldGrid.addObject(this.emulated,this.emulated.bindLoc.x,this.emulated.bindLoc.z);
|
||||
City hamlet = AiPlayerManager.getRandomHamlet();
|
||||
this.emulated.teleport(Vector3fImmutable.getRandomPointOnCircle(hamlet.getTOL().loc,30));
|
||||
Vector3fImmutable binder = Vector3fImmutable.getRandomPointOnCircle(hamlet.getTOL().loc,30);
|
||||
this.emulated.bindLoc = binder;
|
||||
WorldGrid.addObject(this.emulated,binder.x,binder.z);
|
||||
this.emulated.setLoc(binder);
|
||||
WorldGrid.updateObject(this.emulated);
|
||||
this.emulated.removeEffectBySource(Enum.EffectSourceType.Invisibility,40,true);
|
||||
this.emulated.removeEffectBySource(Enum.EffectSourceType.Invulnerability,40,true);
|
||||
|
||||
@@ -36,9 +36,12 @@ public class AiPlayerManager {
|
||||
while(AiPlayers.size() < totalPlayers){
|
||||
try {
|
||||
AiPlayer aiPlayer = new AiPlayer();
|
||||
if (aiPlayer != null)
|
||||
if (aiPlayer.emulated != null)
|
||||
if (aiPlayer != null) {
|
||||
if (aiPlayer.emulated != null) {
|
||||
AiPlayers.add(aiPlayer);
|
||||
aiPlayer.runAfterLoad();
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
package engine.workthreads;
|
||||
|
||||
import engine.AiPlayers.AiPlayer;
|
||||
import engine.AiPlayers.AiPlayerManager;
|
||||
import engine.Enum;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.gameManager.SimulationManager;
|
||||
@@ -35,6 +37,11 @@ public class UpdateThread implements Runnable {
|
||||
player.update(true);
|
||||
}
|
||||
}
|
||||
for(AiPlayer player : AiPlayerManager.AiPlayers){
|
||||
if (player != null) {
|
||||
player.update();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error("UPDATE ERROR",e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user