Commandable blocks
This commit is contained in:
@@ -545,6 +545,16 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
|
||||
}
|
||||
|
||||
/** Called when this building receives a position command. Requires a commandable block. */
|
||||
public void onCommand(Vec2 target){
|
||||
|
||||
}
|
||||
|
||||
/** @return the position that this block points to for commands, or null. */
|
||||
public @Nullable Vec2 getCommandPosition(){
|
||||
return null;
|
||||
}
|
||||
|
||||
public void handleUnitPayload(Unit unit, Cons<Payload> grabber){
|
||||
Fx.spawn.at(unit);
|
||||
|
||||
|
||||
@@ -281,6 +281,14 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
return controller instanceof CommandAI;
|
||||
}
|
||||
|
||||
public CommandAI command(){
|
||||
if(controller instanceof CommandAI ai){
|
||||
return ai;
|
||||
}else{
|
||||
throw new IllegalArgumentException("Unit cannot be commanded - check isCommandable() first.");
|
||||
}
|
||||
}
|
||||
|
||||
public int count(){
|
||||
return team.data().countType(type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user