Added support for non-reactive liquids

This commit is contained in:
Anuken
2022-08-31 08:08:07 -04:00
parent 8f4251db3a
commit fb24953dc2
3 changed files with 16 additions and 11 deletions

View File

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