Fixed turrets firing without power as players

This commit is contained in:
Anuken
2020-10-04 09:58:53 -04:00
parent c4fb84c359
commit 605a370679
5 changed files with 8 additions and 3 deletions

View File

@@ -1731,7 +1731,7 @@ public class Blocks implements ContentList{
health = 150 * size * size; health = 150 * size * size;
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 2f)).update(false).optional(true, true); consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 2f)).update(false).optional(true, true);
consumes.powerCond(10f, (TurretBuild entity) -> entity.target != null || (entity.logicControlled() && entity.logicShooting)); consumes.powerCond(10f, TurretBuild::isActive);
}}; }};
spectre = new ItemTurret("spectre"){{ spectre = new ItemTurret("spectre"){{

View File

@@ -1314,6 +1314,7 @@ public class UnitTypes implements ContentList{
buildSpeed = 4f; buildSpeed = 4f;
drawShields = false; drawShields = false;
commandLimit = 6; commandLimit = 6;
lowAltitude = true;
ammoCapacity = 1300; ammoCapacity = 1300;
ammoResupplyAmount = 20; ammoResupplyAmount = 20;

View File

@@ -261,7 +261,7 @@ public class DefaultWaves{
curTier = Math.min(curTier, 3); curTier = Math.min(curTier, 3);
//small chance to switch species //small chance to switch species
if(Mathf.chance(0.2)){ if(Mathf.chance(0.3)){
curSpecies = Structs.random(species); curSpecies = Structs.random(species);
} }
} }

View File

@@ -20,7 +20,7 @@ public class PowerTurret extends Turret{
@Override @Override
public void init(){ public void init(){
consumes.powerCond(powerUse, (TurretBuild entity) -> entity.target != null || (entity.logicControlled() && entity.logicShooting)); consumes.powerCond(powerUse, TurretBuild::isActive);
super.init(); super.init();
} }

View File

@@ -195,6 +195,10 @@ public abstract class Turret extends Block{
return logicControlTime > 0; return logicControlTime > 0;
} }
public boolean isActive(){
return target != null || (logicControlled() && logicShooting) || (isControlled() && unit.isShooting());
}
@Override @Override
public void draw(){ public void draw(){
Draw.rect(baseRegion, x, y); Draw.rect(baseRegion, x, y);