Added silicon crucible
This commit is contained in:
@@ -88,7 +88,7 @@ public class ForceProjector extends Block{
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
boolean phaseValid = consumes.get(ConsumeType.item).valid(tile.entity);
|
||||
boolean phaseValid = consumes.get(ConsumeType.item).valid(this);
|
||||
|
||||
phaseHeat = Mathf.lerpDelta(phaseHeat, Mathf.num(phaseValid), 0.1f);
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package mindustry.world.blocks.production;
|
||||
|
||||
import arc.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
/** A smelter that gains efficiency from heat tiles. */
|
||||
public class ThermalSmelter extends GenericSmelter{
|
||||
public Attribute attribute = Attribute.heat;
|
||||
public float baseEfficiency = 1f;
|
||||
public float heatBoostScale = 1f;
|
||||
public float maxHeatBoost = 1f;
|
||||
|
||||
public ThermalSmelter(String name){
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||
drawPlaceText(Core.bundle.format("bar.efficiency",
|
||||
(int)((baseEfficiency + Math.min(maxHeatBoost, heatBoostScale * sumAttribute(attribute, x, y))) * 100f)), x, y, valid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
|
||||
bars.add("efficiency", entity ->
|
||||
new Bar(() ->
|
||||
Core.bundle.format("bar.efficiency", (int)(entity.efficiency() * 100)),
|
||||
() -> Pal.lightOrange,
|
||||
entity::efficiency));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
||||
stats.add(BlockStat.tiles, attribute, heatBoostScale);
|
||||
}
|
||||
|
||||
public class HeatedSmelterEntity extends SmelterEntity{
|
||||
public float heat = 0.0f;
|
||||
|
||||
@Override
|
||||
public float efficiency(){
|
||||
return (baseEfficiency + Math.min(maxHeatBoost, heatBoostScale * heat)) * super.efficiency();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void placed(){
|
||||
super.placed();
|
||||
|
||||
heat = sumAttribute(attribute, tile.x, tile.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,9 +38,13 @@ public class BlockStats{
|
||||
}
|
||||
|
||||
public void add(BlockStat stat, Attribute attr){
|
||||
add(stat, attr, 1f);
|
||||
}
|
||||
|
||||
public void add(BlockStat stat, Attribute attr, float scale){
|
||||
for(Block block : Vars.content.blocks()){
|
||||
if(!block.isFloor() || block.asFloor().attributes.get(attr) == 0) continue;
|
||||
add(stat, new FloorEfficiencyValue(block.asFloor(), block.asFloor().attributes.get(attr)));
|
||||
add(stat, new FloorEfficiencyValue(block.asFloor(), block.asFloor().attributes.get(attr) * scale));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user