Beam drill bugfixes
This commit is contained in:
@@ -9,6 +9,7 @@ import arc.util.*;
|
|||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.entities.units.*;
|
import mindustry.entities.units.*;
|
||||||
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
@@ -76,7 +77,7 @@ public class BeamDrill extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
Item item = null;
|
Item item = null, invalidItem = null;
|
||||||
boolean multiple = false;
|
boolean multiple = false;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
@@ -88,15 +89,17 @@ public class BeamDrill extends Block{
|
|||||||
for(; j < range; j++){
|
for(; j < range; j++){
|
||||||
int rx = Tmp.p1.x + Geometry.d4x(rotation)*j, ry = Tmp.p1.y + Geometry.d4y(rotation)*j;
|
int rx = Tmp.p1.x + Geometry.d4x(rotation)*j, ry = Tmp.p1.y + Geometry.d4y(rotation)*j;
|
||||||
Tile other = world.tile(rx, ry);
|
Tile other = world.tile(rx, ry);
|
||||||
if(other != null){
|
if(other != null && other.solid()){
|
||||||
if(other.solid()){
|
Item drop = other.wallDrop();
|
||||||
Item drop = other.wallDrop();
|
if(drop != null){
|
||||||
if(drop != null && drop.hardness <= tier){
|
if(drop.hardness <= tier){
|
||||||
found = drop;
|
found = drop;
|
||||||
count ++;
|
count++;
|
||||||
|
}else{
|
||||||
|
invalidItem = drop;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,10 +129,31 @@ public class BeamDrill extends Block{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
Draw.rect(item.fullIcon, dx, dy, s, s);
|
Draw.rect(item.fullIcon, dx, dy, s, s);
|
||||||
}
|
}
|
||||||
|
}else if(invalidItem != null){
|
||||||
|
drawPlaceText(Core.bundle.get("bar.drilltierreq"), x, y, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPlaceOn(Tile tile, Team team, int rotation){
|
||||||
|
for(int i = 0; i < size; i++){
|
||||||
|
getLaserPos(tile.x, tile.y, rotation, i, Tmp.p1);
|
||||||
|
for(int j = 0; j < range; j++){
|
||||||
|
Tile other = world.tile(Tmp.p1.x + Geometry.d4x(rotation)*j, Tmp.p1.y + Geometry.d4y(rotation)*j);
|
||||||
|
if(other != null && other.solid()){
|
||||||
|
Item drop = other.wallDrop();
|
||||||
|
if(drop != null && drop.hardness <= tier){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void getLaserPos(int tx, int ty, int rotation, int i, Point2 out){
|
void getLaserPos(int tx, int ty, int rotation, int i, Point2 out){
|
||||||
int cornerX = tx - (size-1)/2, cornerY = ty - (size-1)/2, s = size;
|
int cornerX = tx - (size-1)/2, cornerY = ty - (size-1)/2, s = size;
|
||||||
switch(rotation){
|
switch(rotation){
|
||||||
@@ -221,7 +245,7 @@ public class BeamDrill extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldConsume(){
|
public boolean shouldConsume(){
|
||||||
return items.total() < itemCapacity;
|
return items.total() < itemCapacity && enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user