Esempio n. 1
0
 public static void fight(AIDelegate aiDelegate, CachedUnit unit, AIFloat3 pos, boolean queue) {
   AICommand command =
       new FightUnitAICommand(
           unit.getUnitId(), -1, queue ? queueOption : 0, commandTimeout.getValue(), pos);
   try {
     handleCommand(aiDelegate, command);
   } catch (Exception e) {
     System.err.println(unit.getDef().getHumanName() + "::" + FormatUtil.formatAIFloat3(pos));
   }
 }
Esempio n. 2
0
 public static void guard(
     AIDelegate aiDelegate, CachedUnit unit, CachedUnit guard, boolean queue) {
   AICommand command =
       new GuardUnitAICommand(
           unit.getUnitId(),
           -1,
           queue ? queueOption : 0,
           commandTimeout.getValue(),
           guard.getUnitId());
   handleCommand(aiDelegate, command);
 }
Esempio n. 3
0
 public static void reclaim(
     AIDelegate aiDelegate, CachedUnit unit, CachedUnit reclaim, boolean queue) {
   AICommand command =
       new ReclaimUnitAICommand(
           unit.getUnitId(),
           -1,
           queue ? queueOption : 0,
           commandTimeout.getValue(),
           reclaim.getUnitId());
   handleCommand(aiDelegate, command);
 }
Esempio n. 4
0
 public static void factoryBuild(AIDelegate aiDelegate, String name, CachedUnit factory) {
   CachedUnitDef def = GlobalDelegate.getUnitDef(name, factory.getFaction());
   AICommand command =
       new BuildUnitAICommand(
           factory.getUnitId(),
           -1,
           0,
           commandTimeout.getValue(),
           def.getUnitDefId(),
           new AIFloat3(),
           0);
   handleCommand(aiDelegate, command);
 }
Esempio n. 5
0
 public static void attack(
     AIDelegate aiDelegate, CachedUnit unit, CachedUnit attackUnit, boolean queue) {
   AICommand command =
       new AttackUnitAICommand(
           unit.getUnitId(),
           -1,
           queue ? queueOption : 0,
           commandTimeout.getValue(),
           attackUnit.getUnitId());
   try {
     handleCommand(aiDelegate, command);
   } catch (Exception e) {
     System.err.println(unit.getDef().getHumanName() + ", " + attackUnit.getUnitId());
   }
 }
Esempio n. 6
0
 public static void buildUnit(
     AIDelegate aiDelegate, CachedUnit builder, CachedUnitDef def, AIFloat3 pos, int facing) {
   AICommand command =
       new BuildUnitAICommand(
           builder.getUnitId(), -1, 0, commandTimeout.getValue(), def.getUnitDefId(), pos, facing);
   handleCommand(aiDelegate, command);
 }
Esempio n. 7
0
 public static void reclaimArea(
     AIDelegate aiDelegate, CachedUnit unit, AIFloat3 pos, float radius, boolean queue) {
   AICommand command =
       new ReclaimAreaUnitAICommand(
           unit.getUnitId(), -1, queue ? queueOption : 0, commandTimeout.getValue(), pos, radius);
   handleCommand(aiDelegate, command);
 }
Esempio n. 8
0
 public static int getMapCenterFacing(AIDelegate aiDelegate, CachedUnit unit) {
   double direction = BuilderUtil.getMapCenterDirection(unit.getPos());
   //        System.err.println("direction: " + direction);
   if (direction >= 45 && direction < 135) {
     return FACING_SOUTH;
   }
   if (direction >= 135 && direction < 225) {
     return FACING_WEST;
   }
   if (direction >= 225 && direction < 315) {
     return FACING_NORTH;
   }
   return FACING_EAST;
 }
Esempio n. 9
0
 public static void stop(AIDelegate aiDelegate, CachedUnit unit) {
   AICommand command = new StopUnitAICommand(unit.getUnitId(), -1, 0, commandTimeout.getValue());
   handleCommand(aiDelegate, command);
 }
Esempio n. 10
0
 public static void patrol(AIDelegate aiDelegate, CachedUnit unit, AIFloat3 pos, boolean queue) {
   AICommand command =
       new PatrolUnitAICommand(
           unit.getUnitId(), -1, queue ? queueOption : 0, commandTimeout.getValue(), pos);
   handleCommand(aiDelegate, command);
 }
Esempio n. 11
0
 public static void setOnOff(AIDelegate aiDelegate, CachedUnit unit, boolean on) {
   AICommand command =
       new SetOnOffUnitAICommand(unit.getUnitId(), -1, 0, commandTimeout.getValue(), on);
   handleCommand(aiDelegate, command);
 }
Esempio n. 12
0
 public static void setMoveState(AIDelegate aiDelegate, CachedUnit unit, int moveState) {
   AICommand command =
       new SetMoveStateUnitAICommand(
           unit.getUnitId(), -1, 0, commandTimeout.getValue(), moveState);
   handleCommand(aiDelegate, command);
 }