chemical combustion chamber
This commit is contained in:
@@ -1881,6 +1881,7 @@ public class Blocks{
|
||||
consumes.liquid(Liquids.water, 0.1f);
|
||||
hasLiquids = true;
|
||||
size = 2;
|
||||
iconOverride = new String[]{"", "-turbine0", "-turbine1"};
|
||||
|
||||
ambientSound = Sounds.smelter;
|
||||
ambientSoundVolume = 0.06f;
|
||||
@@ -1965,14 +1966,22 @@ public class Blocks{
|
||||
liquidCapacity = 20f;
|
||||
}};
|
||||
|
||||
//TODO arkycite combustion: ozone + arkycite
|
||||
|
||||
if(false)
|
||||
chemicalCombustionChamber = new ItemLiquidGenerator("chemical-combustion-chamber"){{
|
||||
requirements(Category.power, with(Items.graphite, 30, Items.tungsten, 40, Items.silicon, 30));
|
||||
chemicalCombustionChamber = new SingleTypeGenerator("chemical-combustion-chamber"){{
|
||||
requirements(Category.power, with(Items.graphite, 40, Items.tungsten, 40, Items.oxide, 40f, Items.silicon, 30));
|
||||
powerProduction = 6f;
|
||||
consumes.liquids(LiquidStack.with(Liquids.ozone, 1f / 60f, Liquids.arkycite, 20f / 60f));
|
||||
size = 3;
|
||||
useItems = false;
|
||||
drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawPistons(){{
|
||||
sinMag = 3f;
|
||||
sinScl = 5f;
|
||||
}}, new DrawRegion("-mid"), new DrawLiquidTile(Liquids.arkycite, 37f / 4f), new DrawBlock(), new DrawGlowRegion(){{
|
||||
alpha = 1f;
|
||||
glowScale = 5f;
|
||||
color = Color.valueOf("c967b099");
|
||||
}});
|
||||
iconOverride = new String[]{"-bottom", ""};
|
||||
generateEffect = Fx.none;
|
||||
|
||||
ambientSound = Sounds.smelter;
|
||||
ambientSoundVolume = 0.06f;
|
||||
|
||||
@@ -53,6 +53,10 @@ public class ErekirTechTree{
|
||||
|
||||
node(turbineCondenser, () -> {
|
||||
node(beamNode, () -> {
|
||||
node(chemicalCombustionChamber, () -> {
|
||||
|
||||
});
|
||||
|
||||
node(beamTower, () -> {
|
||||
|
||||
});
|
||||
|
||||
@@ -2,16 +2,22 @@ package mindustry.world.blocks.power;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.draw.*;
|
||||
|
||||
//TODO deprecate this whole class?
|
||||
public class BurnerGenerator extends ItemLiquidGenerator{
|
||||
@Deprecated
|
||||
public @Load(value = "@-turbine#", length = 2) TextureRegion[] turbineRegions;
|
||||
@Deprecated
|
||||
public @Load("@-cap") TextureRegion capRegion;
|
||||
@Deprecated
|
||||
public float turbineSpeed = 2f;
|
||||
|
||||
public BurnerGenerator(String name){
|
||||
super(true, false, name);
|
||||
|
||||
drawer = new DrawMulti(new DrawBlock(), new DrawWarmupRegion(), new DrawTurbines());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -24,27 +30,7 @@ public class BurnerGenerator extends ItemLiquidGenerator{
|
||||
return item.flammability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] icons(){
|
||||
return turbineRegions[0].found() ? new TextureRegion[]{region, turbineRegions[0], turbineRegions[1], capRegion} : super.icons();
|
||||
}
|
||||
|
||||
public class BurnerGeneratorBuild extends ItemLiquidGeneratorBuild{
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
if(turbineRegions[0].found()){
|
||||
Draw.rect(turbineRegions[0], x, y, totalTime * turbineSpeed);
|
||||
Draw.rect(turbineRegions[1], x, y, -totalTime * turbineSpeed);
|
||||
|
||||
Draw.rect(capRegion, x, y);
|
||||
}
|
||||
|
||||
if(hasLiquids && liquidRegion.found()){
|
||||
Drawf.liquid(liquidRegion, x, y, liquids.currentAmount() / liquidCapacity, liquids.current().color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import mindustry.entities.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.consumers.*;
|
||||
import mindustry.world.draw.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
@@ -31,12 +32,18 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
public Effect generateEffect = Fx.generatespark;
|
||||
public float generateEffectRnd = 3f;
|
||||
public Effect explodeEffect = Fx.generatespark;
|
||||
public Color heatColor = Color.valueOf("ff9b59");
|
||||
public @Load("@-top") TextureRegion topRegion;
|
||||
public @Load("@-liquid") TextureRegion liquidRegion;
|
||||
public boolean randomlyExplode = true;
|
||||
public boolean defaults = false;
|
||||
|
||||
/** @deprecated unused, use a custom drawer instead */
|
||||
public Color heatColor = Color.valueOf("ff9b59");
|
||||
/** @deprecated unused, use a custom drawer instead */
|
||||
@Deprecated
|
||||
public @Load("@-top") TextureRegion topRegion;
|
||||
/** @deprecated unused, use a custom drawer instead */
|
||||
@Deprecated
|
||||
public @Load("@-liquid") TextureRegion liquidRegion;
|
||||
|
||||
public ItemLiquidGenerator(boolean hasItems, boolean hasLiquids, String name){
|
||||
this(name);
|
||||
this.hasItems = hasItems;
|
||||
@@ -46,6 +53,8 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
|
||||
public ItemLiquidGenerator(String name){
|
||||
super(name);
|
||||
|
||||
drawer = new DrawMulti(new DrawBlock(), new DrawWarmupRegion());
|
||||
}
|
||||
|
||||
protected void setDefaults(){
|
||||
@@ -159,19 +168,13 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
public float warmup(){
|
||||
return heat;
|
||||
}
|
||||
|
||||
if(hasItems){
|
||||
Draw.color(heatColor);
|
||||
Draw.alpha(heat * 0.4f + Mathf.absin(Time.time, 8f, 0.6f) * heat);
|
||||
Draw.rect(topRegion, x, y);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
if(hasLiquids){
|
||||
Drawf.liquid(liquidRegion, x, y, liquids.currentAmount() / liquidCapacity, liquids.current().color);
|
||||
}
|
||||
@Override
|
||||
public float totalProgress(){
|
||||
return totalTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
package mindustry.world.blocks.power;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.draw.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
public class PowerGenerator extends PowerDistributor{
|
||||
/** The amount of power produced per tick in case of an efficiency of 1.0, which represents 100%. */
|
||||
public float powerProduction;
|
||||
public Stat generationType = Stat.basePowerGeneration;
|
||||
public DrawBlock drawer = new DrawBlock();
|
||||
public @Nullable String[] iconOverride;
|
||||
|
||||
public PowerGenerator(String name){
|
||||
super(name);
|
||||
@@ -22,6 +27,24 @@ public class PowerGenerator extends PowerDistributor{
|
||||
flags = EnumSet.of(BlockFlag.generator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] icons(){
|
||||
if(iconOverride != null){
|
||||
var out = new TextureRegion[iconOverride.length];
|
||||
for(int i = 0; i < out.length; i++){
|
||||
out[i] = Core.atlas.find(name + iconOverride[i]);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
return drawer.icons(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
super.load();
|
||||
drawer.load(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
@@ -41,6 +64,11 @@ public class PowerGenerator extends PowerDistributor{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawRequestRegion(BuildPlan plan, Eachable<BuildPlan> list){
|
||||
drawer.drawPlan(this, plan, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean outputsItems(){
|
||||
return false;
|
||||
@@ -51,6 +79,17 @@ public class PowerGenerator extends PowerDistributor{
|
||||
/** The efficiency of the producer. An efficiency of 1.0 means 100% */
|
||||
public float productionEfficiency = 0.0f;
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
drawer.drawBase(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLight(){
|
||||
super.drawLight();
|
||||
drawer.drawLights(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float ambientVolume(){
|
||||
return Mathf.clamp(productionEfficiency);
|
||||
|
||||
@@ -28,6 +28,7 @@ public class DrawLiquidRegion extends DrawBlock{
|
||||
|
||||
@Override
|
||||
public void drawBase(Building build){
|
||||
if(!build.block.hasLiquids) return;
|
||||
|
||||
Liquid drawn = drawLiquid != null ? drawLiquid : build.liquids.current();
|
||||
Drawf.liquid(liquid, build.x, build.y,
|
||||
|
||||
36
core/src/mindustry/world/draw/DrawPistons.java
Normal file
36
core/src/mindustry/world/draw/DrawPistons.java
Normal file
@@ -0,0 +1,36 @@
|
||||
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.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public class DrawPistons extends DrawBlock{
|
||||
public float sinMag = 4f, sinScl = 6f, sinOffset = 60f, sideOffset = 0f, lenOffset = -1f;
|
||||
public TextureRegion region1, region2;
|
||||
|
||||
@Override
|
||||
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBase(Building build){
|
||||
for(int i = 0; i < 4; 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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(Block block){
|
||||
super.load(block);
|
||||
|
||||
region1 = Core.atlas.find(block.name + "-piston0");
|
||||
region2 = Core.atlas.find(block.name + "-piston1");
|
||||
}
|
||||
}
|
||||
43
core/src/mindustry/world/draw/DrawTurbines.java
Normal file
43
core/src/mindustry/world/draw/DrawTurbines.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package mindustry.world.draw;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.util.*;
|
||||
import mindustry.entities.units.*;
|
||||
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 drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBase(Building build){
|
||||
if(!turbines[0].found()) return;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
36
core/src/mindustry/world/draw/DrawWarmupRegion.java
Normal file
36
core/src/mindustry/world/draw/DrawWarmupRegion.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package mindustry.world.draw;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public class DrawWarmupRegion extends DrawBlock{
|
||||
public float sinMag = 0.6f, sinScl = 8f;
|
||||
public Color color = Color.valueOf("ff9b59");
|
||||
public TextureRegion region;
|
||||
|
||||
@Override
|
||||
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBase(Building build){
|
||||
Draw.color(color);
|
||||
Draw.alpha(build.warmup() * (1f - sinMag) + Mathf.absin(Time.time, sinScl, sinMag) * build.warmup());
|
||||
Draw.rect(region, build.x, build.y);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(Block block){
|
||||
super.load(block);
|
||||
|
||||
region = Core.atlas.find(block.name + "-top");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user