public Option getMetaOption(Option defaultOption) { if (!metaOptions.containsKey(defaultOption.getName())) { setMetaOption(defaultOption); return defaultOption; } return getMetaOption(defaultOption.getName()); }
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); }
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); }
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)); } }
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); }
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); }
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); }
public void setMetaOption(Option option) { if (metaOptions.containsKey(option.getName())) { Option currentOption = metaOptions.get(option.getName()); currentOption.setValue(option.getValue()); } else { metaOptions.put(option.getName(), option); } }
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()); } }
public static void stop(AIDelegate aiDelegate, CachedUnit unit) { AICommand command = new StopUnitAICommand(unit.getUnitId(), -1, 0, commandTimeout.getValue()); handleCommand(aiDelegate, command); }
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); }
public static void setOnOff(AIDelegate aiDelegate, CachedUnit unit, boolean on) { AICommand command = new SetOnOffUnitAICommand(unit.getUnitId(), -1, 0, commandTimeout.getValue(), on); handleCommand(aiDelegate, command); }
public static void setMoveState(AIDelegate aiDelegate, CachedUnit unit, int moveState) { AICommand command = new SetMoveStateUnitAICommand( unit.getUnitId(), -1, 0, commandTimeout.getValue(), moveState); handleCommand(aiDelegate, command); }