This commit is contained in:
Anuken
2020-10-09 10:02:08 -04:00
parent e2b58528d0
commit 22f1c3b2d1
8 changed files with 49 additions and 30 deletions

View File

@@ -496,24 +496,8 @@ public class Tile implements Position, QuadTreeObject, Displayable{
protected void changeEntity(Team team, Prov<Building> entityprov, int rotation){
if(build != null){
int size = build.block.size;
build.remove();
build = null;
//update edge entities
tileSet.clear();
for(Point2 edge : Edges.getEdges(size)){
Building other = world.build(x + edge.x, y + edge.y);
if(other != null){
tileSet.add(other);
}
}
//update proximity, since multiblock was just removed
for(Building t : tileSet){
t.updateProximity();
}
}
if(block.hasBuilding()){

View File

@@ -351,8 +351,9 @@ public abstract class Turret extends Block{
AmmoEntry entry = ammo.peek();
entry.amount -= ammoPerShot;
if(entry.amount == 0) ammo.pop();
if(entry.amount <= 0) ammo.pop();
totalAmmo -= ammoPerShot;
totalAmmo = Math.max(totalAmmo, 0);
Time.run(reloadTime / 2f, this::ejectEffects);
return entry.type();
}
@@ -364,7 +365,7 @@ public abstract class Turret extends Block{
/** @return whether the turret has ammo. */
public boolean hasAmmo(){
return ammo.size > 0 && ammo.peek().amount >= ammoPerShot;
return ammo.size > 0 && ammo.peek().amount >= 1;
}
protected void updateShooting(){