From 8f231febb861bc7f1b14ae6ac75c92b2ef3d65cf Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Mon, 12 Feb 2024 20:32:30 -0800 Subject: [PATCH 1/2] Layer options in DrawTurret (#9541) --- core/src/mindustry/world/draw/DrawTurret.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/world/draw/DrawTurret.java b/core/src/mindustry/world/draw/DrawTurret.java index a4377efc7a..d76708b9d6 100644 --- a/core/src/mindustry/world/draw/DrawTurret.java +++ b/core/src/mindustry/world/draw/DrawTurret.java @@ -22,6 +22,7 @@ public class DrawTurret extends DrawBlock{ public String basePrefix = ""; /** Overrides the liquid to draw in the liquid region. */ public @Nullable Liquid liquidDraw; + public float turretLayer = Layer.turret, shadowLayer = Layer.turret - 0.5f, heatLayer = Layer.turretHeat; public TextureRegion base, liquid, top, heat, preview, outline; public DrawTurret(String basePrefix){ @@ -52,11 +53,11 @@ public class DrawTurret extends DrawBlock{ Draw.rect(base, build.x, build.y); Draw.color(); - Draw.z(Layer.turret - 0.5f); + Draw.z(shadowLayer); Drawf.shadow(preview, build.x + tb.recoilOffset.x - turret.elevation, build.y + tb.recoilOffset.y - turret.elevation, tb.drawrot()); - Draw.z(Layer.turret); + Draw.z(turretLayer); drawTurret(turret, tb); drawHeat(turret, tb); @@ -64,9 +65,9 @@ public class DrawTurret extends DrawBlock{ if(parts.size > 0){ if(outline.found()){ //draw outline under everything when parts are involved - Draw.z(Layer.turret - 0.01f); + Draw.z(turretLayer - 0.01f); Draw.rect(outline, build.x + tb.recoilOffset.x, build.y + tb.recoilOffset.y, tb.drawrot()); - Draw.z(Layer.turret); + Draw.z(turretLayer); } float progress = tb.progress(); @@ -99,7 +100,7 @@ public class DrawTurret extends DrawBlock{ public void drawHeat(Turret block, TurretBuild build){ if(build.heat <= 0.00001f || !heat.found()) return; - Drawf.additive(heat, block.heatColor.write(Tmp.c1).a(build.heat), build.x + build.recoilOffset.x, build.y + build.recoilOffset.y, build.drawrot(), Layer.turretHeat); + Drawf.additive(heat, block.heatColor.write(Tmp.c1).a(build.heat), build.x + build.recoilOffset.x, build.y + build.recoilOffset.y, build.drawrot(), heatLayer); } /** Load any relevant texture regions. */ From 15f98544270281a3764a63e590dc3545b089a683 Mon Sep 17 00:00:00 2001 From: Elixias <61173114+LixieWulf@users.noreply.github.com> Date: Tue, 13 Feb 2024 06:24:47 -0700 Subject: [PATCH 2/2] Unhardcode frag offsets (#9543) --- core/src/mindustry/entities/bullet/BulletType.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 2870715f06..64737495e7 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -174,6 +174,8 @@ public class BulletType extends Content implements Cloneable{ public float fragVelocityMin = 0.2f, fragVelocityMax = 1f; /** Random range of frag lifetime as a multiplier. */ public float fragLifeMin = 1f, fragLifeMax = 1f; + /** Random offset of frag bullets from the parent bullet. */ + public float fragOffsetMin = 1f, fragOffsetMax = 7f; /** Bullet that is created at a fixed interval. */ public @Nullable BulletType intervalBullet; @@ -509,7 +511,7 @@ public class BulletType extends Content implements Cloneable{ public void createFrags(Bullet b, float x, float y){ if(fragBullet != null && (fragOnAbsorb || !b.absorbed)){ for(int i = 0; i < fragBullets; i++){ - float len = Mathf.random(1f, 7f); + float len = Mathf.random(fragOffsetMin, fragOffsetMax); float a = b.rotation() + Mathf.range(fragRandomSpread / 2) + fragAngle + ((i - fragBullets/2) * fragSpread); fragBullet.create(b, x + Angles.trnsx(a, len), y + Angles.trnsy(a, len), a, Mathf.random(fragVelocityMin, fragVelocityMax), Mathf.random(fragLifeMin, fragLifeMax)); }