1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-10-06 21:07:25 +03:00

Use new drawers (#7127)

This commit is contained in:
Goobrr 2022-07-05 21:44:15 +07:00 committed by GitHub
parent a4e482f55a
commit fe51500e8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 19 additions and 45 deletions

View File

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1092,8 +1092,11 @@ public class Blocks{
hasPower = true;
craftEffect = Fx.none;
drawer = new DrawMulti(
new DrawRegion("-bottom"),
new DrawPistons(){{
sinMag = 1f;
}},
new DrawDefault(),
new DrawFrames(),
new DrawLiquidRegion(),
new DrawRegion("-top")
);
@ -2298,7 +2301,18 @@ public class Blocks{
consume(new ConsumeItemFlammable());
consume(new ConsumeItemExplode());
drawer = new DrawMulti(new DrawDefault(), new DrawWarmupRegion(), new DrawTurbines());
drawer = new DrawMulti(
new DrawDefault(),
new DrawWarmupRegion(),
new DrawRegion("-turbine"){{
rotateSpeed = 2f;
}},
new DrawRegion("-turbine"){{
rotateSpeed = -2f;
rotation = 45f;
}},
new DrawRegion("-cap")
);
}};
differentialGenerator = new ConsumeGenerator("differential-generator"){{

View File

@ -447,7 +447,6 @@ public class ClassMap{
classes.put("DrawShape", mindustry.world.draw.DrawShape.class);
classes.put("DrawSideRegion", mindustry.world.draw.DrawSideRegion.class);
classes.put("DrawSpikes", mindustry.world.draw.DrawSpikes.class);
classes.put("DrawTurbines", mindustry.world.draw.DrawTurbines.class);
classes.put("DrawTurret", mindustry.world.draw.DrawTurret.class);
classes.put("DrawWarmupRegion", mindustry.world.draw.DrawWarmupRegion.class);
classes.put("DrawWeave", mindustry.world.draw.DrawWeave.class);

View File

@ -13,7 +13,7 @@ public class DrawRegion extends DrawBlock{
public String suffix = "";
public boolean spinSprite = false;
public boolean drawPlan = true;
public float rotateSpeed, x, y;
public float rotateSpeed, x, y, rotation;
/** Any number <=0 disables layer changes. */
public float layer = -1;
@ -29,9 +29,9 @@ public class DrawRegion extends DrawBlock{
float z = Draw.z();
if(layer > 0) Draw.z(layer);
if(spinSprite){
Drawf.spinSprite(region, build.x + x, build.y + y, build.totalProgress() * rotateSpeed);
Drawf.spinSprite(region, build.x + x, build.y + y, build.totalProgress() * rotateSpeed + rotation);
}else{
Draw.rect(region, build.x + x, build.y + y, build.totalProgress() * rotateSpeed);
Draw.rect(region, build.x + x, build.y + y, build.totalProgress() * rotateSpeed + rotation);
}
Draw.z(z);
}

View File

@ -1,39 +0,0 @@
package mindustry.world.draw;
import arc.*;
import arc.graphics.g2d.*;
import mindustry.gen.*;
import mindustry.world.*;
public class DrawTurbines extends DrawBlock{
public TextureRegion[] turbines = new TextureRegion[2];
public TextureRegion cap;
public float turbineSpeed = 2f;
@Override
public void draw(Building build){
float totalTime = build.totalProgress();
Draw.rect(turbines[0], build.x, build.y, totalTime * turbineSpeed);
Draw.rect(turbines[1], build.x, build.y, -totalTime * turbineSpeed);
if(cap.found()){
Draw.rect(cap, build.x, build.y);
}
}
@Override
public void load(Block block){
super.load(block);
cap = Core.atlas.find(block.name + "-cap");
for(int i = 0; i < 2; i++){
turbines[i] = Core.atlas.find(block.name + "-turbine" + i);
}
}
@Override
public TextureRegion[] icons(Block block){
return new TextureRegion[]{turbines[0], turbines[1], cap};
}
}