diff --git a/core/assets/sprites/sprites.atlas b/core/assets/sprites/sprites.atlas index e888fe8d2a..4b9a2411b7 100644 --- a/core/assets/sprites/sprites.atlas +++ b/core/assets/sprites/sprites.atlas @@ -426,133 +426,133 @@ plastanium-conveyor-stack index: -1 titanium-conveyor-0-1 rotate: false - xy: 1207, 331 + xy: 1343, 433 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-0-2 rotate: false - xy: 1241, 365 + xy: 1139, 195 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-0-3 rotate: false - xy: 1275, 399 + xy: 1173, 229 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-1-0 rotate: false - xy: 1309, 433 + xy: 1207, 263 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-1-1 rotate: false - xy: 1343, 467 + xy: 1241, 297 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-1-2 rotate: false - xy: 1105, 195 + xy: 1275, 331 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-1-3 rotate: false - xy: 1139, 229 + xy: 1309, 365 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-2-0 rotate: false - xy: 1173, 263 + xy: 1343, 399 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-2-1 rotate: false - xy: 1207, 297 + xy: 1173, 195 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-2-2 rotate: false - xy: 1241, 331 + xy: 1207, 229 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-2-3 rotate: false - xy: 1275, 365 + xy: 1241, 263 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-3-0 rotate: false - xy: 1309, 399 + xy: 1275, 297 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-3-1 rotate: false - xy: 1343, 433 + xy: 1309, 331 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-3-2 rotate: false - xy: 1139, 195 + xy: 1343, 365 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-3-3 rotate: false - xy: 1173, 229 + xy: 1207, 195 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-4-0 rotate: false - xy: 1207, 263 + xy: 1241, 229 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-4-1 rotate: false - xy: 1241, 297 + xy: 1275, 263 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-4-2 rotate: false - xy: 1275, 331 + xy: 1309, 297 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 titanium-conveyor-4-3 rotate: false - xy: 1309, 365 + xy: 1343, 331 size: 32, 32 orig: 32, 32 offset: 0, 0 @@ -664,7 +664,7 @@ sorter index: -1 underflow-gate rotate: false - xy: 1207, 229 + xy: 1309, 263 size: 32, 32 orig: 32, 32 offset: 0, 0 @@ -1222,6 +1222,13 @@ pulse-conduit-top-6 orig: 32, 32 offset: 0, 0 index: -1 +pump-liquid + rotate: false + xy: 1105, 297 + size: 32, 32 + orig: 32, 32 + offset: 0, 0 + index: -1 rotary-pump rotate: false xy: 1867, 975 @@ -1747,13 +1754,6 @@ pulverizer-rotator orig: 32, 32 offset: 0, 0 index: -1 -pump-liquid - rotate: false - xy: 1105, 297 - size: 32, 32 - orig: 32, 32 - offset: 0, 0 - index: -1 pyratite-mixer rotate: false xy: 1801, 975 @@ -1966,14 +1966,14 @@ launch-pad-large index: -1 unloader rotate: false - xy: 1241, 263 + xy: 1343, 297 size: 32, 32 orig: 32, 32 offset: 0, 0 index: -1 unloader-center rotate: false - xy: 1275, 297 + xy: 1275, 195 size: 32, 32 orig: 32, 32 offset: 0, 0 @@ -2435,7 +2435,7 @@ scrap-wall5 index: -1 surge-wall rotate: false - xy: 1139, 263 + xy: 1275, 365 size: 32, 32 orig: 32, 32 offset: 0, 0 @@ -2449,7 +2449,7 @@ surge-wall-large index: -1 thorium-wall rotate: false - xy: 1173, 297 + xy: 1309, 399 size: 32, 32 orig: 32, 32 offset: 0, 0 @@ -2470,7 +2470,7 @@ thruster index: -1 titanium-wall rotate: false - xy: 1343, 399 + xy: 1241, 195 size: 32, 32 orig: 32, 32 offset: 0, 0 @@ -2610,7 +2610,7 @@ transfer index: -1 transfer-arrow rotate: false - xy: 1173, 195 + xy: 1275, 229 size: 32, 32 orig: 32, 32 offset: 0, 0 @@ -3744,7 +3744,7 @@ item-metaglass-medium index: -1 item-metaglass-small rotate: false - xy: 1309, 339 + xy: 1309, 237 size: 24, 24 orig: 24, 24 offset: 0, 0 @@ -3779,7 +3779,7 @@ item-phase-fabric-medium index: -1 item-phase-fabric-small rotate: false - xy: 1343, 373 + xy: 1343, 271 size: 24, 24 orig: 24, 24 offset: 0, 0 @@ -3814,7 +3814,7 @@ item-plastanium-medium index: -1 item-plastanium-small rotate: false - xy: 1207, 203 + xy: 1689, 1445 size: 24, 24 orig: 24, 24 offset: 0, 0 @@ -3849,7 +3849,7 @@ item-pyratite-medium index: -1 item-pyratite-small rotate: false - xy: 1241, 237 + xy: 1309, 211 size: 24, 24 orig: 24, 24 offset: 0, 0 @@ -3884,7 +3884,7 @@ item-sand-medium index: -1 item-sand-small rotate: false - xy: 1275, 271 + xy: 1381, 501 size: 24, 24 orig: 24, 24 offset: 0, 0 @@ -3919,7 +3919,7 @@ item-scrap-medium index: -1 item-scrap-small rotate: false - xy: 1689, 1445 + xy: 1377, 475 size: 24, 24 orig: 24, 24 offset: 0, 0 @@ -3954,7 +3954,7 @@ item-silicon-medium index: -1 item-silicon-small rotate: false - xy: 1309, 313 + xy: 1407, 501 size: 24, 24 orig: 24, 24 offset: 0, 0 @@ -3989,14 +3989,14 @@ item-spore-pod-medium index: -1 item-spore-pod-small rotate: false - xy: 1381, 501 + xy: 1377, 449 size: 24, 24 orig: 24, 24 offset: 0, 0 index: -1 item-spore-pod-tiny rotate: false - xy: 1377, 405 + xy: 1377, 353 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -4024,14 +4024,14 @@ item-surge-alloy-medium index: -1 item-surge-alloy-small rotate: false - xy: 1377, 475 + xy: 1403, 475 size: 24, 24 orig: 24, 24 offset: 0, 0 index: -1 item-surge-alloy-tiny rotate: false - xy: 866, 1609 + xy: 1403, 379 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -4059,14 +4059,14 @@ item-thorium-medium index: -1 item-thorium-small rotate: false - xy: 1407, 501 + xy: 1377, 423 size: 24, 24 orig: 24, 24 offset: 0, 0 index: -1 item-thorium-tiny rotate: false - xy: 786, 1406 + xy: 866, 1609 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -4094,14 +4094,14 @@ item-titanium-medium index: -1 item-titanium-small rotate: false - xy: 1377, 449 + xy: 1403, 449 size: 24, 24 orig: 24, 24 offset: 0, 0 index: -1 item-titanium-tiny rotate: false - xy: 955, 1479 + xy: 786, 1406 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -4136,14 +4136,14 @@ liquid-cryofluid-medium index: -1 liquid-cryofluid-small rotate: false - xy: 1403, 475 + xy: 1377, 397 size: 24, 24 orig: 24, 24 offset: 0, 0 index: -1 liquid-cryofluid-tiny rotate: false - xy: 982, 1340 + xy: 955, 1479 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -4171,14 +4171,14 @@ liquid-oil-medium index: -1 liquid-oil-small rotate: false - xy: 1377, 423 + xy: 1403, 423 size: 24, 24 orig: 24, 24 offset: 0, 0 index: -1 liquid-oil-tiny rotate: false - xy: 985, 814 + xy: 982, 1340 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -4206,14 +4206,14 @@ liquid-slag-medium index: -1 liquid-slag-small rotate: false - xy: 1403, 449 + xy: 1377, 371 size: 24, 24 orig: 24, 24 offset: 0, 0 index: -1 liquid-slag-tiny rotate: false - xy: 1395, 405 + xy: 985, 814 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -4241,14 +4241,14 @@ liquid-water-medium index: -1 liquid-water-small rotate: false - xy: 1403, 423 + xy: 1403, 397 size: 24, 24 orig: 24, 24 offset: 0, 0 index: -1 liquid-water-tiny rotate: false - xy: 884, 1609 + xy: 1377, 335 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -4316,6 +4316,90 @@ spectre orig: 128, 128 offset: 0, 0 index: -1 +splash-0 + rotate: false + xy: 1139, 263 + size: 32, 32 + orig: 32, 32 + offset: 0, 0 + index: -1 +splash-1 + rotate: false + xy: 1173, 297 + size: 32, 32 + orig: 32, 32 + offset: 0, 0 + index: -1 +splash-10 + rotate: false + xy: 1207, 297 + size: 32, 32 + orig: 32, 32 + offset: 0, 0 + index: -1 +splash-11 + rotate: false + xy: 1241, 331 + size: 32, 32 + orig: 32, 32 + offset: 0, 0 + index: -1 +splash-2 + rotate: false + xy: 1207, 331 + size: 32, 32 + orig: 32, 32 + offset: 0, 0 + index: -1 +splash-3 + rotate: false + xy: 1241, 365 + size: 32, 32 + orig: 32, 32 + offset: 0, 0 + index: -1 +splash-4 + rotate: false + xy: 1275, 399 + size: 32, 32 + orig: 32, 32 + offset: 0, 0 + index: -1 +splash-5 + rotate: false + xy: 1309, 433 + size: 32, 32 + orig: 32, 32 + offset: 0, 0 + index: -1 +splash-6 + rotate: false + xy: 1343, 467 + size: 32, 32 + orig: 32, 32 + offset: 0, 0 + index: -1 +splash-7 + rotate: false + xy: 1105, 195 + size: 32, 32 + orig: 32, 32 + offset: 0, 0 + index: -1 +splash-8 + rotate: false + xy: 1139, 229 + size: 32, 32 + orig: 32, 32 + offset: 0, 0 + index: -1 +splash-9 + rotate: false + xy: 1173, 263 + size: 32, 32 + orig: 32, 32 + offset: 0, 0 + index: -1 swarmer rotate: false xy: 1009, 807 diff --git a/core/assets/sprites/sprites.png b/core/assets/sprites/sprites.png index 36f52cb659..4b0eab80a2 100644 Binary files a/core/assets/sprites/sprites.png and b/core/assets/sprites/sprites.png differ diff --git a/core/assets/sprites/sprites2.png b/core/assets/sprites/sprites2.png index be00effaf8..c8703c3cf3 100644 Binary files a/core/assets/sprites/sprites2.png and b/core/assets/sprites/sprites2.png differ diff --git a/core/src/mindustry/content/Weathers.java b/core/src/mindustry/content/Weathers.java index e7c13e9e1a..f5d6fedee5 100644 --- a/core/src/mindustry/content/Weathers.java +++ b/core/src/mindustry/content/Weathers.java @@ -8,6 +8,7 @@ import arc.util.*; import mindustry.ctype.*; import mindustry.gen.*; import mindustry.type.*; +import mindustry.world.*; import static mindustry.Vars.*; @@ -30,7 +31,7 @@ public class Weathers implements ContentList{ } @Override - public void draw(Weatherc state){ + public void drawOver(Weatherc state){ rand.setSeed(0); Tmp.r1.setCentered(Core.camera.position.x, Core.camera.position.y, Core.graphics.getWidth() / renderer.minScale(), Core.graphics.getHeight() / renderer.minScale()); Tmp.r1.grow(padding); @@ -62,10 +63,19 @@ public class Weathers implements ContentList{ rain = new Weather("rain"){ float yspeed = 7f, xspeed = 2f, padding = 16f, size = 40f, density = 1000f; + TextureRegion[] splashes = new TextureRegion[12]; @Override - public void draw(Weatherc state){ - rand.setSeed(0); + public void load(){ + super.load(); + + for(int i = 0; i < splashes.length; i++){ + splashes[i] = Core.atlas.find("splash-" + i); + } + } + + @Override + public void drawOver(Weatherc state){ Tmp.r1.setCentered(Core.camera.position.x, Core.camera.position.y, Core.graphics.getWidth() / renderer.minScale(), Core.graphics.getHeight() / renderer.minScale()); Tmp.r1.grow(padding); Core.camera.bounds(Tmp.r2); @@ -95,6 +105,43 @@ public class Weathers implements ContentList{ } } } + + @Override + public void drawUnder(Weatherc state){ + Tmp.r1.setCentered(Core.camera.position.x, Core.camera.position.y, Core.graphics.getWidth() / renderer.minScale(), Core.graphics.getHeight() / renderer.minScale()); + Tmp.r1.grow(padding); + Core.camera.bounds(Tmp.r2); + int total = (int)(Tmp.r1.area() / density * state.intensity()) / 2; + + float t = Time.time() / 22f; + + for(int i = 0; i < total; i++){ + float offset = rand.random(0f, 1f); + float time = t + offset; + + int pos = (int)((time)); + float life = time % 1f; + float x = (rand.random(0f, world.unitWidth()) + pos*953); + float y = (rand.random(0f, world.unitHeight()) - pos*453); + + x -= Tmp.r1.x; + y -= Tmp.r1.y; + x = Mathf.mod(x, Tmp.r1.width); + y = Mathf.mod(y, Tmp.r1.height); + x += Tmp.r1.x; + y += Tmp.r1.y; + + if(Tmp.r3.setCentered(x, y, life * 4f).overlaps(Tmp.r2)){ + Tile tile = world.tileWorld(x, y); + if(tile != null && tile.floor().liquidDrop == Liquids.water){ + Draw.tint(Tmp.c1.set(tile.floor().mapColor).mul(1.5f)); + Draw.rect(splashes[(int)(life * (splashes.length - 1))], x, y); + //Lines.stroke((1f - life) * 2f); + //Lines.circle(x, y, life * 4f); + } + } + } + } }; } } diff --git a/core/src/mindustry/entities/def/TileComp.java b/core/src/mindustry/entities/def/TileComp.java index b1ded3f0ee..2ccdccbb36 100644 --- a/core/src/mindustry/entities/def/TileComp.java +++ b/core/src/mindustry/entities/def/TileComp.java @@ -196,12 +196,24 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree public byte absoluteRelativeTo(int cx, int cy){ int x = tile.x, y = tile.y; - if(Math.abs(x - cx) > Math.abs(y - cy)){ - if(x <= cx - 1) return 0; - if(x >= cx + 1) return 2; - }else{ - if(y <= cy - 1) return 1; - if(y >= cy + 1) return 3; + + //very straightforward for odd sizes + if(block.size % 2 == 1){ + if(Math.abs(x - cx) > Math.abs(y - cy)){ + if(x <= cx - 1) return 0; + if(x >= cx + 1) return 2; + }else{ + if(y <= cy - 1) return 1; + if(y >= cy + 1) return 3; + } + }else{ //need offsets here + if(Math.abs(x - cx + 0.5f) > Math.abs(y - cy + 0.5f)){ + if(x+0.5f <= cx - 1) return 0; + if(x+0.5f >= cx + 1) return 2; + }else{ + if(y+0.5f <= cy - 1) return 1; + if(y+0.5f >= cy + 1) return 3; + } } return -1; diff --git a/core/src/mindustry/type/Weather.java b/core/src/mindustry/type/Weather.java index 8952756e0d..cdcaad0733 100644 --- a/core/src/mindustry/type/Weather.java +++ b/core/src/mindustry/type/Weather.java @@ -16,8 +16,8 @@ public abstract class Weather extends MappableContent{ public float duration = 15f * Time.toMinutes; //internals - protected Rand rand = new Rand(); - protected Prov type = WeatherEntity::create; + public Rand rand = new Rand(); + public Prov type = WeatherEntity::create; public Weather(String name, Prov type){ super(name); @@ -58,7 +58,11 @@ public abstract class Weather extends MappableContent{ } - public void draw(Weatherc state){ + public void drawOver(Weatherc state){ + + } + + public void drawUnder(Weatherc state){ } @@ -105,7 +109,7 @@ public abstract class Weather extends MappableContent{ @EntityDef(value = {Weatherc.class}, pooled = true, isFinal = false) @Component - abstract class WeatherComp implements Drawc{ + abstract static class WeatherComp implements Drawc{ private static final float fadeTime = 60 * 4; Weather weather; @@ -132,8 +136,16 @@ public abstract class Weather extends MappableContent{ public void draw(){ if(renderer.weatherAlpha() > 0.0001f){ Draw.draw(Layer.weather, () -> { + weather.rand.setSeed(0); Draw.alpha(renderer.weatherAlpha() * opacity); - weather.draw((Weatherc)this); + weather.drawOver((Weatherc)this); + Draw.reset(); + }); + + Draw.draw(Layer.debris, () -> { + weather.rand.setSeed(0); + Draw.alpha(renderer.weatherAlpha() * opacity); + weather.drawUnder((Weatherc)this); Draw.reset(); }); } diff --git a/core/src/mindustry/world/blocks/distribution/Sorter.java b/core/src/mindustry/world/blocks/distribution/Sorter.java index 811e8983ec..865fd5f0e2 100644 --- a/core/src/mindustry/world/blocks/distribution/Sorter.java +++ b/core/src/mindustry/world/blocks/distribution/Sorter.java @@ -70,8 +70,6 @@ public class Sorter extends Block{ Draw.rect("center", x, y); Draw.color(); } - - } @Override diff --git a/tools/src/mindustry/tools/Generators.java b/tools/src/mindustry/tools/Generators.java index a7c3b27196..c8c15b5a12 100644 --- a/tools/src/mindustry/tools/Generators.java +++ b/tools/src/mindustry/tools/Generators.java @@ -24,6 +24,32 @@ public class Generators{ public static void generate(){ ObjectMap gens = new ObjectMap<>(); + ImagePacker.generate("splashes", () -> { + ArcNativesLoader.load(); + + int frames = 12; + int size = 32; + for(int i = 0; i < frames; i++){ + float fin = (float)i / (frames); + float fout = 1f - fin; + float stroke = 4f * fout; + float radius = (size/2f) * fin; + + Pixmap pixmap = new Pixmap(size, size); + + pixmap.each((x, y) -> { + float dst = Mathf.dst(x, y, size/2f, size/2f); + if(Math.abs(dst - radius) <= stroke){ + pixmap.draw(x, y, Color.white); + } + }); + + Fi.get("splash-" + i + ".png").writePNG(pixmap); + + pixmap.dispose(); + } + }); + ImagePacker.generate("cracks", () -> { RidgedPerlin r = new RidgedPerlin(1, 3); for(int size = 1; size <= Block.maxCrackSize; size++){