Fixed block targeting bug
This commit is contained in:
@@ -142,7 +142,7 @@ public class BlockIndexer{
|
|||||||
for(int ty = ry * structQuadrantSize; ty < (ry + 1) * structQuadrantSize && ty < world.height(); ty++){
|
for(int ty = ry * structQuadrantSize; ty < (ry + 1) * structQuadrantSize && ty < world.height(); ty++){
|
||||||
Tile other = world.tile(tx, ty);
|
Tile other = world.tile(tx, ty);
|
||||||
|
|
||||||
if(other == null || other.entity == null || !pred.test(other)) continue;
|
if(other == null || other.entity == null || other.getTeam() != team || !pred.test(other)) continue;
|
||||||
|
|
||||||
TileEntity e = other.entity;
|
TileEntity e = other.entity;
|
||||||
|
|
||||||
@@ -246,7 +246,6 @@ public class BlockIndexer{
|
|||||||
int quadrantX = tile.x / structQuadrantSize;
|
int quadrantX = tile.x / structQuadrantSize;
|
||||||
int quadrantY = tile.y / structQuadrantSize;
|
int quadrantY = tile.y / structQuadrantSize;
|
||||||
int index = quadrantX + quadrantY * quadWidth();
|
int index = quadrantX + quadrantY * quadWidth();
|
||||||
//Log.info("Updating quadrant: {0} {1}", quadrantX, quadrantY);
|
|
||||||
|
|
||||||
for(TeamData data : state.teams.getTeams()){
|
for(TeamData data : state.teams.getTeams()){
|
||||||
|
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ public class World extends Module{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setBlock(Tile tile, Block block, Team team){
|
public void setBlock(Tile tile, Block block, Team team){
|
||||||
tile.setBlock(block);
|
tile.setBlock(block, team);
|
||||||
if(block.isMultiblock()){
|
if(block.isMultiblock()){
|
||||||
int offsetx = -(block.size - 1) / 2;
|
int offsetx = -(block.size - 1) / 2;
|
||||||
int offsety = -(block.size - 1) / 2;
|
int offsety = -(block.size - 1) / 2;
|
||||||
|
|||||||
@@ -584,6 +584,11 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
|
if(state.is(State.menu)){
|
||||||
|
selection.clear();
|
||||||
|
removals.clear();
|
||||||
|
mode = none;
|
||||||
|
}
|
||||||
|
|
||||||
//reset state when not placing
|
//reset state when not placing
|
||||||
if(mode == none){
|
if(mode == none){
|
||||||
|
|||||||
@@ -167,8 +167,13 @@ public class Tile implements PosTrait, TargetTrait{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setBlock(Block type, Team team){
|
public void setBlock(Block type, Team team){
|
||||||
setBlock(type);
|
synchronized(tileSetLock){
|
||||||
setTeam(team);
|
preChanged();
|
||||||
|
this.wall = type;
|
||||||
|
this.team = (byte)team.ordinal();
|
||||||
|
this.link = 0;
|
||||||
|
changed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlock(Block type){
|
public void setBlock(Block type){
|
||||||
@@ -393,6 +398,7 @@ public class Tile implements PosTrait, TargetTrait{
|
|||||||
if(entity != null){
|
if(entity != null){
|
||||||
entity.removeFromProximity();
|
entity.removeFromProximity();
|
||||||
}
|
}
|
||||||
|
team = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,8 +410,6 @@ public class Tile implements PosTrait, TargetTrait{
|
|||||||
entity = null;
|
entity = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
team = 0;
|
|
||||||
|
|
||||||
Block block = block();
|
Block block = block();
|
||||||
|
|
||||||
if(block.hasEntity()){
|
if(block.hasEntity()){
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ public class BuildBlock extends Block{
|
|||||||
public static void onConstructFinish(Tile tile, Block block, int builderID, byte rotation, Team team){
|
public static void onConstructFinish(Tile tile, Block block, int builderID, byte rotation, Team team){
|
||||||
tile.setRotation(rotation);
|
tile.setRotation(rotation);
|
||||||
world.setBlock(tile, block, team);
|
world.setBlock(tile, block, team);
|
||||||
tile.setTeam(team);
|
|
||||||
Effects.effect(Fx.placeBlock, tile.drawx(), tile.drawy(), block.size);
|
Effects.effect(Fx.placeBlock, tile.drawx(), tile.drawy(), block.size);
|
||||||
|
|
||||||
//last builder was this local client player, call placed()
|
//last builder was this local client player, call placed()
|
||||||
@@ -236,7 +235,7 @@ public class BuildBlock extends Block{
|
|||||||
|
|
||||||
progress = Mathf.clamp(progress - amount);
|
progress = Mathf.clamp(progress - amount);
|
||||||
|
|
||||||
if(progress <= 0 || debug || state.mode.infiniteResources){
|
if(progress <= 0 || state.mode.infiniteResources){
|
||||||
Call.onDeconstructFinish(tile, this.recipe == null ? previous : this.recipe.result);
|
Call.onDeconstructFinish(tile, this.recipe == null ? previous : this.recipe.result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user