Pathfind command
This commit is contained in:
@@ -27,6 +27,8 @@ public class LAssembler{
|
||||
putConst("@time", 0);
|
||||
//currently controlled unit
|
||||
putConst("@unit", null);
|
||||
//reference to self
|
||||
putConst("@this", null);
|
||||
|
||||
//add default constants
|
||||
putConst("false", 0);
|
||||
|
||||
@@ -27,7 +27,8 @@ public class LExecutor{
|
||||
public static final int
|
||||
varCounter = 0,
|
||||
varTime = 1,
|
||||
varUnit = 2;
|
||||
varUnit = 2,
|
||||
varThis = 3;
|
||||
|
||||
public static final int
|
||||
maxGraphicsBuffer = 256,
|
||||
@@ -215,6 +216,7 @@ public class LExecutor{
|
||||
if(unitObj instanceof Unit unit && exec.obj(varUnit) == unit && unit.team == exec.team && !unit.isPlayer() && !(unit.controller() instanceof FormationAI)){
|
||||
if(!(unit.controller() instanceof LogicAI)){
|
||||
unit.controller(new LogicAI());
|
||||
((LogicAI)unit.controller()).controller = exec.building(varThis);
|
||||
|
||||
//clear old state
|
||||
if(unit instanceof Minerc miner){
|
||||
@@ -250,6 +252,9 @@ public class LExecutor{
|
||||
ai.moveRad = exec.numf(p3);
|
||||
}
|
||||
}
|
||||
case pathfind -> {
|
||||
ai.control = type;
|
||||
}
|
||||
case target -> {
|
||||
ai.posTarget.set(exec.numf(p1), exec.numf(p2));
|
||||
ai.aimControl = type;
|
||||
|
||||
@@ -4,6 +4,7 @@ public enum LUnitControl{
|
||||
stop,
|
||||
move("x", "y"),
|
||||
approach("x", "y", "radius"),
|
||||
pathfind(),
|
||||
target("x", "y", "shoot"),
|
||||
targetp("unit", "shoot"),
|
||||
itemDrop("to", "amount"),
|
||||
|
||||
Reference in New Issue
Block a user