Do not command select logic controlled units by default

This commit is contained in:
Anuken
2025-05-01 10:27:47 -04:00
parent 5615182bc5
commit 1a07efd80b
5 changed files with 11 additions and 11 deletions

View File

@@ -299,7 +299,7 @@ public class DesktopInput extends InputHandler{
selectedUnits.set(selectedCommandUnits(Tmp.r1.x, Tmp.r1.y, Tmp.r1.width, Tmp.r1.height));
}else {
for(var unit : player.team().data().units){
if(unit.allowCommand()){
if(unit.isCommandable()){
selectedUnits.add(unit);
}
}
@@ -315,7 +315,7 @@ public class DesktopInput extends InputHandler{
selectedUnits.set(selectedCommandUnits(Tmp.r1.x, Tmp.r1.y, Tmp.r1.width, Tmp.r1.height, u -> u instanceof Payloadc));
}else {
for(var unit : player.team().data().units){
if(unit.allowCommand() && unit instanceof Payloadc){
if(unit.isCommandable() && unit instanceof Payloadc){
selectedUnits.add(unit);
}
}

View File

@@ -265,7 +265,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
Unit unit = Groups.unit.getByID(id);
if(unit != null && unit.team == player.team()){
if(unit.controller() instanceof LogicAI){
//Units with logic AI can still be controlled, but there currently aren't any mechanisms to do so on the client end unless the processor "steals" units that are already selected (control issue)
if(unit.controller() instanceof LogicAI ai && !(ai.controller != null && ai.controller.block.privileged)){
//reset to commandAI if applicable
unit.resetController();
}
@@ -1114,7 +1115,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
if(commandMode){
//happens sometimes
selectedUnits.removeAll(u -> !u.allowCommand());
selectedUnits.removeAll(u -> !u.isCommandable());
//draw command overlay UI
for(Unit unit : selectedUnits){
@@ -1943,7 +1944,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
tmpUnits.clear();
float rad = 4f;
tree.intersect(x - rad/2f, y - rad/2f, rad, rad, tmpUnits);
return tmpUnits.min(u -> u.allowCommand(), u -> u.dst(x, y) - u.hitSize/2f);
return tmpUnits.min(u -> u.isCommandable(), u -> u.dst(x, y) - u.hitSize/2f);
}
public @Nullable Unit selectedEnemyUnit(float x, float y){
@@ -1965,7 +1966,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
tmpUnits.clear();
float rad = 4f;
tree.intersect(Tmp.r1.set(x - rad/2f, y - rad/2f, rad*2f + w, rad*2f + h).normalize(), tmpUnits);
tmpUnits.removeAll(u -> !u.allowCommand() || !predicate.get(u));
tmpUnits.removeAll(u -> !u.isCommandable() || !predicate.get(u));
return tmpUnits;
}