Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -37,7 +37,7 @@ public class BuildPlan implements Position, QuadTreeObject{
|
|||||||
public BuildPlan(int x, int y, int rotation, Block block){
|
public BuildPlan(int x, int y, int rotation, Block block){
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.rotation = rotation;
|
this.rotation = block.planRotation(rotation);
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.breaking = false;
|
this.breaking = false;
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ public class BuildPlan implements Position, QuadTreeObject{
|
|||||||
public BuildPlan(int x, int y, int rotation, Block block, Object config){
|
public BuildPlan(int x, int y, int rotation, Block block, Object config){
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.rotation = rotation;
|
this.rotation = block.planRotation(rotation);
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.breaking = false;
|
this.breaking = false;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
@@ -138,7 +138,7 @@ public class BuildPlan implements Position, QuadTreeObject{
|
|||||||
public BuildPlan set(int x, int y, int rotation, Block block){
|
public BuildPlan set(int x, int y, int rotation, Block block){
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.rotation = rotation;
|
this.rotation = block.planRotation(rotation);
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.breaking = false;
|
this.breaking = false;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -178,17 +178,18 @@ public class DesktopInput extends InputHandler{
|
|||||||
}
|
}
|
||||||
linePlans.each(this::drawOverPlan);
|
linePlans.each(this::drawOverPlan);
|
||||||
}else if(isPlacing()){
|
}else if(isPlacing()){
|
||||||
|
int rot = block.planRotation(rotation);
|
||||||
if(block.rotate && block.drawArrow){
|
if(block.rotate && block.drawArrow){
|
||||||
drawArrow(block, cursorX, cursorY, rotation);
|
drawArrow(block, cursorX, cursorY, rot);
|
||||||
}
|
}
|
||||||
Draw.color();
|
Draw.color();
|
||||||
boolean valid = validPlace(cursorX, cursorY, block, rotation);
|
boolean valid = validPlace(cursorX, cursorY, block, rot);
|
||||||
drawPlan(cursorX, cursorY, block, rotation);
|
drawPlan(cursorX, cursorY, block, rot);
|
||||||
block.drawPlace(cursorX, cursorY, rotation, valid);
|
block.drawPlace(cursorX, cursorY, rot, valid);
|
||||||
|
|
||||||
if(block.saveConfig){
|
if(block.saveConfig){
|
||||||
Draw.mixcol(!valid ? Pal.breakInvalid : Color.white, (!valid ? 0.4f : 0.24f) + Mathf.absin(Time.globalTime, 6f, 0.28f));
|
Draw.mixcol(!valid ? Pal.breakInvalid : Color.white, (!valid ? 0.4f : 0.24f) + Mathf.absin(Time.globalTime, 6f, 0.28f));
|
||||||
bplan.set(cursorX, cursorY, rotation, block);
|
bplan.set(cursorX, cursorY, rot, block);
|
||||||
bplan.config = block.lastConfig;
|
bplan.config = block.lastConfig;
|
||||||
block.drawPlanConfig(bplan, allPlans());
|
block.drawPlanConfig(bplan, allPlans());
|
||||||
bplan.config = null;
|
bplan.config = null;
|
||||||
|
|||||||
@@ -1044,7 +1044,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
}
|
}
|
||||||
plan.x = World.toTile(wx - plan.block.offset) + ox;
|
plan.x = World.toTile(wx - plan.block.offset) + ox;
|
||||||
plan.y = World.toTile(wy - plan.block.offset) + oy;
|
plan.y = World.toTile(wy - plan.block.offset) + oy;
|
||||||
plan.rotation = Mathf.mod(plan.rotation + direction, 4);
|
plan.rotation = plan.block.planRotation(Mathf.mod(plan.rotation + direction, 4));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -415,9 +415,10 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
|
|
||||||
//draw last placed plan
|
//draw last placed plan
|
||||||
if(!plan.breaking && plan == lastPlaced && plan.block != null){
|
if(!plan.breaking && plan == lastPlaced && plan.block != null){
|
||||||
boolean valid = validPlace(tile.x, tile.y, plan.block, rotation);
|
int rot = block.planRotation(rotation);
|
||||||
|
boolean valid = validPlace(tile.x, tile.y, plan.block, rot);
|
||||||
Draw.mixcol();
|
Draw.mixcol();
|
||||||
plan.block.drawPlace(tile.x, tile.y, rotation, valid);
|
plan.block.drawPlace(tile.x, tile.y, rot, valid);
|
||||||
|
|
||||||
drawOverlapCheck(plan.block, tile.x, tile.y, valid);
|
drawOverlapCheck(plan.block, tile.x, tile.y, valid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -322,7 +322,14 @@ public class LExecutor{
|
|||||||
cache.found = false;
|
cache.found = false;
|
||||||
exec.setnum(outFound, 0);
|
exec.setnum(outFound, 0);
|
||||||
}
|
}
|
||||||
exec.setobj(outBuild, res != null && res.build != null && res.build.team == exec.team ? cache.build = res.build : null);
|
|
||||||
|
if(res != null && res.build != null &&
|
||||||
|
(unit.within(res.build.x, res.build.y, Math.max(unit.range(), buildingRange)) || res.build.team == exec.team)){
|
||||||
|
cache.build = res.build;
|
||||||
|
exec.setobj(outBuild, res.build);
|
||||||
|
}else{
|
||||||
|
exec.setobj(outBuild, null);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
exec.setobj(outBuild, cache.build);
|
exec.setobj(outBuild, cache.build);
|
||||||
exec.setbool(outFound, cache.found);
|
exec.setbool(outFound, cache.found);
|
||||||
|
|||||||
@@ -1343,9 +1343,14 @@ public class Block extends UnlockableContent implements Senseable{
|
|||||||
packer.add(PageType.editor, name + "-icon-editor", editorBase);
|
packer.add(PageType.editor, name + "-icon-editor", editorBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int planRotation(int rot){
|
||||||
|
if(!rotate) return 0;
|
||||||
|
return rot;
|
||||||
|
}
|
||||||
|
|
||||||
public void flipRotation(BuildPlan req, boolean x){
|
public void flipRotation(BuildPlan req, boolean x){
|
||||||
if((x == (req.rotation % 2 == 0)) != invertFlip){
|
if((x == (req.rotation % 2 == 0)) != invertFlip){
|
||||||
req.rotation = Mathf.mod(req.rotation + 2, 4);
|
req.rotation = planRotation(Mathf.mod(req.rotation + 2, 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user