diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 3114282209..66fe68c31d 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -984,6 +984,7 @@ keybind.move_y.name = Move Y keybind.mouse_move.name = Follow Mouse keybind.pan.name = Pan View keybind.boost.name = Boost +keybind.command_mode.name = Command Mode keybind.schematic_select.name = Select Region keybind.schematic_menu.name = Schematic Menu keybind.schematic_flip_x.name = Flip Schematic X diff --git a/core/src/mindustry/Vars.java b/core/src/mindustry/Vars.java index ab0a498205..6bc9f96c32 100644 --- a/core/src/mindustry/Vars.java +++ b/core/src/mindustry/Vars.java @@ -86,7 +86,7 @@ public class Vars implements Loadable{ public static final float itemSize = 5f; /** units outside this bound will die instantly */ public static final float finalWorldBounds = 250; - /** range for building */ + /** default range for building */ public static final float buildingRange = 220f; /** range for moving items */ public static final float itemTransferRange = 220f; diff --git a/core/src/mindustry/ai/types/BuilderAI.java b/core/src/mindustry/ai/types/BuilderAI.java index d06812d267..e39765ba9a 100644 --- a/core/src/mindustry/ai/types/BuilderAI.java +++ b/core/src/mindustry/ai/types/BuilderAI.java @@ -100,7 +100,7 @@ public class BuilderAI extends AIController{ if(valid){ //move toward the plan - moveTo(req.tile(), buildingRange - 20f); + moveTo(req.tile(), unit.type.buildRange - 20f); }else{ //discard invalid plan unit.plans.removeFirst(); @@ -120,7 +120,7 @@ public class BuilderAI extends AIController{ Building build = world.build(plan.x, plan.y); if(build instanceof ConstructBuild cons){ - float dist = Math.min(cons.dst(unit) - buildingRange, 0); + float dist = Math.min(cons.dst(unit) - unit.type.buildRange, 0); //make sure you can reach the plan in time if(dist / unit.speed() < cons.buildCost * 0.9f){ diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 7175e0a909..1e3f1a6479 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -1467,7 +1467,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, } /** - * Called when another tile is tapped while this block is selected. + * Called when another tile is tapped while this building is selected. * @return whether this block should be deselected. */ public boolean onConfigureBuildTapped(Building other){ @@ -1483,7 +1483,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, } /** - * Called when a position is tapped when this building is selected. + * Called when a position is tapped while this building is selected. * * @return whether the tap event is consumed - if true, the player will not start shooting or interact with things under the cursor. * */ @@ -1492,7 +1492,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, } /** - * Called when this block's config menu is closed + * Called when this block's config menu is closed. */ public void onConfigureClosed(){} diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index 6c09c429b2..26fb16c473 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -175,7 +175,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I @Replace public float clipSize(){ if(isBuilding()){ - return state.rules.infiniteResources ? Float.MAX_VALUE : Math.max(type.clipSize, type.region.width) + buildingRange + tilesize*4f; + return state.rules.infiniteResources ? Float.MAX_VALUE : Math.max(type.clipSize, type.region.width) + type.buildRange + tilesize*4f; } if(mining()){ return type.clipSize + type.miningRange; diff --git a/core/src/mindustry/input/Binding.java b/core/src/mindustry/input/Binding.java index b9eab5048e..44d07adc46 100644 --- a/core/src/mindustry/input/Binding.java +++ b/core/src/mindustry/input/Binding.java @@ -12,7 +12,7 @@ public enum Binding implements KeyBind{ pan(KeyCode.mouseForward), boost(KeyCode.shiftLeft), - commandMode(KeyCode.shiftLeft), + command_mode(KeyCode.shiftLeft), control(KeyCode.controlLeft), respawn(KeyCode.v), select(KeyCode.mouseLeft), diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index 3721717b18..eb6be076c0 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -296,8 +296,8 @@ public class DesktopInput extends InputHandler{ if(!locked && block == null && !scene.hasField() && //disable command mode when player unit can boost and command mode binding is the same - !(!player.dead() && player.unit().type.canBoost && keybinds.get(Binding.commandMode).key == keybinds.get(Binding.boost).key)){ - commandMode = input.keyDown(Binding.commandMode); + !(!player.dead() && player.unit().type.canBoost && keybinds.get(Binding.command_mode).key == keybinds.get(Binding.boost).key)){ + commandMode = input.keyDown(Binding.command_mode); }else{ commandMode = false; } diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index c122876d72..deacabf988 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -254,7 +254,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ @Remote(called = Loc.server, targets = Loc.both, forward = true) public static void requestItem(Player player, Building build, Item item, int amount){ - if(player == null || build == null || !build.interactable(player.team()) || !player.within(build, buildingRange) || player.dead()) return; + if(player == null || build == null || !build.interactable(player.team()) || !player.within(build, itemTransferRange) || player.dead()) return; if(net.server() && (!Units.canInteract(player, build) || !netServer.admins.allowAction(player, ActionType.withdrawItem, build.tile(), action -> { @@ -270,7 +270,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ @Remote(targets = Loc.both, forward = true, called = Loc.server) public static void transferInventory(Player player, Building build){ - if(player == null || build == null || !player.within(build, buildingRange) || build.items == null || player.dead()) return; + if(player == null || build == null || !player.within(build, itemTransferRange) || build.items == null || player.dead()) return; if(net.server() && (player.unit().stack.amount <= 0 || !Units.canInteract(player, build) || !netServer.admins.allowAction(player, ActionType.depositItem, build.tile, action -> { diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index fd22476df9..76f4b98ff9 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -483,7 +483,7 @@ public class LExecutor{ } } case getBlock -> { - float range = Math.max(unit.range(), buildingRange); + float range = Math.max(unit.range(), unit.type.buildRange); if(!unit.within(x1, y1, range)){ exec.setobj(p3, null); exec.setobj(p4, null);