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

View File

@@ -2376,6 +2376,7 @@ public class UnitTypes{
controller = u -> u.team.isAI() ? aiController.get() : new CommandAI();
isEnemy = false;
targetBuildingsMobile = false;
lowAltitude = true;
flying = true;
mineSpeed = 6.5f;
@@ -2415,6 +2416,7 @@ public class UnitTypes{
controller = u -> u.team.isAI() ? aiController.get() : new CommandAI();
isEnemy = false;
targetBuildingsMobile = false;
flying = true;
mineSpeed = 7f;
mineTier = 1;
@@ -2457,6 +2459,7 @@ public class UnitTypes{
controller = u -> u.team.isAI() ? aiController.get() : new CommandAI();
isEnemy = false;
targetBuildingsMobile = false;
lowAltitude = true;
flying = true;
mineSpeed = 8f;

View File

@@ -1063,7 +1063,7 @@ public class MobileInput extends InputHandler implements GestureListener{
player.shooting = false;
if(Core.settings.getBool("autotarget") && !(player.unit() instanceof BlockUnitUnit u && u.tile() instanceof ControlBlock c && !c.shouldAutoTarget())){
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){

View File

@@ -38,10 +38,12 @@ public enum LAccess{
cameraY,
cameraWidth,
cameraHeight,
displayWidth,
displayHeight,
size,
solid,
dead,
range,
range,
shooting,
boosting,
mineX,

View File

@@ -163,6 +163,8 @@ public class UnitType extends UnlockableContent implements Senseable{
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 */
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*/
canBoost = false,
/** if true, this unit will always boost when using builder AI */

View File

@@ -71,7 +71,7 @@ public class LogicDisplay extends Block{
clipSize = Math.max(clipSize, scaleFactor * Draw.scl * displaySize);
}
public class LogicDisplayBuild extends Building{
public @Nullable FrameBuffer buffer;
public float color = Color.whiteFloatBits;
@@ -106,6 +106,14 @@ public class LogicDisplay extends Block{
Draw.blend();
}
@Override
public double sense(LAccess sensor){
return switch(sensor){
case displayWidth, displayHeight -> displaySize;
default -> super.sense(sensor);
};
}
public void flushCommands(LongSeq graphicsBuffer){
int added = Math.min(graphicsBuffer.size, LExecutor.maxDisplayBuffer - commands.size);

View File

@@ -11,6 +11,7 @@ import arc.util.*;
import mindustry.*;
import mindustry.annotations.Annotations.*;
import mindustry.graphics.*;
import mindustry.logic.*;
import mindustry.world.*;
import static mindustry.Vars.*;
@@ -144,6 +145,15 @@ public class TileableLogicDisplay extends LogicDisplay{
public int bits = 0;
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
public void display(Table table){
super.display(table);