Save unit variables in processors

This commit is contained in:
Anuken
2021-11-29 10:57:42 -05:00
parent ea6d794c36
commit 635027bb81
11 changed files with 76 additions and 18 deletions

View File

@@ -0,0 +1,22 @@
package mindustry.entities.comp;
import mindustry.annotations.Annotations.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.type.*;
/** A unit that depends on a building's existence; if that building is removed, it despawns. */
@Component
abstract class BuildingTetherComp implements Unitc{
@Import UnitType type;
@Import Team team;
public Building building;
@Override
public void update(){
if(building == null || !building.isValid() || building.team != team){
Call.unitDespawn(self());
}
}
}