Give X Y offsets to DrawCruci and DrawArc and make DrawRegion support x y and rotation in DrawPlan (#10412)
* Allow DrawRegions plan to support X Y and rotation * Give DrawArcSmelt and DrawCruci X and Y offsets * fixes
This commit is contained in:
@@ -9,7 +9,7 @@ import mindustry.gen.*;
|
||||
public class DrawArcSmelt extends DrawBlock{
|
||||
public Color flameColor = Color.valueOf("f58349"), midColor = Color.valueOf("f2d585");
|
||||
public float flameRad = 1f, circleSpace = 2f, flameRadiusScl = 3f, flameRadiusMag = 0.3f, circleStroke = 1.5f;
|
||||
|
||||
public float x = 0, y = 0;
|
||||
public float alpha = 0.68f;
|
||||
public int particles = 25;
|
||||
public float particleLife = 40f, particleRad = 7f, particleStroke = 1.1f, particleLen = 3f;
|
||||
@@ -26,10 +26,10 @@ public class DrawArcSmelt extends DrawBlock{
|
||||
Draw.blend(blending);
|
||||
|
||||
Draw.color(midColor, a);
|
||||
if(drawCenter) Fill.circle(build.x, build.y, flameRad + si);
|
||||
if(drawCenter) Fill.circle(build.x + x, build.y + y, flameRad + si);
|
||||
|
||||
Draw.color(flameColor, a);
|
||||
if(drawCenter) Lines.circle(build.x, build.y, (flameRad + circleSpace + si) * build.warmup());
|
||||
if(drawCenter) Lines.circle(build.x + x, build.y + y, (flameRad + circleSpace + si) * build.warmup());
|
||||
|
||||
Lines.stroke(particleStroke * build.warmup());
|
||||
|
||||
@@ -39,7 +39,7 @@ public class DrawArcSmelt extends DrawBlock{
|
||||
float fin = (rand.random(1f) + base) % 1f, fout = 1f - fin;
|
||||
float angle = rand.random(360f);
|
||||
float len = particleRad * Interp.pow2Out.apply(fin);
|
||||
Lines.lineAngle(build.x + Angles.trnsx(angle, len), build.y + Angles.trnsy(angle, len), angle, particleLen * fout * build.warmup());
|
||||
Lines.lineAngle(build.x + Angles.trnsx(angle, len) + x, build.y + Angles.trnsy(angle, len) + y, angle, particleLen * fout * build.warmup());
|
||||
}
|
||||
|
||||
Draw.blend();
|
||||
|
||||
@@ -9,8 +9,7 @@ import mindustry.gen.*;
|
||||
|
||||
public class DrawCrucibleFlame extends DrawBlock{
|
||||
public Color flameColor = Color.valueOf("f58349"), midColor = Color.valueOf("f2d585");
|
||||
public float flameRad = 1f, circleSpace = 2f, flameRadiusScl = 10f, flameRadiusMag = 0.6f, circleStroke = 1.5f;
|
||||
|
||||
public float flameRad = 1f, circleSpace = 2f, flameRadiusScl = 10f, flameRadiusMag = 0.6f, circleStroke = 1.5f, x = 0, y = 0;
|
||||
public float alpha = 0.5f;
|
||||
public int particles = 30;
|
||||
public float particleLife = 70f, particleRad = 7f, particleSize = 3f, fadeMargin = 0.4f, rotateScl = 1.5f;
|
||||
@@ -27,10 +26,10 @@ public class DrawCrucibleFlame extends DrawBlock{
|
||||
Draw.blend(Blending.additive);
|
||||
|
||||
Draw.color(midColor, a);
|
||||
Fill.circle(build.x, build.y, flameRad + si);
|
||||
Fill.circle(build.x + x, build.y + y, flameRad + si);
|
||||
|
||||
Draw.color(flameColor, a);
|
||||
Lines.circle(build.x, build.y, (flameRad + circleSpace + si) * build.warmup());
|
||||
Lines.circle(build.x + x, build.y + y, (flameRad + circleSpace + si) * build.warmup());
|
||||
|
||||
float base = (Time.time / particleLife);
|
||||
rand.setSeed(build.id);
|
||||
@@ -40,8 +39,8 @@ public class DrawCrucibleFlame extends DrawBlock{
|
||||
float len = particleRad * particleInterp.apply(fout);
|
||||
Draw.alpha(a * (1f - Mathf.curve(fin, 1f - fadeMargin)));
|
||||
Fill.circle(
|
||||
build.x + Angles.trnsx(angle, len),
|
||||
build.y + Angles.trnsy(angle, len),
|
||||
build.x + Angles.trnsx(angle, len) + x,
|
||||
build.y + Angles.trnsy(angle, len) + y,
|
||||
particleSize * fin * build.warmup()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,11 @@ public class DrawRegion extends DrawBlock{
|
||||
@Override
|
||||
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){
|
||||
if(!drawPlan) return;
|
||||
Draw.rect(region, plan.drawx(), plan.drawy(), (buildingRotate ? plan.rotation * 90f : 0));
|
||||
if(spinSprite){
|
||||
Drawf.spinSprite(region, plan.drawx() + x, plan.drawy() + y, (buildingRotate ? plan.rotation * 90f : 0 + rotation));
|
||||
}else{
|
||||
Draw.rect(region, plan.drawx()+ x, plan.drawy() + y, (buildingRotate ? plan.rotation * 90f : 0 + rotation));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user