Fixed payEnter creating ghost units

This commit is contained in:
Anuken
2021-11-25 11:09:13 -05:00
parent 41e82881f3
commit 4c36abde28
2 changed files with 9 additions and 2 deletions

View File

@ -424,8 +424,15 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
unit.remove();
//needs new ID as it is now a payload
unit.id = EntityGroup.nextId();
if(net.client()){
unit.id = EntityGroup.nextId();
}else{
//server-side, this needs to be delayed until next frame because otherwise the packets sent out right after this event would have the wrong unit ID, leading to ghosts
Core.app.post(() -> unit.id = EntityGroup.nextId());
}
grabber.get(new UnitPayload(unit));
Fx.unitDrop.at(unit);
}

View File

@ -24,4 +24,4 @@ android.useAndroidX=true
#used for slow jitpack builds; TODO see if this actually works
org.gradle.internal.http.socketTimeout=100000
org.gradle.internal.http.connectionTimeout=100000
archash=f106eee2
archash=916c5a77