mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-09 07:17:36 +07:00
Fixed #5725
This commit is contained in:
@ -54,8 +54,8 @@ public class Puddles{
|
||||
puddle.liquid = liquid;
|
||||
puddle.amount = amount;
|
||||
puddle.set((tile.worldx() + source.worldx()) / 2f, (tile.worldy() + source.worldy()) / 2f);
|
||||
puddle.add();
|
||||
map.put(tile.pos(), puddle);
|
||||
puddle.add();
|
||||
}else if(p.liquid == liquid){
|
||||
p.accepting = Math.max(amount, p.accepting);
|
||||
|
||||
|
@ -41,6 +41,7 @@ abstract class PuddleComp implements Posc, Puddlec, Drawc{
|
||||
@Import int id;
|
||||
@Import float x, y;
|
||||
|
||||
transient private boolean mismatch = false;
|
||||
transient float accepting, updateTime, lastRipple = Time.time + Mathf.random(40f);
|
||||
float amount;
|
||||
Tile tile;
|
||||
@ -73,8 +74,15 @@ abstract class PuddleComp implements Posc, Puddlec, Drawc{
|
||||
|
||||
amount = Mathf.clamp(amount, 0, maxLiquid);
|
||||
|
||||
if(amount <= 0f || Puddles.get(tile) != self()){
|
||||
if(amount <= 0f){
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if(Puddles.get(tile) != self()){
|
||||
mismatch = true;
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
//effects-only code
|
||||
@ -83,7 +91,7 @@ abstract class PuddleComp implements Posc, Puddlec, Drawc{
|
||||
|
||||
Units.nearby(rect.setSize(Mathf.clamp(amount / (maxLiquid / 1.5f)) * 10f).setCenter(x, y), unitCons);
|
||||
|
||||
if(liquid.temperature > 0.7f && (tile.build != null) && Mathf.chance(0.5)){
|
||||
if(liquid.temperature > 0.7f && tile.build != null && Mathf.chance(0.5)){
|
||||
Fires.create(tile);
|
||||
}
|
||||
|
||||
@ -126,7 +134,9 @@ abstract class PuddleComp implements Posc, Puddlec, Drawc{
|
||||
|
||||
@Override
|
||||
public void remove(){
|
||||
Puddles.remove(tile);
|
||||
if(!mismatch){
|
||||
Puddles.remove(tile);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -215,10 +215,11 @@ public class PlanetRenderer implements Disposable{
|
||||
}
|
||||
|
||||
public void drawArc(Planet planet, Vec3 a, Vec3 b, Color from, Color to, float length, float timeScale, int pointCount){
|
||||
//increase curve height when on opposite side of planet, so it doesn't tunnel through
|
||||
float dot = 1f - (Tmp.v32.set(a).nor().dot(Tmp.v33.set(b).nor()) + 1f)/2f;
|
||||
|
||||
Vec3 avg = Tmp.v31.set(b).add(a).scl(0.5f);
|
||||
avg.setLength(planet.radius*(1f+length) + dot * 1.3f);
|
||||
avg.setLength(planet.radius*(1f+length) + dot * 1.35f);
|
||||
|
||||
points.clear();
|
||||
points.addAll(Tmp.v33.set(b).setLength(outlineRad), Tmp.v31, Tmp.v34.set(a).setLength(outlineRad));
|
||||
|
@ -408,7 +408,8 @@ public abstract class SaveVersion extends SaveFileReader{
|
||||
|
||||
for(int j = 0; j < total; j++){
|
||||
String name = stream.readUTF();
|
||||
map[type.ordinal()][j] = content.getByName(type, fallback.get(name, name));
|
||||
//fallback only for blocks
|
||||
map[type.ordinal()][j] = content.getByName(type, type == ContentType.block ? fallback.get(name, name) : name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class Pump extends LiquidBlock{
|
||||
public void draw(){
|
||||
Draw.rect(name, x, y);
|
||||
|
||||
Drawf.liquid(liquidRegion, x, y, liquids.total() / liquidCapacity, liquids.current().color);
|
||||
Drawf.liquid(liquidRegion, x, y, liquids.currentAmount() / liquidCapacity, liquids.current().color);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -143,11 +143,12 @@ public class LiquidModule extends BlockModule{
|
||||
int count = legacy ? read.ub() : read.s();
|
||||
|
||||
for(int j = 0; j < count; j++){
|
||||
int liquidid = legacy ? read.ub() : read.s();
|
||||
Liquid liq = content.liquid(legacy ? read.ub() : read.s());
|
||||
int liquidid = liq.id;
|
||||
float amount = read.f();
|
||||
liquids[liquidid] = amount;
|
||||
if(amount > 0){
|
||||
current = content.liquid(liquidid);
|
||||
current = liq;
|
||||
}
|
||||
this.total += amount;
|
||||
}
|
||||
|
@ -8,4 +8,4 @@ kapt.include.compile.classpath=false
|
||||
kotlin.stdlib.default.dependency=false
|
||||
#needed for android compilation
|
||||
android.useAndroidX=true
|
||||
archash=28f7dea17ba559a28e79111adc93cf0496ced031
|
||||
archash=40c21b302ccc1e74f4c2a37f937c88acaec99254
|
||||
|
Reference in New Issue
Block a user