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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f51635c50073da5cabba6efdf303ee59
timeCreated: 1488638231
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant: