mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-28 07:22:21 -08:00
Added support for non-reactive liquids
This commit is contained in:
parent
8f4251db3a
commit
fb24953dc2
3 changed files with 16 additions and 11 deletions
|
|
@ -54,6 +54,7 @@ public class Liquids{
|
|||
spreadTarget = Liquids.water;
|
||||
moveThroughBlocks = true;
|
||||
incinerable = true;
|
||||
blockReactive = false;
|
||||
canStayOn.addAll(water, oil, cryofluid);
|
||||
|
||||
colorFrom = Color.valueOf("e8803f");
|
||||
|
|
|
|||
|
|
@ -855,17 +855,19 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||
float fx = (x + next.x) / 2f, fy = (y + next.y) / 2f;
|
||||
|
||||
Liquid other = next.liquids.current();
|
||||
//TODO liquid reaction handler for extensibility
|
||||
if((other.flammability > 0.3f && liquid.temperature > 0.7f) || (liquid.flammability > 0.3f && other.temperature > 0.7f)){
|
||||
damageContinuous(1);
|
||||
next.damageContinuous(1);
|
||||
if(Mathf.chanceDelta(0.1)){
|
||||
Fx.fire.at(fx, fy);
|
||||
}
|
||||
}else if((liquid.temperature > 0.7f && other.temperature < 0.55f) || (other.temperature > 0.7f && liquid.temperature < 0.55f)){
|
||||
liquids.remove(liquid, Math.min(liquids.get(liquid), 0.7f * Time.delta));
|
||||
if(Mathf.chanceDelta(0.2f)){
|
||||
Fx.steam.at(fx, fy);
|
||||
if(other.blockReactive && liquid.blockReactive){
|
||||
//TODO liquid reaction handler for extensibility
|
||||
if((other.flammability > 0.3f && liquid.temperature > 0.7f) || (liquid.flammability > 0.3f && other.temperature > 0.7f)){
|
||||
damageContinuous(1);
|
||||
next.damageContinuous(1);
|
||||
if(Mathf.chanceDelta(0.1)){
|
||||
Fx.fire.at(fx, fy);
|
||||
}
|
||||
}else if((liquid.temperature > 0.7f && other.temperature < 0.55f) || (other.temperature > 0.7f && liquid.temperature < 0.55f)){
|
||||
liquids.remove(liquid, Math.min(liquids.get(liquid), 0.7f * Time.delta));
|
||||
if(Mathf.chanceDelta(0.2f)){
|
||||
Fx.steam.at(fx, fy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ public class Liquid extends UnlockableContent implements Senseable{
|
|||
public float viscosity = 0.5f;
|
||||
/** how prone to exploding this liquid is, when heated. 0 = nothing, 1 = nuke */
|
||||
public float explosiveness;
|
||||
/** whether this fluid reacts in blocks at all (e.g. slag with water) */
|
||||
public boolean blockReactive = true;
|
||||
/** if false, this liquid cannot be a coolant */
|
||||
public boolean coolant = true;
|
||||
/** if true, this liquid can move through blocks as a puddle. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue