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

@@ -170,6 +170,7 @@ public class EntityProcess extends BaseProcessor{
}else if(round == 2){ //round 2: get component classes and generate interfaces for them }else if(round == 2){ //round 2: get component classes and generate interfaces for them
//parse groups //parse groups
//this needs to be done before the entity interfaces are generated, as the entity classes need to know which groups to add themselves to
for(Selement<?> group : allGroups){ for(Selement<?> group : allGroups){
GroupDef an = group.annotation(GroupDef.class); GroupDef an = group.annotation(GroupDef.class);
Seq<Stype> types = types(an, GroupDef::value).map(this::interfaceToComp); Seq<Stype> types = types(an, GroupDef::value).map(this::interfaceToComp);

View File

@@ -60,7 +60,6 @@ public class Selement<T extends Element>{
} }
public <A extends Annotation> A annotation(Class<A> annotation){ public <A extends Annotation> A annotation(Class<A> annotation){
if(true) return e.getAnnotation(annotation);
try{ try{
Method m = com.sun.tools.javac.code.AnnoConstruct.class.getDeclaredMethod("getAttribute", Class.class); Method m = com.sun.tools.javac.code.AnnoConstruct.class.getDeclaredMethod("getAttribute", Class.class);
m.setAccessible(true); m.setAccessible(true);

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 782 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 B

After

Width:  |  Height:  |  Size: 770 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 632 KiB

After

Width:  |  Height:  |  Size: 639 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 KiB

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 916 KiB

After

Width:  |  Height:  |  Size: 910 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 KiB

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 962 KiB

After

Width:  |  Height:  |  Size: 959 KiB

View File

@@ -1,9 +1,13 @@
package mindustry.world.blocks.power; package mindustry.world.blocks.power;
import mindustry.type.Item; import arc.graphics.g2d.*;
import mindustry.type.Liquid; import mindustry.annotations.Annotations.*;
import mindustry.type.*;
public class BurnerGenerator extends ItemLiquidGenerator{ 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){ public BurnerGenerator(String name){
super(true, false, name); super(true, false, name);
@@ -18,4 +22,24 @@ public class BurnerGenerator extends ItemLiquidGenerator{
protected float getItemEfficiency(Item item){ protected float getItemEfficiency(Item item){
return item.flammability; 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){ public ItemLiquidGenerator(String name){
super(name); super(name);
this.entityType = ItemLiquidGeneratorEntity::new;
} }
protected void setDefaults(){ protected void setDefaults(){
@@ -88,6 +87,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
public class ItemLiquidGeneratorEntity extends GeneratorEntity{ public class ItemLiquidGeneratorEntity extends GeneratorEntity{
public float explosiveness; public float explosiveness;
public float heat; public float heat;
public float totalTime;
@Override @Override
public boolean productionValid(){ public boolean productionValid(){
@@ -114,6 +114,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
} }
heat = Mathf.lerpDelta(heat, generateTime >= 0.001f ? 1f : 0f, 0.05f); heat = Mathf.lerpDelta(heat, generateTime >= 0.001f ? 1f : 0f, 0.05f);
totalTime += heat;
//liquid takes priority over solids //liquid takes priority over solids
if(hasLiquids && liquid != null && liquids.get(liquid) >= 0.001f){ if(hasLiquids && liquid != null && liquids.get(liquid) >= 0.001f){

View File

@@ -1,3 +1,8 @@
if(JavaVersion.current() != JavaVersion.VERSION_1_8){
throw new GradleException("!!! YOU MUST USE JAVA 8 TO COMPILE AND RUN MINDUSTRY !!! Read the README. Your version: ${System.properties["java.version"]}\n" +
"\nThe reason: Java has a compiler bug that requires a workaround. This workaround uses proprietary API and is only implemented on Java 8.")
}
include 'desktop', 'core', 'server', 'ios', 'annotations', 'tools', 'tests' include 'desktop', 'core', 'server', 'ios', 'annotations', 'tools', 'tests'
def use = { ... names -> def use = { ... names ->