diff --git a/core/src/mindustry/entities/Puddles.java b/core/src/mindustry/entities/Puddles.java index 40526baf05..aa7e5bde8d 100644 --- a/core/src/mindustry/entities/Puddles.java +++ b/core/src/mindustry/entities/Puddles.java @@ -1,7 +1,6 @@ package mindustry.entities; import arc.math.*; -import arc.struct.*; import arc.util.*; import mindustry.*; import mindustry.content.*; @@ -11,9 +10,9 @@ import mindustry.type.*; import mindustry.world.*; import mindustry.world.meta.*; -public class Puddles{ - private static final IntMap map = new IntMap<>(); +import static mindustry.Vars.*; +public class Puddles{ public static final float maxLiquid = 70f; /** Deposits a Puddle between tile and source. */ @@ -28,7 +27,7 @@ public class Puddles{ /** Returns the Puddle on the specified tile. May return null. */ public static Puddle get(Tile tile){ - return map.get(tile.pos()); + return world.tiles.puddle(tile.array()); } public static void deposit(Tile tile, Tile source, Liquid liquid, float amount, boolean initial){ @@ -57,7 +56,7 @@ public class Puddles{ if(tile.floor().isLiquid && !canStayOn(liquid, tile.floor().liquidDrop)){ reactPuddle(tile.floor().liquidDrop, liquid, amount, tile, ax, ay); - Puddle p = map.get(tile.pos()); + Puddle p = get(tile); if(initial && p != null && p.lastRipple <= Time.time - 40f){ Fx.ripple.at(ax, ay, 1f, tile.floor().liquidDrop.color); @@ -68,7 +67,7 @@ public class Puddles{ if(tile.floor().solid) return; - Puddle p = map.get(tile.pos()); + Puddle p = get(tile); if(p == null || p.liquid == null){ if(!Vars.net.client()){ //do not create puddles clientside as that destroys syncing @@ -77,7 +76,7 @@ public class Puddles{ puddle.liquid = liquid; puddle.amount = amount; puddle.set(ax, ay); - map.put(tile.pos(), puddle); + register(puddle); puddle.add(); } }else if(p.liquid == liquid){ @@ -101,11 +100,11 @@ public class Puddles{ public static void remove(Tile tile){ if(tile == null) return; - map.remove(tile.pos()); + world.tiles.setPuddle(tile.array(), null); } public static void register(Puddle puddle){ - map.put(puddle.tile().pos(), puddle); + world.tiles.setPuddle(puddle.tile().array(), puddle); } /** Reacts two liquids together at a location. */ diff --git a/core/src/mindustry/type/CellLiquid.java b/core/src/mindustry/type/CellLiquid.java index 957ffc6542..dd84e093d2 100644 --- a/core/src/mindustry/type/CellLiquid.java +++ b/core/src/mindustry/type/CellLiquid.java @@ -19,7 +19,7 @@ import static mindustry.entities.Puddles.*; /** Liquid that draws cells in its puddle. */ public class CellLiquid extends Liquid{ public Color colorFrom = Color.white.cpy(), colorTo = Color.white.cpy(); - public int cells = 8; + public int cells = 6; public @Nullable Liquid spreadTarget; public float maxSpread = 0.75f, spreadConversion = 1.2f, spreadDamage = 0.11f, removeScaling = 0.25f; @@ -122,7 +122,7 @@ public class CellLiquid extends Liquid{ Fill.circle( vx + Mathf.sin(Time.time + i * 532, sscl, smag), vy + Mathf.sin(Time.time + i * 53, sscl, smag), - f * 3.8f * rand.random(0.2f, 1f) * Mathf.absin(Time.time + ((i + id) % 60) * 54, 75f * rand.random(1f, 2f), 1f)); + f * 3.8f * rand.random(0.35f, 1f) * Mathf.absin(Time.time + ((i + id) % 60) * 54, 75f * rand.random(1f, 2f), 1f)); } Draw.color(); diff --git a/core/src/mindustry/world/Tiles.java b/core/src/mindustry/world/Tiles.java index 5f7b9d533f..37d8bd41d2 100644 --- a/core/src/mindustry/world/Tiles.java +++ b/core/src/mindustry/world/Tiles.java @@ -4,6 +4,7 @@ import arc.func.*; import arc.math.*; import arc.math.geom.*; import arc.util.*; +import mindustry.gen.*; import java.util.*; @@ -12,11 +13,21 @@ public class Tiles implements Iterable{ public final int width, height; final Tile[] array; + final Puddle[] puddles; public Tiles(int width, int height){ this.array = new Tile[width * height]; this.width = width; this.height = height; + this.puddles = new Puddle[width * height]; + } + + public Puddle puddle(int pos){ + return puddles[pos]; + } + + public void setPuddle(int pos, Puddle p){ + puddles[pos] = p; } public void each(Intc2 cons){ diff --git a/gradle.properties b/gradle.properties index 70ba79f907..8c6264f749 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,4 +25,4 @@ org.gradle.caching=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=8deb453b78 +archash=ea8fa3b50d