Minor cleanup / Tick reset fix
This commit is contained in:
@@ -82,9 +82,9 @@ public class MendProjector extends Block{
|
||||
heat = Mathf.lerpDelta(heat, consValid() && canHeal ? 1f : 0f, 0.08f);
|
||||
charge += heat * delta();
|
||||
|
||||
phaseHeat = Mathf.lerpDelta(phaseHeat, Mathf.num(cons.optionalValid()), 0.1f);
|
||||
phaseHeat = Mathf.lerpDelta(phaseHeat, Mathf.num(consOptionalValid()), 0.1f);
|
||||
|
||||
if(cons.optionalValid() && timer(timerUse, useTime) && efficiency() > 0 && canHeal){
|
||||
if(consOptionalValid() && timer(timerUse, useTime) && efficiency() > 0 && canHeal){
|
||||
consume();
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ public class OverdriveProjector extends Block{
|
||||
charge += heat * Time.delta;
|
||||
|
||||
if(hasBoost){
|
||||
phaseHeat = Mathf.lerpDelta(phaseHeat, Mathf.num(cons.optionalValid()), 0.1f);
|
||||
phaseHeat = Mathf.lerpDelta(phaseHeat, Mathf.num(consOptionalValid()), 0.1f);
|
||||
}
|
||||
|
||||
if(charge >= reload){
|
||||
|
||||
@@ -122,12 +122,12 @@ public class RegenProjector extends Block{
|
||||
}
|
||||
|
||||
if(consValid()){
|
||||
if(cons.optionalValid() && (optionalTimer += Time.delta) >= optionalUseTime){
|
||||
cons.trigger();
|
||||
if(consOptionalValid() && (optionalTimer += Time.delta) >= optionalUseTime){
|
||||
consume();
|
||||
optionalUseTime = 0f;
|
||||
}
|
||||
|
||||
float healAmount = (cons.optionalValid() ? optionalMultiplier : 1f) * healPercent;
|
||||
float healAmount = (consOptionalValid() ? optionalMultiplier : 1f) * healPercent;
|
||||
|
||||
//use Math.max to prevent stacking
|
||||
for(var build : targets){
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ContinuousTurret extends Turret{
|
||||
@Override
|
||||
public boolean hasAmmo(){
|
||||
//TODO update ammo in unit so it corresponds to liquids
|
||||
return cons.canConsume();
|
||||
return canConsume();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,7 +109,7 @@ public class ContinuousTurret extends Turret{
|
||||
return;
|
||||
}
|
||||
|
||||
if(cons.canConsume() && !charging && shootWarmup >= minWarmup){
|
||||
if(canConsume() && !charging && shootWarmup >= minWarmup){
|
||||
shoot(peekAmmo());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ public class Turret extends ReloadTurret{
|
||||
public void updateTile(){
|
||||
if(!validateTarget()) target = null;
|
||||
|
||||
float warmupTarget = isShooting() && cons.canConsume() ? 1f : 0f;
|
||||
float warmupTarget = isShooting() && canConsume() ? 1f : 0f;
|
||||
if(linearWarmup){
|
||||
shootWarmup = Mathf.approachDelta(shootWarmup, warmupTarget, shootWarmupSpeed);
|
||||
}else{
|
||||
@@ -474,7 +474,7 @@ public class Turret extends ReloadTurret{
|
||||
/** @return whether the turret has ammo. */
|
||||
public boolean hasAmmo(){
|
||||
//used for "side-ammo" like gas in some turrets
|
||||
if(!cons.canConsume()) return false;
|
||||
if(!canConsume()) return false;
|
||||
|
||||
//skip first entry if it has less than the required amount of ammo
|
||||
if(ammo.size >= 2 && ammo.peek().amount < ammoPerShot && ammo.get(ammo.size - 2).amount >= ammoPerShot){
|
||||
|
||||
@@ -56,7 +56,7 @@ public class PayloadVoid extends PayloadBlock{
|
||||
@Override
|
||||
public void updateTile(){
|
||||
super.updateTile();
|
||||
if(moveInPayload(false) && cons.valid()){
|
||||
if(moveInPayload(false) && consValid()){
|
||||
payload = null;
|
||||
incinerateEffect.at(this);
|
||||
incinerateSound.at(this);
|
||||
|
||||
@@ -251,7 +251,7 @@ public class BeamDrill extends Block{
|
||||
|
||||
float multiplier = 1f;
|
||||
|
||||
if(cons.optionalValid()){
|
||||
if(consOptionalValid()){
|
||||
boostWarmup = Mathf.lerpDelta(boostWarmup, 1f, 0.1f);
|
||||
multiplier *= optionalBoostIntensity;
|
||||
}else{
|
||||
|
||||
@@ -277,7 +277,7 @@ public class Drill extends Block{
|
||||
|
||||
float speed = 1f;
|
||||
|
||||
if(cons.optionalValid()){
|
||||
if(consOptionalValid()){
|
||||
speed = liquidBoostIntensity;
|
||||
}
|
||||
|
||||
|
||||
@@ -288,7 +288,7 @@ public class GenericCrafter extends Block{
|
||||
|
||||
@Override
|
||||
public boolean shouldAmbientSound(){
|
||||
return cons.valid();
|
||||
return consValid();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,7 +46,7 @@ public class LiquidConverter extends GenericCrafter{
|
||||
public void updateTile(){
|
||||
ConsumeLiquid cl = consumes.get(ConsumeType.liquid);
|
||||
|
||||
if(cons.valid()){
|
||||
if(consValid()){
|
||||
if(Mathf.chanceDelta(updateEffectChance)){
|
||||
updateEffect.at(x + Mathf.range(size * 4f), y + Mathf.range(size * 4));
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class LiquidConverter extends GenericCrafter{
|
||||
}
|
||||
}else{
|
||||
//warmup is still 1 even if not consuming
|
||||
warmup = Mathf.lerp(warmup, cons.canConsume() ? 1f : 0f, 0.02f);
|
||||
warmup = Mathf.lerp(warmup, canConsume() ? 1f : 0f, 0.02f);
|
||||
}
|
||||
|
||||
dumpLiquid(outputLiquid.liquid);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Separator extends Block{
|
||||
|
||||
@Override
|
||||
public boolean shouldAmbientSound(){
|
||||
return cons.valid();
|
||||
return consValid();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -121,7 +121,7 @@ public class SolidPump extends Pump{
|
||||
public void updateTile(){
|
||||
float fraction = Math.max(validTiles + boost + (attribute == null ? 0 : attribute.env()), 0);
|
||||
|
||||
if(cons.valid() && typeLiquid() < liquidCapacity - 0.001f){
|
||||
if(consValid() && typeLiquid() < liquidCapacity - 0.001f){
|
||||
float maxPump = Math.min(liquidCapacity - typeLiquid(), pumpAmount * delta() * fraction * efficiency());
|
||||
liquids.add(result, maxPump);
|
||||
lastPump = maxPump / Time.delta;
|
||||
|
||||
@@ -24,11 +24,6 @@ public class ItemVoid extends Block{
|
||||
return flowItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
flowItems.update(updateFlow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleItem(Building source, Item item){
|
||||
flowItems.handleFlow(item, 1);
|
||||
|
||||
@@ -210,7 +210,7 @@ public class RepairPoint extends Block{
|
||||
|
||||
@Override
|
||||
public BlockStatus status(){
|
||||
return Mathf.equal(efficiency(), 0f, 0.01f) ? BlockStatus.noInput : cons.status();
|
||||
return Mathf.equal(efficiency(), 0f, 0.01f) ? BlockStatus.noInput : super.status();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user