Internal refactoring & cleanup
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user