Turbine generator tweaks

This commit is contained in:
Anuken
2020-06-13 12:08:03 -04:00
parent c8f2362b7e
commit fef4882c15
20 changed files with 3592 additions and 3590 deletions

View File

@@ -1,9 +1,13 @@
package mindustry.world.blocks.power;
import mindustry.type.Item;
import mindustry.type.Liquid;
import arc.graphics.g2d.*;
import mindustry.annotations.Annotations.*;
import mindustry.type.*;
public class BurnerGenerator extends ItemLiquidGenerator{
public @Load(value = "@-turbine#", length = 2) TextureRegion[] turbineRegions;
public @Load("@-cap") TextureRegion capRegion;
public float turbineSpeed = 2f;
public BurnerGenerator(String name){
super(true, false, name);
@@ -18,4 +22,24 @@ public class BurnerGenerator extends ItemLiquidGenerator{
protected float getItemEfficiency(Item item){
return item.flammability;
}
@Override
public TextureRegion[] icons(){
return turbineRegions[0].found() ? new TextureRegion[]{region, turbineRegions[0], turbineRegions[1], capRegion} : super.icons();
}
public class BurnerGeneratorEntity extends ItemLiquidGeneratorEntity{
@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);
}
}
}
}

View File

@@ -45,7 +45,6 @@ public class ItemLiquidGenerator extends PowerGenerator{
public ItemLiquidGenerator(String name){
super(name);
this.entityType = ItemLiquidGeneratorEntity::new;
}
protected void setDefaults(){
@@ -88,6 +87,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
public class ItemLiquidGeneratorEntity extends GeneratorEntity{
public float explosiveness;
public float heat;
public float totalTime;
@Override
public boolean productionValid(){
@@ -114,6 +114,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
}
heat = Mathf.lerpDelta(heat, generateTime >= 0.001f ? 1f : 0f, 0.05f);
totalTime += heat;
//liquid takes priority over solids
if(hasLiquids && liquid != null && liquids.get(liquid) >= 0.001f){