Neoplasia reactor

This commit is contained in:
Anuken 2022-08-02 21:26:15 -04:00
parent 859baec744
commit a54907583b
22 changed files with 225 additions and 27 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

@ -1673,6 +1673,7 @@ block.basic-assembler-module.name = Basic Assembler Module
block.smite.name = Smite
block.malign.name = Malign
block.flux-reactor.name = Flux Reactor
block.neoplasia-reactor.name = Neoplasia Reactor
block.switch.name = Switch
block.micro-processor.name = Micro Processor

View file

@ -578,3 +578,4 @@
63106=shockwave-tower|block-shockwave-tower-ui
63105=heat-source|block-heat-source-ui
63104=flux-reactor|block-flux-reactor-ui
63103=neoplasia-reactor|block-neoplasia-reactor-ui

Binary file not shown.

View file

@ -36,6 +36,7 @@ import mindustry.world.consumers.*;
import mindustry.world.draw.*;
import mindustry.world.meta.*;
import static mindustry.Vars.*;
import static mindustry.type.ItemStack.*;
public class Blocks{
@ -119,7 +120,7 @@ public class Blocks{
impactReactor, battery, batteryLarge, powerNode, powerNodeLarge, surgeTower, diode,
//power - erekir
turbineCondenser, ventCondenser, chemicalCombustionChamber, pyrolysisGenerator, fluxReactor,
turbineCondenser, ventCondenser, chemicalCombustionChamber, pyrolysisGenerator, fluxReactor, neoplasiaReactor,
beamNode, beamTower, beamLink,
//production
@ -2374,7 +2375,6 @@ public class Blocks{
heating = 0.02f;
consumeItem(Items.thorium);
//TODO how to non update
consumeLiquid(Liquids.cryofluid, heating / coolantPower).update(false);
}};
@ -2507,6 +2507,7 @@ public class Blocks{
consumeLiquid(Liquids.cyanogen, 9f / 60f);
liquidCapacity = 30f;
explosionMinWarmup = 0.5f;
size = 5;
@ -2529,6 +2530,70 @@ public class Blocks{
);
}};
//TODO stats
neoplasiaReactor = new HeaterGenerator("neoplasia-reactor"){{
requirements(Category.power, with(Items.tungsten, 1000, Items.carbide, 300, Items.oxide, 150, Items.silicon, 500, Items.phaseFabric, 300, Items.surgeAlloy, 200));
size = 5;
liquidCapacity = 80f;
outputLiquid = new LiquidStack(Liquids.neoplasm, 20f / 60f);
explodeOnFull = true;
heatOutput = 60f;
//TODO arkycite, or nitrogen? both? Decide.
consumeLiquid(Liquids.arkycite, 80f / 60f);
consumeLiquid(Liquids.water, 10f / 60f);
consumeItem(Items.phaseFabric);
itemDuration = 60f * 3f;
itemCapacity = 10;
explosionRadius = 5;
explosionDamage = 500;
explodeEffect = new MultiEffect(Fx.bigShockwave, new WrapEffect(Fx.titanSmoke, Liquids.neoplasm.color), Fx.neoplasmSplat);
explodeSound = Sounds.explosionbig;
powerProduction = 100f;
rebuildable = false;
explosionPuddles = 80;
explosionPuddleRange = tilesize * 7f;
explosionPuddleLiquid = Liquids.neoplasm;
explosionPuddleAmount = 200f;
explosionMinWarmup = 0.5f;
consumeEffect = new RadialEffect(Fx.neoplasiaSmoke, 4, 90f, 54f / 4f);
drawer = new DrawMulti(
new DrawRegion("-bottom"),
new DrawLiquidTile(Liquids.arkycite, 3f),
new DrawCircles(){{
color = Color.valueOf("feb380").a(0.8f);
strokeMax = 3.25f;
radius = 65f / 4f;
amount = 5;
timeScl = 200f;
}},
new DrawRegion("-center"),
new DrawCells(){{
color = Color.valueOf("c33e2b");
particleColorFrom = Color.valueOf("e8803f");
particleColorTo = Color.valueOf("8c1225");
particles = 50;
range = 4f;
}},
new DrawDefault(),
new DrawHeatOutput(),
new DrawGlowRegion("-glow"){{
color = Color.valueOf("70170b");
alpha = 0.7f;
}}
);
}};
//endregion power
//region production

View file

