From 2583541c0fed3c14dc5890ad38e877b849748046 Mon Sep 17 00:00:00 2001 From: Sunny Kim <58885089+sk7725@users.noreply.github.com> Date: Mon, 19 Jul 2021 16:36:58 +0900 Subject: [PATCH 1/4] spinSprite --- core/src/mindustry/graphics/Drawf.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/mindustry/graphics/Drawf.java b/core/src/mindustry/graphics/Drawf.java index 7d8b2be9d5..6c4ea7630b 100644 --- a/core/src/mindustry/graphics/Drawf.java +++ b/core/src/mindustry/graphics/Drawf.java @@ -274,4 +274,13 @@ public class Drawf{ Draw.reset(); } + + /** Draws a sprite that should be lightwise correct. Provided sprite must be symmetrical. */ + public static void spinSprite(TextureRegion region, float x, float y, float r){ + r = Mathf.mod(r, 90f); + Draw.rect(region, x, y, r); + Draw.alpha(r / 90f); + Draw.rect(region, x, y, r - 90f); + Draw.alpha(1f); + } } From a7ed7a71d51284107555aab16bf90ee581ff94fd Mon Sep 17 00:00:00 2001 From: Sunny Kim <58885089+sk7725@users.noreply.github.com> Date: Mon, 19 Jul 2021 16:40:57 +0900 Subject: [PATCH 2/4] drawSpinSprite --- core/src/mindustry/world/blocks/production/Drill.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/world/blocks/production/Drill.java b/core/src/mindustry/world/blocks/production/Drill.java index 8c627ea493..b7125f07d8 100644 --- a/core/src/mindustry/world/blocks/production/Drill.java +++ b/core/src/mindustry/world/blocks/production/Drill.java @@ -54,6 +54,7 @@ public class Drill extends Block{ public float updateEffectChance = 0.02f; public boolean drawRim = false; + public boolean drawSpinSprite = true; public Color heatColor = Color.valueOf("ff5512"); public @Load("@-rim") TextureRegion rimRegion; public @Load("@-rotator") TextureRegion rotatorRegion; @@ -314,7 +315,8 @@ public class Drill extends Block{ Draw.color(); } - Draw.rect(rotatorRegion, x, y, timeDrilled * rotateSpeed); + if(drawSpinSprite) Drawf.spinSprite(rotatorRegion, x, y, timeDrilled * rotateSpeed); + else Draw.rect(rotatorRegion, x, y, timeDrilled * rotateSpeed); Draw.rect(topRegion, x, y); From 8c20203084bda4e725ab7b661805f3eb9b2dafaf Mon Sep 17 00:00:00 2001 From: Sunny Kim <58885089+sk7725@users.noreply.github.com> Date: Mon, 19 Jul 2021 17:09:17 +0900 Subject: [PATCH 3/4] formatting --- core/src/mindustry/world/blocks/production/Drill.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/world/blocks/production/Drill.java b/core/src/mindustry/world/blocks/production/Drill.java index b7125f07d8..b64cc621c8 100644 --- a/core/src/mindustry/world/blocks/production/Drill.java +++ b/core/src/mindustry/world/blocks/production/Drill.java @@ -315,8 +315,11 @@ public class Drill extends Block{ Draw.color(); } - if(drawSpinSprite) Drawf.spinSprite(rotatorRegion, x, y, timeDrilled * rotateSpeed); - else Draw.rect(rotatorRegion, x, y, timeDrilled * rotateSpeed); + if(drawSpinSprite){ + Drawf.spinSprite(rotatorRegion, x, y, timeDrilled * rotateSpeed); + }else{ + Draw.rect(rotatorRegion, x, y, timeDrilled * rotateSpeed); + } Draw.rect(topRegion, x, y); From c7ff20d47dca73b373850a3e27d70ebcebb7b1c4 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 19 Jul 2021 09:00:35 -0400 Subject: [PATCH 4/4] Fracker + SolidPump spinner lighting --- core/src/mindustry/world/blocks/production/Fracker.java | 2 +- core/src/mindustry/world/blocks/production/SolidPump.java | 2 +- gradle.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/world/blocks/production/Fracker.java b/core/src/mindustry/world/blocks/production/Fracker.java index fc07b9750a..81c314b128 100644 --- a/core/src/mindustry/world/blocks/production/Fracker.java +++ b/core/src/mindustry/world/blocks/production/Fracker.java @@ -53,7 +53,7 @@ public class Fracker extends SolidPump{ Drawf.liquid(liquidRegion, x, y, liquids.get(result) / liquidCapacity, result.color); - Draw.rect(rotatorRegion, x, y, pumpTime); + Drawf.spinSprite(rotatorRegion, x, y, pumpTime); Draw.rect(topRegion, x, y); } diff --git a/core/src/mindustry/world/blocks/production/SolidPump.java b/core/src/mindustry/world/blocks/production/SolidPump.java index e13090ec4e..ac5e778c47 100644 --- a/core/src/mindustry/world/blocks/production/SolidPump.java +++ b/core/src/mindustry/world/blocks/production/SolidPump.java @@ -89,7 +89,7 @@ public class SolidPump extends Pump{ public void draw(){ Draw.rect(region, x, y); Drawf.liquid(liquidRegion, x, y, liquids.total() / liquidCapacity, liquids.current().color); - Draw.rect(rotatorRegion, x, y, pumpTime * rotateSpeed); + Drawf.spinSprite(rotatorRegion, x, y, pumpTime * rotateSpeed); Draw.rect(topRegion, x, y); } diff --git a/gradle.properties b/gradle.properties index e9750a191e..7d2ad854bf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=e52908cb23da2dead7ac049a1f395bacda64007c +archash=cc2e0588e1a87c732d0d155fe24932ae43d641bf