online fix

This commit is contained in:
2025-10-27 13:45:26 +01:00
parent 94511923d5
commit 3ff9819d78
3 changed files with 56806 additions and 4 deletions

View File

@@ -210,7 +210,7 @@ namespace MegaKoop.Game.Networking
EnemyDefinitionRegistry.Register(definition);
}
if (!DetermineAuthority() || networkManager == null)
if (!IsHostClient() || networkManager == null)
{
if (hasPendingRemoteSpawn)
{
@@ -241,7 +241,7 @@ namespace MegaKoop.Game.Networking
private void HandleInstanceDespawned(GameObject instance, EnemyDefinition definition)
{
if (!DetermineAuthority() || networkManager == null)
if (!IsHostClient() || networkManager == null)
{
return;
}
@@ -265,7 +265,7 @@ namespace MegaKoop.Game.Networking
private void HandleEnemySpawnMessage(NetworkMessage message)
{
if (DetermineAuthority())
if (IsHostClient())
{
return;
}
@@ -302,7 +302,7 @@ namespace MegaKoop.Game.Networking
private void HandleEnemyDespawnMessage(NetworkMessage message)
{
if (DetermineAuthority())
if (IsHostClient())
{
return;
}
@@ -351,5 +351,11 @@ namespace MegaKoop.Game.Networking
identity.SetNetworkId(pendingRemoteSpawn.NetworkId);
}
}
private bool IsHostClient()
{
RefreshNetworkManager();
return networkManager != null && networkManager.IsHost;
}
}
}