From 1e3b498671c37cb920752c29983c928336667830 Mon Sep 17 00:00:00 2001 From: MEEP of Faith Date: Wed, 28 Oct 2020 20:46:50 -0700 Subject: [PATCH] Any Layer Effects --- core/src/mindustry/content/Fx.java | 18 +++++++++--------- core/src/mindustry/entities/Effect.java | 16 ++++++++-------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index a046bff46c..47b9995c77 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -257,33 +257,33 @@ public class Fx{ randLenVectors(e.id, 9, 3 + 20f * e.finpow(), (x, y) -> { Fill.circle(e.x + x, e.y + y, e.fout() * 4f + 0.4f); }); - }).ground(), + }).layer(Layer.debris), unitLand = new Effect(30, e -> { color(Tmp.c1.set(e.color).mul(1.1f)); randLenVectors(e.id, 6, 17f * e.finpow(), (x, y) -> { Fill.circle(e.x + x, e.y + y, e.fout() * 4f + 0.3f); }); - }).ground(), + }).layer(Layer.debris), unitLandSmall = new Effect(30, e -> { color(Tmp.c1.set(e.color).mul(1.1f)); randLenVectors(e.id, (int)(6 * e.rotation), 12f * e.finpow() * e.rotation, (x, y) -> { Fill.circle(e.x + x, e.y + y, e.fout() * 3f + 0.1f); }); - }).ground(), + }).layer(Layer.debris), unitPickup = new Effect(18, e -> { color(Pal.lightishGray); stroke(e.fin() * 2f); Lines.poly(e.x, e.y, 4, 13f * e.fout()); - }).ground(), + }).layer(Layer.debris), landShock = new Effect(12, e -> { color(Pal.lancerLaser); stroke(e.fout() * 3f); Lines.poly(e.x, e.y, 12, 20f * e.fout()); - }).ground(), + }).layer(Layer.debris), pickup = new Effect(18, e -> { color(Pal.lightishGray); @@ -1076,7 +1076,7 @@ public class Fx{ e.y + trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()), 1f, 2f, rot + e.fin() * 50f * i); - }).ground(400f), + }).layer(Layer.debris, 400f), shellEjectMedium = new Effect(34f, e -> { color(Pal.lightOrange, Color.lightGray, Pal.lightishGray, e.fin()); @@ -1099,7 +1099,7 @@ public class Fx{ }); } - }).ground(400f), + }).layer(Layer.debris, 400f), shellEjectBig = new Effect(22f, e -> { color(Pal.lightOrange, Color.lightGray, Pal.lightishGray, e.fin()); @@ -1123,7 +1123,7 @@ public class Fx{ }); } - }).ground(400f), + }).layer(Layer.debris, 400f), railShoot = new Effect(24f, e -> { e.scaled(10f, b -> { @@ -1500,7 +1500,7 @@ public class Fx{ color(Tmp.c1.set(e.color).mul(1.5f)); stroke(e.fout() * 1.4f); Lines.circle(e.x, e.y, (2f + e.fin() * 4f) * e.rotation); - }).ground(), + }).layer(Layer.debris), bubble = new Effect(20, e -> { color(Tmp.c1.set(e.color).shiftValue(0.1f)); diff --git a/core/src/mindustry/entities/Effect.java b/core/src/mindustry/entities/Effect.java index 920729e608..3295a1ae00 100644 --- a/core/src/mindustry/entities/Effect.java +++ b/core/src/mindustry/entities/Effect.java @@ -27,8 +27,8 @@ public class Effect{ /** Clip size. */ public float size; - public boolean ground; - public float groundDuration; + public float layer = Layer.effect; + public float layerDuration; public Effect(float life, float clipsize, Cons renderer){ this.id = all.size; @@ -42,14 +42,14 @@ public class Effect{ this(life,50f, renderer); } - public Effect ground(){ - ground = true; + public Effect layer(float l){ + layer = l; return this; } - public Effect ground(float duration){ - ground = true; - this.groundDuration = duration; + public Effect layer(float l, float duration){ + layer = l; + this.layerDuration = duration; return this; } @@ -87,7 +87,7 @@ public class Effect{ public float render(int id, Color color, float life, float lifetime, float rotation, float x, float y, Object data){ container.set(id, color, life, lifetime, rotation, x, y, data); - Draw.z(ground ? Layer.debris : Layer.effect); + Draw.z(layer); Draw.reset(); renderer.get(container); Draw.reset();