From 4c36abde280dc394d34b9481e13beb965b6ff32b Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 25 Nov 2021 11:09:13 -0500 Subject: [PATCH] Fixed payEnter creating ghost units --- core/src/mindustry/entities/comp/BuildingComp.java | 9 ++++++++- gradle.properties | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index b300c01499..262c53d414 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -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); } diff --git a/gradle.properties b/gradle.properties index 664e856997..0c4458242a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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