Continued work on power generators
This commit is contained in:
@@ -20,17 +20,13 @@ public class PowerBlocks extends BlockList implements ContentList{
|
||||
|
||||
thermalGenerator = new LiquidHeatGenerator("thermal-generator"){{
|
||||
maxLiquidGenerate = 4f;
|
||||
// TODO: Balance
|
||||
powerProduction = 0.17f;
|
||||
liquidPowerMultiplier = 0.1f;
|
||||
powerProduction = 8f;
|
||||
generateEffect = BlockFx.redgeneratespark;
|
||||
size = 2;
|
||||
}};
|
||||
|
||||
turbineGenerator = new TurbineGenerator("turbine-generator"){{
|
||||
// TODO: Balance
|
||||
powerProduction = 0.28f;
|
||||
liquidPowerMultiplier = 0.3f;
|
||||
itemDuration = 30f;
|
||||
consumes.liquid(Liquids.water, 0.05f);
|
||||
size = 2;
|
||||
|
||||
@@ -30,7 +30,6 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
protected float itemDuration = 70f;
|
||||
|
||||
protected float minLiquidEfficiency = 0.2f;
|
||||
protected float liquidPowerMultiplier = 1.3f; // A liquid with 100% flammability will be 30% more efficient than an item with 100% flammability.
|
||||
/** Maximum liquid used per frame. */
|
||||
protected float maxLiquidGenerate = 0.4f;
|
||||
|
||||
@@ -100,14 +99,14 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
}
|
||||
//liquid takes priority over solids
|
||||
if(hasLiquids && liquid != null && entity.liquids.get(liquid) >= 0.001f){
|
||||
float baseLiquidEfficiency = getLiquidEfficiency(liquid) * this.liquidPowerMultiplier;
|
||||
float baseLiquidEfficiency = getLiquidEfficiency(liquid);
|
||||
float maximumPossible = maxLiquidGenerate * calculationDelta;
|
||||
float used = Math.min(entity.liquids.get(liquid) * calculationDelta, maximumPossible);
|
||||
|
||||
entity.liquids.remove(liquid, used);
|
||||
|
||||
// Note: 1 Item with 100% Flammability = 100% efficiency. This means 100% is not max but rather a reference point for this generator.
|
||||
entity.productionEfficiency = baseLiquidEfficiency * used / maximumPossible;
|
||||
// Note: 0.5 = 100%. PowerGraph will multiply this efficiency by two on its own.
|
||||
entity.productionEfficiency = Mathf.clamp(baseLiquidEfficiency * used / maximumPossible);
|
||||
|
||||
if(used > 0.001f && Mathf.chance(0.05 * entity.delta())){
|
||||
Effects.effect(generateEffect, tile.drawx() + Mathf.range(3f), tile.drawy() + Mathf.range(3f));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.power;
|
||||
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.meta.BlockStat;
|
||||
import io.anuke.mindustry.world.meta.StatUnit;
|
||||
@@ -16,8 +16,8 @@ public class LiquidHeatGenerator extends ItemLiquidGenerator{
|
||||
super.setStats();
|
||||
|
||||
stats.remove(BlockStat.basePowerGeneration);
|
||||
// TODO Adapt to new new power system. Maybe this override can be removed.
|
||||
//stats.add(BlockStat.basePowerGeneration, <Do something with maxLiquidGenerate, basePowerGeneration and liquidPowerMultiplier> * 60f, StatUnit.powerSecond);
|
||||
// Right now, Lava is the only thing that can be used.
|
||||
stats.add(BlockStat.basePowerGeneration, powerProduction * getLiquidEfficiency(Liquids.lava) / maxLiquidGenerate * 60f, StatUnit.powerSecond);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,12 +33,14 @@ public class PowerGenerator extends PowerDistributor{
|
||||
@Override
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
stats.add(generationType, powerProduction * 60.0f, StatUnit.powerSecond);
|
||||
// Divide power production by two since that is what is produced at an efficiency of 0.5, which currently represents 100%
|
||||
stats.add(generationType, powerProduction * 60.0f / 2.0f, StatUnit.powerSecond);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPowerProduction(Tile tile){
|
||||
return powerProduction * tile.<GeneratorEntity>entity().productionEfficiency;
|
||||
// Multiply all efficiencies by two since 0.5 = 100% efficiency
|
||||
return powerProduction * tile.<GeneratorEntity>entity().productionEfficiency * 2.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user