diff --git a/core/src/mindustry/ai/types/CommandAI.java b/core/src/mindustry/ai/types/CommandAI.java index e4d95a7d25..ce0c4ed2b1 100644 --- a/core/src/mindustry/ai/types/CommandAI.java +++ b/core/src/mindustry/ai/types/CommandAI.java @@ -23,7 +23,7 @@ public class CommandAI extends AIController{ public Seq commandQueue = new Seq<>(5); public @Nullable Vec2 targetPos; - public @Nullable Building targetBuild; + public @Nullable Building targetBuild; public @Nullable Teamc attackTarget; /** Group of units that were all commanded to reach the same point. */ public @Nullable UnitGroup group; @@ -343,8 +343,7 @@ public class CommandAI extends AIController{ }else{ var result = controlPath.getPathPosition(unit, movePos, isSolidPayload ? movePos : targetPos); - if(!isSolidPayload) - unreachable = result.unreachable; + unreachable = result.unreachable; move &= result.move && (!blockingUnit || timeSpentBlocked > maxBlockTime); if(result.move) vecOut.set(result.dest); @@ -530,7 +529,7 @@ public class CommandAI extends AIController{ @Override public void hit(Bullet bullet){ - if(unit.team.isAI() && + if(unit.team.isAI() && //excluding bullets (!(bullet.owner instanceof Bullet) && bullet.owner instanceof Teamc teamc) && teamc.team() != unit.team && attackTarget == null && //can only counter-attack every few seconds to prevent rapidly changing targets diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 7dc587f7d5..f6b683f98e 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -114,8 +114,6 @@ public class Block extends UnlockableContent implements Senseable{ public boolean solidifes; /** if true, this counts as a non-solid block to this team. */ public boolean teamPassable; - /** if true, units will attempt to pathfind to this block even if its tile is normally impassable. */ - public boolean pathfindTarget = false; /** if true, this block cannot be hit by bullets unless explicitly targeted. */ public boolean underBullets; /** whether this is rotatable */ diff --git a/core/src/mindustry/world/blocks/payloads/PayloadBlock.java b/core/src/mindustry/world/blocks/payloads/PayloadBlock.java index c91ff926b8..1d5bf90f53 100644 --- a/core/src/mindustry/world/blocks/payloads/PayloadBlock.java +++ b/core/src/mindustry/world/blocks/payloads/PayloadBlock.java @@ -101,8 +101,10 @@ public class PayloadBlock extends Block{ @Override public boolean canControlSelect(Unit unit){ - return !unit.spawnedByCore && unit.type.allowedInPayloads && this.payload == null && acceptUnitPayload(unit) && - (unit.isGrounded() && !unit.type.allowLegStep && solid) ? unit.within(this, size * tilesize * 0.7f + unit.hitSize / 2f) : unit.tileOn() != null && unit.tileOn().build == this; + if(unit.spawnedByCore || !unit.type.allowedInPayloads || this.payload != null || !acceptUnitPayload(unit)) return false; + + //ground units can be accepted when they are near solid blocks + return (unit.isGrounded() && !unit.type.allowLegStep && solid) ? unit.within(this, size * tilesize * 0.7f + unit.hitSize / 2f) : unit.tileOn() != null && unit.tileOn().build == this; } @Override @@ -118,6 +120,7 @@ public class PayloadBlock extends Block{ return this.payload == null; } + @Override public void handlePayload(Building source, Payload payload, @Nullable Unit unit){ if(unit != null){ float clampPos = size * tilesize * 0.7f + unit.hitSize / 2f;