Neoplasia reactor
This commit is contained in:
77
core/src/mindustry/world/blocks/power/HeaterGenerator.java
Normal file
77
core/src/mindustry/world/blocks/power/HeaterGenerator.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package mindustry.world.blocks.power;
|
||||
|
||||
import arc.math.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.blocks.heat.*;
|
||||
import mindustry.world.draw.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
public class HeaterGenerator extends ConsumeGenerator{
|
||||
public float heatOutput = 10f;
|
||||
public float warmupRate = 0.15f;
|
||||
|
||||
public HeaterGenerator(String name){
|
||||
super(name);
|
||||
|
||||
drawer = new DrawMulti(new DrawDefault(), new DrawHeatOutput());
|
||||
rotateDraw = false;
|
||||
rotate = true;
|
||||
canOverdrive = false;
|
||||
drawArrow = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
|
||||
stats.add(Stat.output, heatOutput, StatUnit.heatUnits);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotatedOutput(int x, int y){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
|
||||
addBar("heat", (HeaterGeneratorBuild entity) -> new Bar("bar.heat", Pal.lightOrange, () -> entity.heat / heatOutput));
|
||||
}
|
||||
|
||||
public class HeaterGeneratorBuild extends ConsumeGeneratorBuild implements HeatBlock{
|
||||
public float heat;
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
super.updateTile();
|
||||
|
||||
//heat approaches target at the same speed regardless of efficiency
|
||||
heat = Mathf.approachDelta(heat, heatOutput * efficiency, warmupRate * delta());
|
||||
}
|
||||
|
||||
@Override
|
||||
public float heatFrac(){
|
||||
return heat / heatOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float heat(){
|
||||
return heat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Writes write){
|
||||
super.write(write);
|
||||
write.f(heat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(Reads read, byte revision){
|
||||
super.read(read, revision);
|
||||
heat = read.f();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ public class PowerGenerator extends PowerDistributor{
|
||||
public float explosionPuddleRange = tilesize * 2f;
|
||||
public float explosionPuddleAmount = 100f;
|
||||
public @Nullable Liquid explosionPuddleLiquid;
|
||||
public float explosionMinWarmup = 0f;
|
||||
|
||||
public float explosionShake = 0f, explosionShakeDuration = 6f;
|
||||
|
||||
@@ -110,23 +111,25 @@ public class PowerGenerator extends PowerDistributor{
|
||||
}
|
||||
|
||||
public void createExplosion(){
|
||||
if(explosionDamage > 0){
|
||||
Damage.damage(x, y, explosionRadius * tilesize, explosionDamage);
|
||||
}
|
||||
|
||||
explodeEffect.at(this);
|
||||
explodeSound.at(this);
|
||||
|
||||
if(explosionPuddleLiquid != null){
|
||||
for(int i = 0; i < explosionPuddles; i++){
|
||||
Tmp.v1.trns(Mathf.random(360f), Mathf.random(explosionPuddleRange));
|
||||
Tile tile = world.tileWorld(x + Tmp.v1.x, y + Tmp.v1.y);
|
||||
Puddles.deposit(tile, explosionPuddleLiquid, explosionPuddleAmount);
|
||||
if(warmup() >= explosionMinWarmup){
|
||||
if(explosionDamage > 0){
|
||||
Damage.damage(x, y, explosionRadius * tilesize, explosionDamage);
|
||||
}
|
||||
}
|
||||
|
||||
if(explosionShake > 0){
|
||||
Effect.shake(explosionShake, explosionShakeDuration, this);
|
||||
explodeEffect.at(this);
|
||||
explodeSound.at(this);
|
||||
|
||||
if(explosionPuddleLiquid != null){
|
||||
for(int i = 0; i < explosionPuddles; i++){
|
||||
Tmp.v1.trns(Mathf.random(360f), Mathf.random(explosionPuddleRange));
|
||||
Tile tile = world.tileWorld(x + Tmp.v1.x, y + Tmp.v1.y);
|
||||
Puddles.deposit(tile, explosionPuddleLiquid, explosionPuddleAmount);
|
||||
}
|
||||
}
|
||||
|
||||
if(explosionShake > 0){
|
||||
Effect.shake(explosionShake, explosionShakeDuration, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public class Incinerator extends Block{
|
||||
|
||||
@Override
|
||||
public boolean acceptLiquid(Building source, Liquid liquid){
|
||||
return heat > 0.5f;
|
||||
return heat > 0.5f && liquid.incinerable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,10 @@ import mindustry.world.*;
|
||||
|
||||
public class DrawCells extends DrawBlock{
|
||||
public TextureRegion middle;
|
||||
|
||||
public Color color = Color.white.cpy(), particleColorFrom = Color.black.cpy(), particleColorTo = Color.black.cpy();
|
||||
public int particles = 12;
|
||||
public float range = 4f, recurrence = 6f, radius = 3f, lifetime = 60f;
|
||||
public float range = 4f, recurrence = 2f, radius = 1.8f, lifetime = 60f * 3f;
|
||||
|
||||
@Override
|
||||
public void draw(Building build){
|
||||
@@ -38,7 +39,6 @@ public class DrawCells extends DrawBlock{
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
Draw.rect(build.block.region, build.x, build.y);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user