Added angleOffset to DrawPistons (#7950)

This commit is contained in:
whert-dev
2023-01-07 16:45:33 +00:00
committed by GitHub
parent cb5351419b
commit 0d26b9e4f8

View File

@@ -9,7 +9,7 @@ import mindustry.gen.*;
import mindustry.world.*; import mindustry.world.*;
public class DrawPistons extends DrawBlock{ public class DrawPistons extends DrawBlock{
public float sinMag = 4f, sinScl = 6f, sinOffset = 50f, sideOffset = 0f, lenOffset = -1f; public float sinMag = 4f, sinScl = 6f, sinOffset = 50f, sideOffset = 0f, lenOffset = -1f, angleOffset = 0f;
public int sides = 4; public int sides = 4;
public String suffix = "-piston"; public String suffix = "-piston";
public TextureRegion region1, region2, regiont; public TextureRegion region1, region2, regiont;
@@ -23,7 +23,7 @@ public class DrawPistons extends DrawBlock{
public void draw(Building build){ public void draw(Building build){
for(int i = 0; i < sides; i++){ for(int i = 0; i < sides; i++){
float len = Mathf.absin(build.totalProgress() + sinOffset + sideOffset * sinScl * i, sinScl, sinMag) + lenOffset; float len = Mathf.absin(build.totalProgress() + sinOffset + sideOffset * sinScl * i, sinScl, sinMag) + lenOffset;
float angle = i * 360f / sides; float angle = angleOffset + i * 360f / sides;
TextureRegion reg = TextureRegion reg =
regiont.found() && (Mathf.equal(angle, 315) || Mathf.equal(angle, 135)) ? regiont : regiont.found() && (Mathf.equal(angle, 315) || Mathf.equal(angle, 135)) ? regiont :
angle >= 135 && angle < 315 ? region2 : region1; angle >= 135 && angle < 315 ? region2 : region1;