online fix
This commit is contained in:
@@ -279,6 +279,19 @@ namespace MegaKoop.Game.Networking
|
||||
hasPendingRemoteSpawn = false;
|
||||
return;
|
||||
}
|
||||
EnemyDefinitionRegistry.Register(definition);
|
||||
|
||||
if (pendingRemoteSpawn.NetworkId != 0 && NetworkIdentity.TryGet(pendingRemoteSpawn.NetworkId, out var existingIdentity) && existingIdentity != null)
|
||||
{
|
||||
var existingInstance = existingIdentity.gameObject;
|
||||
if (existingInstance != null)
|
||||
{
|
||||
existingInstance.SetActive(true);
|
||||
existingInstance.transform.SetPositionAndRotation(pendingRemoteSpawn.Position + definition.PrefabPivotOffset, pendingRemoteSpawn.Rotation);
|
||||
hasPendingRemoteSpawn = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
bool success = spawner != null && spawner.TrySpawn(definition, pendingRemoteSpawn.Position);
|
||||
if (success)
|
||||
@@ -348,7 +361,6 @@ namespace MegaKoop.Game.Networking
|
||||
var identity = instance.GetComponent<NetworkIdentity>();
|
||||
if (identity != null && pendingRemoteSpawn.NetworkId != 0 && identity.NetworkId != pendingRemoteSpawn.NetworkId)
|
||||
{
|
||||
NetworkIdAllocator.SyncEnemyCursor(pendingRemoteSpawn.NetworkId);
|
||||
identity.SetNetworkId(pendingRemoteSpawn.NetworkId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user