This commit is contained in:
Anuken
2020-02-06 11:37:22 -05:00
parent a11f6efe0a
commit 6a99a3922e
46 changed files with 2155 additions and 1871 deletions

View File

@@ -0,0 +1,60 @@
package mindustry.entities.def;
import arc.func.*;
import mindustry.annotations.Annotations.*;
import mindustry.gen.*;
import java.io.*;
import static mindustry.Vars.player;
@Component
@BaseComponent
abstract class EntityComp{
private boolean added;
int id;
boolean isAdded(){
return added;
}
void init(){}
void update(){}
void remove(){
added = false;
}
void add(){
added = true;
}
boolean isLocal(){
return ((Object)this) == player || ((Object)this) instanceof Unitc && ((Unitc)((Object)this)).controller() == player;
}
boolean isNull(){
return false;
}
<T> T as(Class<T> type){
return (T)this;
}
<T> T with(Cons<T> cons){
cons.get((T)this);
return (T)this;
}
@InternalImpl
abstract int classId();
void read(DataInput input) throws IOException{
//TODO dynamic io
}
void write(DataOutput output) throws IOException{
//TODO dynamic io
}
}