diff --git a/core/src/mindustry/content/Liquids.java b/core/src/mindustry/content/Liquids.java index e07fd7e137..e063e82419 100644 --- a/core/src/mindustry/content/Liquids.java +++ b/core/src/mindustry/content/Liquids.java @@ -48,8 +48,9 @@ public class Liquids implements ContentList{ neoplasm = new CellLiquid("neoplasm", Color.valueOf("e05438")){{ heatCapacity = 0.4f; temperature = 0.54f; - viscosity = 0.65f; + viscosity = 0.85f; flammability = 0.1f; + capPuddles = false; colorFrom = Color.valueOf("f98f4a"); colorTo = Color.valueOf("9e172c"); diff --git a/core/src/mindustry/entities/abilities/LiquidExplodeAbility.java b/core/src/mindustry/entities/abilities/LiquidExplodeAbility.java new file mode 100644 index 0000000000..dd90e06740 --- /dev/null +++ b/core/src/mindustry/entities/abilities/LiquidExplodeAbility.java @@ -0,0 +1,37 @@ +package mindustry.entities.abilities; + +import arc.math.*; +import arc.util.noise.*; +import mindustry.content.*; +import mindustry.entities.*; +import mindustry.gen.*; +import mindustry.type.*; +import mindustry.world.*; + +import static mindustry.Vars.*; + +public class LiquidExplodeAbility extends Ability{ + public Liquid liquid = Liquids.water; + public float amount = 120f; + public float radAmountScale = 5f, radScale = 1f; + public float noiseMag = 6.5f, noiseScl = 5f; + + @Override + public void death(Unit unit){ + int tx = unit.tileX(), ty = unit.tileY(); + int rad = (int)(unit.hitSize / tilesize * radScale); + float realNoise = unit.hitSize / noiseMag; + for(int x = -rad; x <= rad; x++){ + for(int y = -rad; y <= rad; y++){ + if(x*x + y*y <= rad*rad - Simplex.noise2d(0, 2, 0.5f, 1f / noiseScl, x + tx, y + ty) * realNoise * realNoise){ + float scaling = (1f - Mathf.dst(x, y) / rad) * radAmountScale; + + Tile tile = world.tile(tx + x, ty + y); + if(tile != null){ + Puddles.deposit(tile, liquid, amount * scaling); + } + } + } + } + } +} diff --git a/core/src/mindustry/entities/comp/PuddleComp.java b/core/src/mindustry/entities/comp/PuddleComp.java index af703fffaf..9d42b43cb9 100644 --- a/core/src/mindustry/entities/comp/PuddleComp.java +++ b/core/src/mindustry/entities/comp/PuddleComp.java @@ -20,7 +20,6 @@ import static mindustry.entities.Puddles.*; @Component(base = true) abstract class PuddleComp implements Posc, Puddlec, Drawc{ private static final Rect rect = new Rect(), rect2 = new Rect(); - private static int seeds; private static Puddle paramPuddle; private static Cons unitCons = unit -> { @@ -70,7 +69,9 @@ abstract class PuddleComp implements Posc, Puddlec, Drawc{ amount -= deposited * targets; } - amount = Mathf.clamp(amount, 0, maxLiquid); + if(liquid.capPuddles){ + amount = Mathf.clamp(amount, 0, maxLiquid); + } if(amount <= 0f){ remove(); @@ -108,6 +109,8 @@ abstract class PuddleComp implements Posc, Puddlec, Drawc{ } updateTime -= Time.delta; + + liquid.update(self()); } @Override diff --git a/core/src/mindustry/type/CellLiquid.java b/core/src/mindustry/type/CellLiquid.java index 72c5744670..c9d276059d 100644 --- a/core/src/mindustry/type/CellLiquid.java +++ b/core/src/mindustry/type/CellLiquid.java @@ -35,6 +35,7 @@ public class CellLiquid extends Liquid{ rand.setSeed(id); for(int i = 0; i < cells; i++){ + Draw.z(Layer.debris - 0.5f + i/1000f + (id % 100) / 10000f); Tmp.v1.trns(rand.random(360f), rand.random(length)); float vx = x + Tmp.v1.x, vy = y + Tmp.v1.y; diff --git a/core/src/mindustry/type/Liquid.java b/core/src/mindustry/type/Liquid.java index f306ef86ca..fdf17b06fe 100644 --- a/core/src/mindustry/type/Liquid.java +++ b/core/src/mindustry/type/Liquid.java @@ -43,6 +43,8 @@ public class Liquid extends UnlockableContent{ public float particleSpacing = 60f; /** Temperature at which this liquid vaporizes. This isn't just boiling. */ public float boilPoint = 2f; + /** If true, puddle size is capped. */ + public boolean capPuddles = true; /** Effect when this liquid vaporizes. */ public Effect vaporEffect = Fx.vapor; @@ -97,6 +99,11 @@ public class Liquid extends UnlockableContent{ } } + /** Runs when puddles update. */ + public void update(Puddle puddle){ + + } + @Override public void setStats(){ stats.addPercent(Stat.explosiveness, explosiveness); diff --git a/core/src/mindustry/type/NeoplasmUnitType.java b/core/src/mindustry/type/NeoplasmUnitType.java index dd43246ae4..992850765f 100644 --- a/core/src/mindustry/type/NeoplasmUnitType.java +++ b/core/src/mindustry/type/NeoplasmUnitType.java @@ -18,11 +18,14 @@ public class NeoplasmUnitType extends UnitType{ percentAmount = 1f / (30f * 60f) * 100f; }}); + abilities.add(new LiquidExplodeAbility(){{ + liquid = Liquids.neoplasm; + }}); + //green flashing is unnecessary since they always regen showHeal = false; //TODO //- liquid regen ability - //- liquid/neoplasm explode ability } }