Closes Anuken/Mindustry-Suggestions/issues/5537, partially implements Anuken/Mindustry-Suggestions/issues/5535

This commit is contained in:
Anuken
2025-04-17 16:28:56 -04:00
parent 233acfa6f5
commit 264d13f827
6 changed files with 28 additions and 3 deletions
@@ -2376,6 +2376,7 @@ public class UnitTypes{
controller = u -> u.team.isAI() ? aiController.get() : new CommandAI(); controller = u -> u.team.isAI() ? aiController.get() : new CommandAI();
isEnemy = false; isEnemy = false;
targetBuildingsMobile = false;
lowAltitude = true; lowAltitude = true;
flying = true; flying = true;
mineSpeed = 6.5f; mineSpeed = 6.5f;
@@ -2415,6 +2416,7 @@ public class UnitTypes{
controller = u -> u.team.isAI() ? aiController.get() : new CommandAI(); controller = u -> u.team.isAI() ? aiController.get() : new CommandAI();
isEnemy = false; isEnemy = false;
targetBuildingsMobile = false;
flying = true; flying = true;
mineSpeed = 7f; mineSpeed = 7f;
mineTier = 1; mineTier = 1;
@@ -2457,6 +2459,7 @@ public class UnitTypes{
controller = u -> u.team.isAI() ? aiController.get() : new CommandAI(); controller = u -> u.team.isAI() ? aiController.get() : new CommandAI();
isEnemy = false; isEnemy = false;
targetBuildingsMobile = false;
lowAltitude = true; lowAltitude = true;
flying = true; flying = true;
mineSpeed = 8f; mineSpeed = 8f;
+1 -1
View File
@@ -1063,7 +1063,7 @@ public class MobileInput extends InputHandler implements GestureListener{
player.shooting = false; player.shooting = false;
if(Core.settings.getBool("autotarget") && !(player.unit() instanceof BlockUnitUnit u && u.tile() instanceof ControlBlock c && !c.shouldAutoTarget())){ if(Core.settings.getBool("autotarget") && !(player.unit() instanceof BlockUnitUnit u && u.tile() instanceof ControlBlock c && !c.shouldAutoTarget())){
if(unit.type.canAttack){ if(unit.type.canAttack){
target = Units.closestTarget(unit.team, unit.x, unit.y, range, u -> u.checkTarget(type.targetAir, type.targetGround), u -> type.targetGround); target = Units.closestTarget(unit.team, unit.x, unit.y, range, u -> u.checkTarget(type.targetAir, type.targetGround), u -> type.targetGround && !type.targetBuildingsMobile);
} }
if(allowHealing && target == null){ if(allowHealing && target == null){
+3 -1
View File
@@ -38,10 +38,12 @@ public enum LAccess{
cameraY, cameraY,
cameraWidth, cameraWidth,
cameraHeight, cameraHeight,
displayWidth,
displayHeight,
size, size,
solid, solid,
dead, dead,
range, range,
shooting, shooting,
boosting, boosting,
mineX, mineX,
+2
View File
@@ -163,6 +163,8 @@ public class UnitType extends UnlockableContent implements Senseable{
circleTarget = false, circleTarget = false,
/** AI flag: if true, this unit will drop bombs under itself even when it is not next to its 'real' target. used for carpet bombers */ /** AI flag: if true, this unit will drop bombs under itself even when it is not next to its 'real' target. used for carpet bombers */
autoDropBombs = false, autoDropBombs = false,
/** For the mobile version only: If false, this unit will not auto-target buildings to attach when a player controls it. */
targetBuildingsMobile = true,
/** if true, this unit can boost into the air if a player/processors controls it*/ /** if true, this unit can boost into the air if a player/processors controls it*/
canBoost = false, canBoost = false,
/** if true, this unit will always boost when using builder AI */ /** if true, this unit will always boost when using builder AI */
@@ -71,7 +71,7 @@ public class LogicDisplay extends Block{
clipSize = Math.max(clipSize, scaleFactor * Draw.scl * displaySize); clipSize = Math.max(clipSize, scaleFactor * Draw.scl * displaySize);
} }
public class LogicDisplayBuild extends Building{ public class LogicDisplayBuild extends Building{
public @Nullable FrameBuffer buffer; public @Nullable FrameBuffer buffer;
public float color = Color.whiteFloatBits; public float color = Color.whiteFloatBits;
@@ -106,6 +106,14 @@ public class LogicDisplay extends Block{
Draw.blend(); Draw.blend();
} }
@Override
public double sense(LAccess sensor){
return switch(sensor){
case displayWidth, displayHeight -> displaySize;
default -> super.sense(sensor);
};
}
public void flushCommands(LongSeq graphicsBuffer){ public void flushCommands(LongSeq graphicsBuffer){
int added = Math.min(graphicsBuffer.size, LExecutor.maxDisplayBuffer - commands.size); int added = Math.min(graphicsBuffer.size, LExecutor.maxDisplayBuffer - commands.size);
@@ -11,6 +11,7 @@ import arc.util.*;
import mindustry.*; import mindustry.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.logic.*;
import mindustry.world.*; import mindustry.world.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
@@ -144,6 +145,15 @@ public class TileableLogicDisplay extends LogicDisplay{
public int bits = 0; public int bits = 0;
public boolean needsUpdate = false; public boolean needsUpdate = false;
@Override
public double sense(LAccess sensor){
return switch(sensor){
case displayWidth -> tilesWidth * 32f;
case displayHeight -> tilesHeight * 32f;
default -> super.sense(sensor);
};
}
@Override @Override
public void display(Table table){ public void display(Table table){
super.display(table); super.display(table);