Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give X Y offsets to DrawCruci and DrawArc and make DrawRegion support x y and rotation in DrawPlan #10412

Merged
merged 3 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/src/mindustry/world/draw/DrawArcSmelt.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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;
Expand All @@ -26,10 +26,10 @@ public void draw(Building build){
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());

Expand All @@ -39,7 +39,7 @@ public void draw(Building build){
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();
Expand Down
11 changes: 5 additions & 6 deletions core/src/mindustry/world/draw/DrawCrucibleFlame.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

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;
Expand All @@ -27,10 +26,10 @@ public void draw(Building build){
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);
Expand All @@ -40,8 +39,8 @@ public void draw(Building build){
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()
);
}
Expand Down
6 changes: 5 additions & 1 deletion core/src/mindustry/world/draw/DrawRegion.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ public void draw(Building build){
@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
Expand Down