Most direct consumers now operate slower when not supplied with full power
This commit is contained in:
@@ -186,6 +186,14 @@ public class Block extends BaseBlock {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected float getProgressIncrease(TileEntity entity, float baseTime){
|
||||||
|
float progressIncrease = 1f / baseTime * entity.delta();
|
||||||
|
if(hasPower){
|
||||||
|
progressIncrease *= entity.power.satisfaction; // Reduced increase in case of low power
|
||||||
|
}
|
||||||
|
return progressIncrease;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isLayer(Tile tile){
|
public boolean isLayer(Tile tile){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class MendProjector extends Block{
|
|||||||
other = other.target();
|
other = other.target();
|
||||||
|
|
||||||
if(other.getTeamID() == tile.getTeamID() && !healed.contains(other.packedPosition()) && other.entity != null && other.entity.health < other.entity.maxHealth()){
|
if(other.getTeamID() == tile.getTeamID() && !healed.contains(other.packedPosition()) && other.entity != null && other.entity.health < other.entity.maxHealth()){
|
||||||
other.entity.healBy(other.entity.maxHealth() * (healPercent + entity.phaseHeat*phaseBoost)/100f);
|
other.entity.healBy(other.entity.maxHealth() * (healPercent + entity.phaseHeat*phaseBoost)/100f * entity.power.satisfaction);
|
||||||
Effects.effect(BlockFx.healBlockFull, Hue.mix(color, phase, entity.phaseHeat), other.drawx(), other.drawy(), other.block().size);
|
Effects.effect(BlockFx.healBlockFull, Hue.mix(color, phase, entity.phaseHeat), other.drawx(), other.drawy(), other.block().size);
|
||||||
healed.add(other.packedPosition());
|
healed.add(other.packedPosition());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class OverdriveProjector extends Block{
|
|||||||
|
|
||||||
if(entity.charge >= reload){
|
if(entity.charge >= reload){
|
||||||
float realRange = range + entity.phaseHeat * phaseRangeBoost;
|
float realRange = range + entity.phaseHeat * phaseRangeBoost;
|
||||||
float realBoost = speedBoost + entity.phaseHeat*speedBoostPhase;
|
float realBoost = (speedBoost + entity.phaseHeat*speedBoostPhase) * entity.power.satisfaction;
|
||||||
|
|
||||||
Effects.effect(BlockFx.overdriveWave, Hue.mix(color, phase, entity.phaseHeat), tile.drawx(), tile.drawy(), realRange);
|
Effects.effect(BlockFx.overdriveWave, Hue.mix(color, phase, entity.phaseHeat), tile.drawx(), tile.drawy(), realRange);
|
||||||
entity.charge = 0f;
|
entity.charge = 0f;
|
||||||
|
|||||||
@@ -31,7 +31,11 @@ public class LiquidBridge extends ItemBridge{
|
|||||||
tryDumpLiquid(tile, entity.liquids.current());
|
tryDumpLiquid(tile, entity.liquids.current());
|
||||||
}else{
|
}else{
|
||||||
if(entity.cons.valid()){
|
if(entity.cons.valid()){
|
||||||
entity.uptime = Mathf.lerpDelta(entity.uptime, 1f, 0.04f);
|
float alpha = 0.04f;
|
||||||
|
if(hasPower){
|
||||||
|
alpha *= entity.power.satisfaction; // Exceed boot time unless power is at max.
|
||||||
|
}
|
||||||
|
entity.uptime = Mathf.lerpDelta(entity.uptime, 1f, alpha);
|
||||||
}else{
|
}else{
|
||||||
entity.uptime = Mathf.lerpDelta(entity.uptime, 0f, 0.02f);
|
entity.uptime = Mathf.lerpDelta(entity.uptime, 0f, 0.02f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,6 +188,9 @@ public class Drill extends Block{
|
|||||||
if(entity.consumed(ConsumeLiquid.class) && !liquidRequired){
|
if(entity.consumed(ConsumeLiquid.class) && !liquidRequired){
|
||||||
speed = liquidBoostIntensity;
|
speed = liquidBoostIntensity;
|
||||||
}
|
}
|
||||||
|
if(hasPower){
|
||||||
|
speed *= entity.power.satisfaction; // Drill slower when not at full power
|
||||||
|
}
|
||||||
|
|
||||||
entity.warmup = Mathf.lerpDelta(entity.warmup, speed, warmupSpeed);
|
entity.warmup = Mathf.lerpDelta(entity.warmup, speed, warmupSpeed);
|
||||||
entity.progress += entity.delta()
|
entity.progress += entity.delta()
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class Fracker extends SolidPump{
|
|||||||
|
|
||||||
if(entity.cons.valid() && entity.accumulator < itemUseTime){
|
if(entity.cons.valid() && entity.accumulator < itemUseTime){
|
||||||
super.update(tile);
|
super.update(tile);
|
||||||
entity.accumulator += entity.delta();
|
entity.accumulator += entity.delta() * entity.power.satisfaction;
|
||||||
}else{
|
}else{
|
||||||
tryDumpLiquid(tile, result);
|
tryDumpLiquid(tile, result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class GenericCrafter extends Block{
|
|||||||
|
|
||||||
if(entity.cons.valid() && tile.entity.items.get(output) < itemCapacity){
|
if(entity.cons.valid() && tile.entity.items.get(output) < itemCapacity){
|
||||||
|
|
||||||
entity.progress += 1f / craftTime * entity.delta();
|
entity.progress += getProgressIncrease(entity, craftTime);
|
||||||
entity.totalProgress += entity.delta();
|
entity.totalProgress += entity.delta();
|
||||||
entity.warmup = Mathf.lerpDelta(entity.warmup, 1f, 0.02f);
|
entity.warmup = Mathf.lerpDelta(entity.warmup, 1f, 0.02f);
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ public class Incinerator extends Block{
|
|||||||
update = true;
|
update = true;
|
||||||
solid = true;
|
solid = true;
|
||||||
|
|
||||||
consumes.powerDirect(0.05f);
|
// Incinerator has no speed which could be adjusted, so it will only operate fully powered for now
|
||||||
|
consumes.powerDirect(0.05f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ public class LiquidMixer extends LiquidBlock{
|
|||||||
|
|
||||||
if(tile.entity.cons.valid()){
|
if(tile.entity.cons.valid()){
|
||||||
float use = Math.min(consumes.get(ConsumeLiquid.class).used() * entity.delta(), liquidCapacity - entity.liquids.get(outputLiquid));
|
float use = Math.min(consumes.get(ConsumeLiquid.class).used() * entity.delta(), liquidCapacity - entity.liquids.get(outputLiquid));
|
||||||
|
if(hasPower){
|
||||||
|
use *= entity.power.satisfaction; // Produce less liquid if power is not maxed
|
||||||
|
}
|
||||||
entity.accumulator += use;
|
entity.accumulator += use;
|
||||||
entity.liquids.add(outputLiquid, use);
|
entity.liquids.add(outputLiquid, use);
|
||||||
for(int i = 0; i < (int) (entity.accumulator / liquidPerItem); i++){
|
for(int i = 0; i < (int) (entity.accumulator / liquidPerItem); i++){
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class PowerCrafter extends Block{
|
|||||||
GenericCrafterEntity entity = tile.entity();
|
GenericCrafterEntity entity = tile.entity();
|
||||||
|
|
||||||
if(entity.cons.valid()){
|
if(entity.cons.valid()){
|
||||||
entity.progress += 1f / craftTime * entity.delta();
|
entity.progress += getProgressIncrease(entity, craftTime);
|
||||||
entity.totalProgress += entity.delta();
|
entity.totalProgress += entity.delta();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ public class PowerSmelter extends PowerBlock{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.craftTime += entity.delta();
|
entity.craftTime += entity.delta() * entity.power.satisfaction;
|
||||||
|
|
||||||
if(entity.items.get(result) >= itemCapacity //output full
|
if(entity.items.get(result) >= itemCapacity //output full
|
||||||
|| entity.heat <= minHeat //not burning
|
|| entity.heat <= minHeat //not burning
|
||||||
|
|||||||
@@ -95,6 +95,9 @@ public class Pump extends LiquidBlock{
|
|||||||
|
|
||||||
if(tile.entity.cons.valid() && liquidDrop != null){
|
if(tile.entity.cons.valid() && liquidDrop != null){
|
||||||
float maxPump = Math.min(liquidCapacity - tile.entity.liquids.total(), tiles * pumpAmount * tile.entity.delta());
|
float maxPump = Math.min(liquidCapacity - tile.entity.liquids.total(), tiles * pumpAmount * tile.entity.delta());
|
||||||
|
if(hasPower){
|
||||||
|
maxPump *= tile.entity.power.satisfaction; // Produce slower if not at full power
|
||||||
|
}
|
||||||
tile.entity.liquids.add(liquidDrop, maxPump);
|
tile.entity.liquids.add(liquidDrop, maxPump);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class Separator extends Block{
|
|||||||
entity.totalProgress += entity.warmup * entity.delta();
|
entity.totalProgress += entity.warmup * entity.delta();
|
||||||
|
|
||||||
if(entity.cons.valid()){
|
if(entity.cons.valid()){
|
||||||
entity.progress += 1f / filterTime*entity.delta();
|
entity.progress += getProgressIncrease(entity, filterTime);
|
||||||
entity.warmup = Mathf.lerpDelta(entity.warmup, 1f, 0.02f);
|
entity.warmup = Mathf.lerpDelta(entity.warmup, 1f, 0.02f);
|
||||||
}else{
|
}else{
|
||||||
entity.warmup = Mathf.lerpDelta(entity.warmup, 0f, 0.02f);
|
entity.warmup = Mathf.lerpDelta(entity.warmup, 0f, 0.02f);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class SolidPump extends Pump{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(tile.entity.cons.valid() && typeLiquid(tile) < liquidCapacity - 0.001f){
|
if(tile.entity.cons.valid() && typeLiquid(tile) < liquidCapacity - 0.001f){
|
||||||
float maxPump = Math.min(liquidCapacity - typeLiquid(tile), pumpAmount * entity.delta() * fraction);
|
float maxPump = Math.min(liquidCapacity - typeLiquid(tile), pumpAmount * entity.delta() * fraction * entity.power.satisfaction);
|
||||||
tile.entity.liquids.add(result, maxPump);
|
tile.entity.liquids.add(result, maxPump);
|
||||||
entity.warmup = Mathf.lerpDelta(entity.warmup, 1f, 0.02f);
|
entity.warmup = Mathf.lerpDelta(entity.warmup, 1f, 0.02f);
|
||||||
if(Mathf.chance(entity.delta() * updateEffectChance))
|
if(Mathf.chance(entity.delta() * updateEffectChance))
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public class UnitFactory extends Block{
|
|||||||
|
|
||||||
if(hasRequirements(entity.items, entity.buildTime / produceTime) && entity.cons.valid()){
|
if(hasRequirements(entity.items, entity.buildTime / produceTime) && entity.cons.valid()){
|
||||||
|
|
||||||
entity.buildTime += entity.delta();
|
entity.buildTime += entity.delta() * entity.power.satisfaction;
|
||||||
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.05f);
|
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.05f);
|
||||||
}else{
|
}else{
|
||||||
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 0f, 0.05f);
|
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 0f, 0.05f);
|
||||||
|
|||||||
Reference in New Issue
Block a user