Internal refactoring & cleanup

This commit is contained in:
Anuken
2020-09-22 15:50:33 -04:00
parent 0256a475cf
commit f3e08f9cb6
32 changed files with 168 additions and 135 deletions

View File

@@ -24,7 +24,7 @@ public class Units{
if(unit != null){
unit.dead = true;
Fx.unitCapKill.at(unit);
Core.app.post(() -> Call.unitDeath(unit.id));
Core.app.post(() -> Call.unitDestroy(unit.id));
}
}
@@ -42,6 +42,21 @@ public class Units{
}
}
//destroys immediately
@Remote(called = Loc.server)
public static void unitDestroy(int uid){
Unit unit = Groups.unit.getByID(uid);
//if there's no unit don't add it later and get it stuck as a ghost
if(netClient != null){
netClient.addRemovedEntity(uid);
}
if(unit != null){
unit.destroy();
}
}
@Remote(called = Loc.server)
public static void unitDespawn(Unit unit){
Fx.unitDespawn.at(unit.x, unit.y, 0, unit);