Save unit variables in processors
This commit is contained in:
22
core/src/mindustry/entities/comp/BuildingTetherComp.java
Normal file
22
core/src/mindustry/entities/comp/BuildingTetherComp.java
Normal 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user