mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-09 20:29:06 +07:00
Boiling point implementation
This commit is contained in:
parent
a39f2bd3a9
commit
90826b7064
@ -900,6 +900,24 @@ public class Fx{
|
||||
});
|
||||
}),
|
||||
|
||||
vapor = new Effect(110f, e -> {
|
||||
color(e.color);
|
||||
alpha(e.fout());
|
||||
|
||||
randLenVectors(e.id, 3, 2f + e.finpow() * 11f, (x, y) -> {
|
||||
Fill.circle(e.x + x, e.y + y, 0.6f + e.fin() * 5f);
|
||||
});
|
||||
}),
|
||||
|
||||
vaporSmall = new Effect(50f, e -> {
|
||||
color(e.color);
|
||||
alpha(e.fout());
|
||||
|
||||
randLenVectors(e.id, 4, 2f + e.finpow() * 5f, (x, y) -> {
|
||||
Fill.circle(e.x + x, e.y + y, 1f + e.fin() * 4f);
|
||||
});
|
||||
}),
|
||||
|
||||
fireballsmoke = new Effect(25f, e -> {
|
||||
color(Color.gray);
|
||||
|
||||
|
@ -14,6 +14,8 @@ public class Liquids implements ContentList{
|
||||
heatCapacity = 0.4f;
|
||||
alwaysUnlocked = true;
|
||||
effect = StatusEffects.wet;
|
||||
boilPoint = 0.5f;
|
||||
gasColor = Color.grays(0.9f);
|
||||
}};
|
||||
|
||||
slag = new Liquid("slag", Color.valueOf("ffa166")){{
|
||||
|
@ -32,6 +32,13 @@ public class Puddles{
|
||||
public static void deposit(Tile tile, Tile source, Liquid liquid, float amount, boolean initial){
|
||||
if(tile == null) return;
|
||||
|
||||
if(liquid.willBoil()){
|
||||
if(Mathf.chanceDelta(0.16f)){
|
||||
liquid.vaporEffect.at((tile.worldx() + source.worldx()) / 2f, (tile.worldy() + source.worldy()) / 2f, liquid.gasColor);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(tile.floor().isLiquid && !canStayOn(liquid, tile.floor().liquidDrop)){
|
||||
reactPuddle(tile.floor().liquidDrop, liquid, amount, tile,
|
||||
(tile.worldx() + source.worldx()) / 2f, (tile.worldy() + source.worldy()) / 2f);
|
||||
|
@ -2,6 +2,7 @@ package mindustry.entities.bullet;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
@ -16,6 +17,7 @@ public class LiquidBulletType extends BulletType{
|
||||
public Liquid liquid;
|
||||
public float puddleSize = 6f;
|
||||
public float orbSize = 3f;
|
||||
public float boilTime = 15f;
|
||||
|
||||
public LiquidBulletType(@Nullable Liquid liquid){
|
||||
super(3.5f, 0);
|
||||
@ -52,6 +54,12 @@ public class LiquidBulletType extends BulletType{
|
||||
public void update(Bullet b){
|
||||
super.update(b);
|
||||
|
||||
if(liquid.willBoil() && b.time >= Mathf.randomSeed(b.id, boilTime)){
|
||||
Fx.vaporSmall.at(b.x, b.y, liquid.gasColor);
|
||||
b.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(liquid.canExtinguish()){
|
||||
Tile tile = world.tileWorld(b.x, b.y);
|
||||
if(tile != null && Fires.has(tile.x, tile.y)){
|
||||
@ -65,8 +73,14 @@ public class LiquidBulletType extends BulletType{
|
||||
@Override
|
||||
public void draw(Bullet b){
|
||||
super.draw(b);
|
||||
Draw.color(liquid.color, Color.white, b.fout() / 100f);
|
||||
Fill.circle(b.x, b.y, orbSize);
|
||||
if(liquid.willBoil()){
|
||||
Draw.color(liquid.color, Tmp.c3.set(liquid.gasColor).a(0.4f), b.time / Mathf.randomSeed(b.id, boilTime));
|
||||
Fill.circle(b.x, b.y, orbSize * (b.fin() * 1.1f + 1f));
|
||||
}else{
|
||||
Draw.color(liquid.color, Color.white, b.fout() / 100f);
|
||||
Fill.circle(b.x, b.y, orbSize);
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@ -75,7 +89,9 @@ public class LiquidBulletType extends BulletType{
|
||||
super.despawned(b);
|
||||
|
||||
//don't create liquids when the projectile despawns
|
||||
hitEffect.at(b.x, b.y, b.rotation(), liquid.color);
|
||||
if(!liquid.willBoil()){
|
||||
hitEffect.at(b.x, b.y, b.rotation(), liquid.color);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,6 +19,8 @@ public class Liquid extends UnlockableContent{
|
||||
|
||||
/** Color used in pipes and on the ground. */
|
||||
public Color color;
|
||||
/** Color of this liquid in gas form. */
|
||||
public Color gasColor = Color.lightGray.cpy();
|
||||
/** Color used in bars. */
|
||||
public @Nullable Color barColor;
|
||||
/** Color used to draw lights. Note that the alpha channel is used to dictate brightness. */
|
||||
@ -39,6 +41,10 @@ public class Liquid extends UnlockableContent{
|
||||
public Effect particleEffect = Fx.none;
|
||||
/** Particle effect rate spacing in ticks. */
|
||||
public float particleSpacing = 60f;
|
||||
/** Temperature at which this liquid vaporizes. This isn't just boiling. */
|
||||
public float boilPoint = 2f;
|
||||
/** Effect when this liquid vaporizes. */
|
||||
public Effect vaporEffect = Fx.vapor;
|
||||
|
||||
public Liquid(String name, Color color){
|
||||
super(name);
|
||||
@ -50,6 +56,11 @@ public class Liquid extends UnlockableContent{
|
||||
this(name, new Color(Color.black));
|
||||
}
|
||||
|
||||
/** @return true if this liquid will boil in this global environment. */
|
||||
public boolean willBoil(){
|
||||
return Attribute.heat.env() >= boilPoint;
|
||||
}
|
||||
|
||||
public boolean canExtinguish(){
|
||||
return flammability < 0.1f && temperature <= 0.5f;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user