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