Pyrolysis generator + generation tweaks

This commit is contained in:
Anuken
2021-12-02 17:00:49 -05:00
parent fff492d89d
commit 4e181d715f
17 changed files with 183 additions and 31 deletions

View File

@@ -3,7 +3,6 @@ package mindustry.world.draw;
import arc.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.math.geom.*;
import arc.util.*;
import mindustry.entities.units.*;
import mindustry.gen.*;
@@ -11,7 +10,8 @@ import mindustry.world.*;
public class DrawPistons extends DrawBlock{
public float sinMag = 4f, sinScl = 6f, sinOffset = 50f, sideOffset = 0f, lenOffset = -1f;
public TextureRegion region1, region2;
public int sides = 4;
public TextureRegion region1, region2, regiont;
@Override
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){
@@ -20,9 +20,20 @@ public class DrawPistons extends DrawBlock{
@Override
public void drawBase(Building build){
for(int i = 0; i < 4; i++){
for(int i = 0; i < sides; i++){
float len = Mathf.absin(build.totalProgress() + sinOffset + sideOffset * sinScl * i, sinScl, sinMag) + lenOffset;
Draw.rect(i >= 2 ? region2 : region1, build.x + Geometry.d4[i].x * len, build.y + Geometry.d4[i].y * len, i * 90);
float angle = i * 360f / sides;
TextureRegion reg =
regiont.found() && (Mathf.equal(angle, 315) || Mathf.equal(angle, 135)) ? regiont :
angle >= 135 && angle < 315 ? region2 : region1;
if(Mathf.equal(angle, 315)){
Draw.yscl = -1f;
}
Draw.rect(reg, build.x + Angles.trnsx(angle, len), build.y + Angles.trnsy(angle, len), angle);
Draw.yscl = 1f;
}
}
@@ -30,7 +41,8 @@ public class DrawPistons extends DrawBlock{
public void load(Block block){
super.load(block);
region1 = Core.atlas.find(block.name + "-piston0");
region2 = Core.atlas.find(block.name + "-piston1");
region1 = Core.atlas.find(block.name + "-piston0", block.name + "-piston");
region2 = Core.atlas.find(block.name + "-piston1", block.name + "-piston");
regiont = Core.atlas.find(block.name + "-piston-t");
}
}

View File

@@ -11,6 +11,14 @@ public class DrawRotator extends DrawBlock{
public boolean drawSpinSprite = false;
public float spinSpeed = 2f;
public DrawRotator(boolean drawSpinSprite, float spinSpeed){
this.drawSpinSprite = drawSpinSprite;
this.spinSpeed = spinSpeed;
}
public DrawRotator(){
}
@Override
public void drawBase(Building build){
Draw.rect(build.block.region, build.x, build.y);