Fixed ghost units appearing in certain situations
This commit is contained in:
@@ -1341,7 +1341,7 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
unloader = new Unloader("unloader"){{
|
unloader = new Unloader("unloader"){{
|
||||||
requirements(Category.effect, with(Items.titanium, 25, Items.silicon, 30));
|
requirements(Category.effect, with(Items.titanium, 25, Items.silicon, 30));
|
||||||
speed = 7f;
|
speed = 6f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|||||||
@@ -366,6 +366,9 @@ public class NetClient implements ApplicationListener{
|
|||||||
|
|
||||||
@Remote
|
@Remote
|
||||||
public static void playerDisconnect(int playerid){
|
public static void playerDisconnect(int playerid){
|
||||||
|
if(netClient != null){
|
||||||
|
netClient.addRemovedEntity(playerid);
|
||||||
|
}
|
||||||
Groups.player.removeByID(playerid);
|
Groups.player.removeByID(playerid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,17 @@ public class Units{
|
|||||||
private static boolean boolResult;
|
private static boolean boolResult;
|
||||||
|
|
||||||
@Remote(called = Loc.server)
|
@Remote(called = Loc.server)
|
||||||
public static void unitDeath(Unit unit){
|
public static void unitDeath(int uid){
|
||||||
unit.killed();
|
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.killed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(called = Loc.server)
|
@Remote(called = Loc.server)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
@Import float x, y, rotation, elevation, maxHealth, drag, armor, hitSize, health;
|
@Import float x, y, rotation, elevation, maxHealth, drag, armor, hitSize, health;
|
||||||
@Import boolean dead;
|
@Import boolean dead;
|
||||||
@Import Team team;
|
@Import Team team;
|
||||||
|
@Import int id;
|
||||||
|
|
||||||
private UnitController controller;
|
private UnitController controller;
|
||||||
private UnitType type;
|
private UnitType type;
|
||||||
@@ -389,6 +390,6 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
if(dead || net.client()) return;
|
if(dead || net.client()) return;
|
||||||
|
|
||||||
//deaths are synced; this calls killed()
|
//deaths are synced; this calls killed()
|
||||||
Call.unitDeath(base());
|
Call.unitDeath(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user