Better logic integration with commands
This commit is contained in:
@@ -19,7 +19,7 @@ import static mindustry.Vars.*;
|
||||
|
||||
/** Stores global constants for logic processors. */
|
||||
public class GlobalConstants{
|
||||
public static final int ctrlProcessor = 1, ctrlPlayer = 2;
|
||||
public static final int ctrlProcessor = 1, ctrlPlayer = 2, ctrlCommand = 3;
|
||||
public static final ContentType[] lookableContent = {ContentType.block, ContentType.unit, ContentType.item, ContentType.liquid};
|
||||
/** Global random state. */
|
||||
public static final Rand rand = new Rand();
|
||||
@@ -51,6 +51,7 @@ public class GlobalConstants{
|
||||
|
||||
put("@ctrlProcessor", ctrlProcessor);
|
||||
put("@ctrlPlayer", ctrlPlayer);
|
||||
put("@ctrlCommand", ctrlCommand);
|
||||
|
||||
//store base content
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ public class LExecutor{
|
||||
/** Checks is a unit is valid for logic AI control, and returns the controller. */
|
||||
@Nullable
|
||||
public static LogicAI checkLogicAI(LExecutor exec, Object unitObj){
|
||||
if(unitObj instanceof Unit unit && unit.isValid() && exec.obj(varUnit) == unit && unit.team == exec.team && !unit.isPlayer()){
|
||||
if(unitObj instanceof Unit unit && unit.isValid() && exec.obj(varUnit) == unit && unit.team == exec.team && !unit.isPlayer() && !(unit.isCommandable() && unit.command().hasCommand())){
|
||||
if(unit.controller() instanceof LogicAI la){
|
||||
la.controller = exec.building(varThis);
|
||||
return la;
|
||||
|
||||
Reference in New Issue
Block a user