@ -470,6 +470,26 @@ public class Fx{
}
}).layer(Layer.bullet - 1f),
neoplasmSplat = new Effect(400f, 300f, b -> {
float intensity = 3f;
color(Pal.neoplasm1);
for(int i = 0; i < 4; i++){
rand.setSeed(b.id*2 + i);
float lenScl = rand.random(0.5f, 1f);
int fi = i;
b.scaled(b.lifetime * lenScl, e -> {
randLenVectors(e.id + fi - 1, e.fin(Interp.pow10Out), (int)(5f * intensity), 22f * intensity, (x, y, in, out) -> {
float fout = e.fout(Interp.pow5Out) * rand.random(0.5f, 1f);
float rad = fout * ((2f + intensity) * 1.35f);
Fill.circle(e.x + x, e.y + y, rad);
Drawf.light(e.x + x, e.y + y, rad * 2.5f, b.color, 0.5f);
});
});
}
}).layer(Layer.bullet - 2f),
scatheExplosion = new Effect(60f, 160f, e -> {
color(e.color);
stroke(e.fout() * 5f);
@ -1698,6 +1718,21 @@ public class Fx{
}
}),
neoplasiaSmoke = new Effect(280f, e -> {
color(Pal.neoplasmMid);
alpha(0.6f);
rand.setSeed(e.id);
for(int i = 0; i < 6; i++){
float len = rand.random(10f), rot = rand.range(120f) + e.rotation;
e.scaled(e.lifetime * rand.random(0.3f, 1f), b -> {
v.trns(rot, len * b.finpow());
Fill.circle(e.x + v.x, e.y + v.y, 3.3f * b.fslope() + 0.2f);
});
}
}),
heatReactorSmoke = new Effect(180f, e -> {
color(Color.gray);

View file

@ -50,9 +50,9 @@ public class Liquids{
viscosity = 0.85f;
flammability = 0f;
capPuddles = false;
hidden = true;
spreadTarget = Liquids.water;
moveThroughBlocks = true;
incinerable = true;
colorFrom = Color.valueOf("e8803f");
colorTo = Color.valueOf("8c1225");

View file

@ -47,7 +47,7 @@ public class Rules{
public boolean schematicsAllowed = true;
/** Whether friendly explosions can occur and set fire/damage other blocks. */
public boolean damageExplosions = true;
/** Whether fire is enabled. */
/** Whether fire (and neoplasm spread) is enabled. */
public boolean fire = true;
/** Whether units use and require ammo. */
public boolean unitAmmo = false;

View file

@ -112,6 +112,7 @@ public class Pal{
neoplasmOutline = Color.valueOf("2e191d"),
neoplasm1 = Color.valueOf("f98f4a"),
neoplasmMid = Color.valueOf("e05438"),
neoplasm2 = Color.valueOf("9e172c"),
logicBlocks = Color.valueOf("d4816b"),

View file

@ -5,6 +5,7 @@ import arc.graphics.g2d.*;
import arc.math.*;
import arc.math.geom.*;
import arc.util.*;
import mindustry.*;
import mindustry.entities.*;
import mindustry.gen.*;
import mindustry.graphics.*;
@ -18,7 +19,7 @@ public class CellLiquid extends Liquid{
public int cells = 8;
public @Nullable Liquid spreadTarget;
public float maxSpread = 0.5f, spreadConversion = 0.5f, spreadDamage = 0.1f;
public float maxSpread = 0.5f, spreadConversion = 1f, spreadDamage = 0.1f, removeScaling = 0.25f;
public CellLiquid(String name, Color color){
super(name, color);
@ -30,20 +31,32 @@ public class CellLiquid extends Liquid{
@Override
public void update(Puddle puddle){
if(!Vars.state.rules.fire) return;
if(spreadTarget != null){
float scaling = Mathf.pow(Mathf.clamp(puddle.amount / maxLiquid), 2f);
for(var point : Geometry.d4c){
Tile tile = puddle.tile.nearby(point);
if(tile != null && tile.build != null && tile.build.liquids != null && tile.build.liquids.get(spreadTarget) > 0){
if(tile != null && tile.build != null && tile.build.liquids != null && tile.build.liquids.get(spreadTarget) > 0.0001f){
float amount = Math.min(tile.build.liquids.get(spreadTarget), maxSpread * Time.delta * scaling);
tile.build.liquids.remove(spreadTarget, amount);
tile.build.liquids.remove(spreadTarget, amount * removeScaling);
Puddles.deposit(tile, this, amount * spreadConversion);
}
}
//damage thing it is on
if(spreadDamage > 0 && puddle.tile.build != null && puddle.tile.build.liquids != null && puddle.tile.build.liquids.get(spreadTarget) > 0){
if(spreadDamage > 0 && puddle.tile.build != null && puddle.tile.build.liquids != null && puddle.tile.build.liquids.get(spreadTarget) > 0.0001f){
//spread in 4 adjacent directions around thing it is on
float amountSpread = Math.min(puddle.tile.build.liquids.get(spreadTarget) * spreadConversion, maxSpread * Time.delta) / 2f;
for(var dir : Geometry.d4){
Tile other = puddle.tile.nearby(dir);
if(other != null){
Puddles.deposit(puddle.tile, other, puddle.liquid, amountSpread);
}
}
puddle.tile.build.damage(spreadDamage * Time.delta * scaling);
}
@ -79,7 +92,7 @@ public class CellLiquid extends Liquid{
public void drawPuddle(Puddle puddle){
super.drawPuddle(puddle);
float baseLayer = puddle.tile != null && puddle.tile.build != null ? Layer.blockOver : Layer.debris - 0.5f;
float baseLayer = puddle.tile != null && puddle.tile.block().solid || puddle.tile.build != null ? Layer.blockOver : Layer.debris - 0.5f;
int id = puddle.id;
float amount = puddle.amount, x = puddle.x, y = puddle.y;

View file

@ -47,6 +47,8 @@ public class Liquid extends UnlockableContent implements Senseable{
public boolean coolant = true;
/** if true, this liquid can move through blocks as a puddle. */
public boolean moveThroughBlocks = false;
/** if true, this liquid can be incinerated in the incinerator block. */
public boolean incinerable = true;
/** The associated status effect. */
public StatusEffect effect = StatusEffects.none;
/** Effect shown in puddles. */

View 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();
}
}
}

View file

@ -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,6 +111,7 @@ public class PowerGenerator extends PowerDistributor{
}
public void createExplosion(){
if(warmup() >= explosionMinWarmup){
if(explosionDamage > 0){
Damage.damage(x, y, explosionRadius * tilesize, explosionDamage);
}
@ -129,6 +131,7 @@ public class PowerGenerator extends PowerDistributor{
Effect.shake(explosionShake, explosionShakeDuration, this);
}
}
}
@Override
public void drawLight(){

View file

@ -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;
}
}
}

View file

@ -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