Fixed to mobile input

This commit is contained in:
Anuken 2019-11-02 10:45:23 -04:00
parent ea9e23f924
commit 49adf1fae7
2 changed files with 16 additions and 12 deletions

View File

@ -392,13 +392,12 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
}
}
/*
for(BuildRequest req : selectRequests){
if(req.breaking) continue;
if(req.bounds(Tmp.r2).overlaps(Tmp.r1)){
drawBreaking(req);
}
}*/
}
for(BrokenBlock req : state.teams.get(player.getTeam()).brokenBlocks){
Block block = content.block(req.block);
@ -429,12 +428,13 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
protected void flushSelectRequests(Array<BuildRequest> requests){
for(BuildRequest req : requests){
if(req.block != null && validPlace(req.x, req.y, req.block, req.rotation)){
BuildRequest other = getRequest(req.x, req.y);
if(other != null){
BuildRequest other = getRequest(req.x, req.y, req.block.size, null);
if(other == null){
selectRequests.add(req.copy());
}else if(!other.breaking && other.x == req.x && other.y == req.y && other.block.size == req.block.size){
selectRequests.remove(other);
selectRequests.add(req.copy());
}
selectRequests.add(req.copy());
}
}
}
@ -498,14 +498,13 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
}
}
/*
it = selectRequests.iterator();
while(it.hasNext()){
BuildRequest req = it.next();
if(!req.breaking && req.bounds(Tmp.r2).overlaps(Tmp.r1)){
it.remove();
}
}*/
}
//remove blocks to rebuild
Iterator<BrokenBlock> broken = state.teams.get(player.getTeam()).brokenBlocks.iterator();

View File

@ -218,11 +218,13 @@ public class MobileInput extends InputHandler implements GestureListener{
if(tile != null){
if(!request.breaking){
if(validPlace(request.x, request.y, request.block, request.rotation)){
BuildRequest other = getRequest(request.x, request.y);
if(other != null){
BuildRequest other = getRequest(request.x, request.y, request.block.size, null);
if(other == null){
player.addBuildRequest(request.copy());
}else if(!other.breaking && other.x == request.x && other.y == request.y && other.block.size == request.block.size){
player.buildQueue().remove(other);
player.addBuildRequest(request.copy());
}
player.addBuildRequest(request.copy());
}
rotation = request.rotation;
@ -359,7 +361,10 @@ public class MobileInput extends InputHandler implements GestureListener{
if(i == lineRequests.size - 1 && req.block.rotate){
drawArrow(block, req.x, req.y, req.rotation);
}
drawRequest(lineRequests.get(i));
BuildRequest request = lineRequests.get(i);
request.block.drawRequest(request, allRequests(), validPlace(request.x, request.y, request.block, request.rotation) && getRequest(req.x, request.y, request.block.size, null) == null);
drawSelected(request.x, request.y, request.block, Pal.accent);
}
}else if(mode == breaking){
drawBreakSelection(lineStartX, lineStartY, tileX, tileY);