Editor map fix / Crafter renderer system

This commit is contained in:
Anuken
2020-06-13 10:33:19 -04:00
parent 27522ae494
commit 3b3a1dd496
27 changed files with 7415 additions and 7007 deletions

View File

@@ -5,7 +5,6 @@ import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.util.*;
import mindustry.*;
import mindustry.ctype.*;
import mindustry.entities.*;
import mindustry.entities.bullet.*;
@@ -28,6 +27,7 @@ import mindustry.world.blocks.sandbox.*;
import mindustry.world.blocks.storage.*;
import mindustry.world.blocks.units.*;
import mindustry.world.consumers.*;
import mindustry.world.draw.*;
import mindustry.world.meta.*;
public class Blocks implements ContentList{
@@ -527,19 +527,11 @@ public class Blocks implements ContentList{
hasPower = hasLiquids = true;
craftEffect = Fx.formsmoke;
updateEffect = Fx.plasticburn;
drawer = new DrawGlow();
consumes.liquid(Liquids.oil, 0.25f);
consumes.power(3f);
consumes.item(Items.titanium, 2);
int topRegion = re("-top");
drawer = entity -> {
Draw.rect(region, entity.x(), entity.y());
Draw.alpha(Mathf.absin(entity.totalProgress, 3f, 0.9f) * entity.warmup);
Draw.rect(re(topRegion), entity.x(), entity.y());
Draw.reset();
};
}};
phaseWeaver = new GenericCrafter("phase-weaver"){{
@@ -549,32 +541,11 @@ public class Blocks implements ContentList{
craftTime = 120f;
size = 2;
hasPower = true;
drawer = new DrawWeave();
consumes.items(new ItemStack(Items.thorium, 4), new ItemStack(Items.sand, 10));
consumes.power(5f);
itemCapacity = 20;
int bottomRegion = re("-bottom"), weaveRegion = re("-weave");
drawIcons = () -> new TextureRegion[]{Core.atlas.find(name + "-bottom"), Core.atlas.find(name), Core.atlas.find(name + "-weave")};
drawer = entity -> {
Draw.rect(re(bottomRegion), entity.x(), entity.y());
Draw.rect(re(weaveRegion), entity.x(), entity.y(), entity.totalProgress);
Draw.color(Pal.accent);
Draw.alpha(entity.warmup);
Lines.lineAngleCenter(
entity.x() + Mathf.sin(entity.totalProgress, 6f, Vars.tilesize / 3f * size),
entity.y(),
90,
size * Vars.tilesize / 2f);
Draw.reset();
Draw.rect(region, entity.x(), entity.y());
};
}};
surgeSmelter = new GenericSmelter("alloy-smelter"){{
@@ -600,29 +571,11 @@ public class Blocks implements ContentList{
rotate = false;
solid = true;
outputsLiquid = true;
drawer = new DrawMixer();
consumes.power(1f);
consumes.item(Items.titanium);
consumes.liquid(Liquids.water, 0.2f);
int liquidRegion = re("-liquid"), topRegion = re("-top"), bottomRegion = re("-bottom");
drawIcons = () -> new TextureRegion[]{Core.atlas.find(name + "-bottom"), Core.atlas.find(name + "-top")};
drawer = entity -> {
float rotation = rotate ? entity.rotdeg() : 0;
Draw.rect(re(bottomRegion), entity.x(), entity.y(), rotation);
if(entity.liquids().total() > 0.001f){
Draw.color(outputLiquid.liquid.color);
Draw.alpha(entity.liquids().get(outputLiquid.liquid) / liquidCapacity);
Draw.rect(re(liquidRegion), entity.x(), entity.y(), rotation);
Draw.color();
}
Draw.rect(re(topRegion), entity.x(), entity.y(), rotation);
};
}};
blastMixer = new GenericCrafter("blast-mixer"){{
@@ -704,27 +657,10 @@ public class Blocks implements ContentList{
hasLiquids = true;
hasPower = true;
craftEffect = Fx.none;
drawer = new DrawAnimation();
consumes.item(Items.sporePod, 1);
consumes.power(0.60f);
int[] frameRegions = new int[3];
for(int i = 0; i < 3; i++){
frameRegions[i] = re("-frame" + i);
}
int liquidRegion = re("-liquid");
int topRegion = re("-top");
drawIcons = () -> new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-top")};
drawer = entity -> {
Draw.rect(region, entity.x(), entity.y());
Draw.rect(re(frameRegions[(int)Mathf.absin(entity.totalProgress, 5f, 2.999f)]), entity.x(), entity.y());
Draw.color(Color.clear, entity.liquids().current().color, entity.liquids().total() / liquidCapacity);
Draw.rect(re(liquidRegion), entity.x(), entity.y());
Draw.color();
Draw.rect(re(topRegion), entity.x(), entity.y());
};
}};
pulverizer = new GenericCrafter("pulverizer"){{
@@ -734,18 +670,10 @@ public class Blocks implements ContentList{
craftTime = 40f;
updateEffect = Fx.pulverizeSmall;
hasItems = hasPower = true;
drawer = new DrawRotator();
consumes.item(Items.scrap, 1);
consumes.power(0.50f);
int rotatorRegion = re("-rotator");
drawIcons = () -> new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-rotator")};
drawer = entity -> {
Draw.rect(region, entity.x(), entity.y());
Draw.rect(re(rotatorRegion), entity.x(), entity.y(), entity.totalProgress * 2f);
};
}};
coalCentrifuge = new GenericCrafter("coal-centrifuge"){{