More entity processor features

This commit is contained in:
Anuken
2020-02-02 11:51:58 -05:00
parent 7ddfcbfabd
commit acb3438cc8
5 changed files with 100 additions and 23 deletions

View File

@@ -8,9 +8,14 @@ import mindustry.net.*;
public class EntityDefs{
@EntityDef({Health.class, Vel.class, Status.class, Connection.class})
@EntityDef({Unit.class, Connection.class})
class PlayerDef{}
@Depends({Health.class, Vel.class, Status.class})
class Unit{
}
class Health{
float health, maxHealth;
boolean dead;
@@ -24,7 +29,11 @@ public class EntityDefs{
float x, y;
}
class Vel extends Pos{
@Depends(Pos.class)
class Vel{
//transient fields act as imports from any other clases; these are ignored by the generator
transient float x, y;
final Vec2 vel = new Vec2();
void update(){
@@ -46,7 +55,7 @@ public class EntityDefs{
NetConnection connection;
}
static <T extends Connectionc & Velc & Healthc & Posc> void doSomethingWithAConnection(T value){
static <T extends Connectionc & Unitc> void doSomethingWithAConnection(T value){
value.setX(0);
value.setY(0);
value.getVel().set(100, 100f);