This commit is contained in:
Anuken
2023-11-03 18:56:02 -04:00
parent f606589173
commit 2aaa861755
2 changed files with 19 additions and 12 deletions
+1 -1
View File
@@ -114,7 +114,7 @@ public class DesktopInput extends InputHandler{
//draw break selection //draw break selection
if(mode == breaking){ if(mode == breaking){
drawBreakSelection(selectX, selectY, cursorX, cursorY, !Core.input.keyDown(Binding.schematic_select) ? maxLength : Vars.maxSchematicSize); drawBreakSelection(selectX, selectY, cursorX, cursorY, !Core.input.keyDown(Binding.schematic_select) ? maxLength : Vars.maxSchematicSize, false);
} }
if(!Core.scene.hasKeyboard() && mode != breaking){ if(!Core.scene.hasKeyboard() && mode != breaking){
+11 -4
View File
@@ -1298,6 +1298,10 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
} }
protected void drawBreakSelection(int x1, int y1, int x2, int y2, int maxLength){ protected void drawBreakSelection(int x1, int y1, int x2, int y2, int maxLength){
drawBreakSelection(x1, y1, x2, y2, maxLength, true);
}
protected void drawBreakSelection(int x1, int y1, int x2, int y2, int maxLength, boolean useSelectPlans){
NormalizeDrawResult result = Placement.normalizeDrawArea(Blocks.air, x1, y1, x2, y2, false, maxLength, 1f); NormalizeDrawResult result = Placement.normalizeDrawArea(Blocks.air, x1, y1, x2, y2, false, maxLength, 1f);
NormalizeResult dresult = Placement.normalizeArea(x1, y1, x2, y2, rotation, false, maxLength); NormalizeResult dresult = Placement.normalizeArea(x1, y1, x2, y2, rotation, false, maxLength);
@@ -1316,18 +1320,18 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
Lines.stroke(1f); Lines.stroke(1f);
for(var plan : player.unit().plans()){ for(var plan : player.unit().plans()){
if(plan.breaking) continue; if(!plan.breaking && plan.bounds(Tmp.r2).overlaps(Tmp.r1)){
if(plan.bounds(Tmp.r2).overlaps(Tmp.r1)){
drawBreaking(plan); drawBreaking(plan);
} }
} }
if(useSelectPlans){
for(var plan : selectPlans){ for(var plan : selectPlans){
if(plan.breaking) continue; if(!plan.breaking && plan.bounds(Tmp.r2).overlaps(Tmp.r1)){
if(plan.bounds(Tmp.r2).overlaps(Tmp.r1)){
drawBreaking(plan); drawBreaking(plan);
} }
} }
}
for(BlockPlan plan : player.team().data().plans){ for(BlockPlan plan : player.team().data().plans){
Block block = content.block(plan.block); Block block = content.block(plan.block);
@@ -1487,6 +1491,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
} }
} }
//don't remove plans on desktop, where flushing is false
if(flush){
it = selectPlans.iterator(); it = selectPlans.iterator();
while(it.hasNext()){ while(it.hasNext()){
var plan = it.next(); var plan = it.next();
@@ -1494,6 +1500,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
it.remove(); it.remove();
} }
} }
}
removed.clear(); removed.clear();