diff --git a/annotations/src/main/java/mindustry/annotations/entity/EntityProcess.java b/annotations/src/main/java/mindustry/annotations/entity/EntityProcess.java index 4affd92b7e..a6d545df15 100644 --- a/annotations/src/main/java/mindustry/annotations/entity/EntityProcess.java +++ b/annotations/src/main/java/mindustry/annotations/entity/EntityProcess.java @@ -5,15 +5,15 @@ import arc.func.*; import arc.struct.*; import arc.util.*; import arc.util.io.*; -import arc.util.pooling.*; import arc.util.pooling.Pool.*; +import arc.util.pooling.*; import com.squareup.javapoet.*; import com.squareup.javapoet.TypeSpec.*; import com.sun.source.tree.*; import mindustry.annotations.Annotations.*; import mindustry.annotations.*; -import mindustry.annotations.util.TypeIOResolver.*; import mindustry.annotations.util.*; +import mindustry.annotations.util.TypeIOResolver.*; import javax.annotation.processing.*; import javax.lang.model.element.*; @@ -325,6 +325,8 @@ public class EntityProcess extends BaseProcessor{ //SPECIAL CASE: inject group add/remove code if(first.name().equals("add") || first.name().equals("remove")){ + mbuilder.addStatement("if(added == $L) return", first.name().equals("add")); + for(GroupDefinition def : groups){ //remove/add from each group, assume imported mbuilder.addStatement("Groups.$L.$L(this)", def.name, first.name()); @@ -367,7 +369,7 @@ public class EntityProcess extends BaseProcessor{ if(writeBlock) mbuilder.addCode("}\n"); } - //add free code to remove methods + //add free code to remove methods - always at the end if(first.name().equals("remove") && ann.pooled()){ mbuilder.addStatement("$T.free(this)", Pools.class); } @@ -375,7 +377,7 @@ public class EntityProcess extends BaseProcessor{ builder.addMethod(mbuilder.build()); } - //add pool reset method and implment Poolable + //add pool reset method and implement Poolable if(ann.pooled()){ builder.addSuperinterface(Poolable.class); //implement reset() diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 34a5603369..8101f081d3 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -1,5 +1,6 @@ package mindustry.content; +import arc.struct.*; import mindustry.annotations.Annotations.*; import mindustry.ctype.*; import mindustry.gen.*; @@ -44,6 +45,7 @@ public class UnitTypes implements ContentList{ hitsize = 8f; mass = 1.75f; health = 130; + immunities = ObjectSet.with(StatusEffects.wet); weapons.add(new Weapon("chain-blaster"){{ reload = 10f; x = 1.25f; diff --git a/core/src/mindustry/entities/def/MinerComp.java b/core/src/mindustry/entities/def/MinerComp.java index 1d888a50bb..de0a8601b9 100644 --- a/core/src/mindustry/entities/def/MinerComp.java +++ b/core/src/mindustry/entities/def/MinerComp.java @@ -17,7 +17,7 @@ import mindustry.world.*; import static mindustry.Vars.*; @Component -abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc{ +abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, DrawLayerGroundc{ @Import float x, y, rotation; transient float mineTimer; @@ -79,7 +79,8 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc{ } } - void drawOver(){ + @Override + public void drawGround(){ if(!mining()) return; float focusLen = 4f + Mathf.absin(Time.time(), 1.1f, 0.5f); float swingScl = 12f, swingMag = tilesize / 8f; diff --git a/core/src/mindustry/entities/def/UnitComp.java b/core/src/mindustry/entities/def/UnitComp.java index f95c4c7b1a..651ddf2dd6 100644 --- a/core/src/mindustry/entities/def/UnitComp.java +++ b/core/src/mindustry/entities/def/UnitComp.java @@ -171,6 +171,11 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox if(isGrounded()) draw(); } + @Override + public boolean isPlayer(){ + return controller instanceof Playerc; + } + @Override public void killed(){ float explosiveness = 2f + item().explosiveness * stack().amount; @@ -189,20 +194,17 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox } } - //TODO this is bad - - public boolean isPlayer(){ - return controller instanceof Playerc; - } - + @Override public boolean canMine(Item item){ return type.drillTier >= item.hardness; } + @Override public float miningSpeed(){ return type.mineSpeed; } + @Override public boolean offloadImmediately(){ return false; } diff --git a/core/src/mindustry/maps/planet/TestPlanetGenerator.java b/core/src/mindustry/maps/planet/TestPlanetGenerator.java index 0e307c107b..de03b97a26 100644 --- a/core/src/mindustry/maps/planet/TestPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/TestPlanetGenerator.java @@ -53,6 +53,7 @@ public class TestPlanetGenerator implements PlanetGenerator{ @Override public void generate(Vec3 position, TileGen tile){ tile.floor = getBlock(position); + tile.overlay = Mathf.chance(0.01) ? Blocks.oreCopper : Blocks.air; } Block getBlock(Vec3 position){ diff --git a/gradle.properties b/gradle.properties index 88c2ae197f..ab05152a26 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=f1178ca09b4d0b29e23f6443e73f8daf4a4b7329 +archash=d5eb3f0c3df12ba6f6b20c1c95952bc22d4250b3