Merge branch 'cool-drills' of git://github.com/sk7725/Mindustry into sk7725-cool-drills

This commit is contained in:
Anuken 2021-07-19 08:55:10 -04:00
commit 1db5a9f3c2
2 changed files with 15 additions and 1 deletions

View File

@ -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);
}
}

View File

@ -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,11 @@ 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);