diff --git a/core/assets/contributors b/core/assets/contributors index 17e32620980..8bcc1913ab1 100644 --- a/core/assets/contributors +++ b/core/assets/contributors @@ -162,6 +162,7 @@ Gabriel "red" Fondato CoCo Snow summoner OpalSoPL +apollovy BalaM314 Redstonneur1256 ApsZoldat diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index 4b39263af0b..eb60766e463 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -56,6 +56,8 @@ public class DesktopInput extends InputHandler{ /** Time of most recent control group selection */ public long lastCtrlGroupSelectMillis; + private final Vec2 buildPlanMouseOffsetPX = new Vec2(); + boolean showHint(){ return ui.hudfrag.shown && Core.settings.getBool("hints") && selectPlans.isEmpty() && !player.dead() && (!isBuilding && !Core.settings.getBool("buildautopause") || player.unit().isBuilding() || !player.dead() && !player.unit().spawnedByCore()); @@ -639,11 +641,10 @@ void pollInput(){ } if(splan != null){ - float offset = ((splan.block.size + 2) % 2) * tilesize / 2f; - float x = Core.input.mouseWorld().x + offset; - float y = Core.input.mouseWorld().y + offset; - splan.x = (int)(x / tilesize); - splan.y = (int)(y / tilesize); + float x = Core.input.mouseWorld().x + buildPlanMouseOffsetPX.x; + float y = Core.input.mouseWorld().y + buildPlanMouseOffsetPX.y; + splan.x = Math.round(x / tilesize); + splan.y = Math.round(y / tilesize); } if(block == null || mode != placing){ @@ -687,6 +688,8 @@ void pollInput(){ updateLine(selectX, selectY); }else if(plan != null && !plan.breaking && mode == none && !plan.initialized && plan.progress <= 0f){ splan = plan; + buildPlanMouseOffsetPX.x = splan.x * tilesize - Core.input.mouseWorld().x; + buildPlanMouseOffsetPX.y = splan.y * tilesize - Core.input.mouseWorld().y; }else if(plan != null && plan.breaking){ deleting = true; }else if(commandMode){