From 41364537a9168fd7afb19087e43fe5572c0e5d52 Mon Sep 17 00:00:00 2001 From: InvalidArgument3 Date: Fri, 14 Jun 2024 18:24:02 -0500 Subject: [PATCH 1/2] hmm --- .../AsteroidEntities/AsteroidEntity.cs | 25 ++----------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidEntities/AsteroidEntity.cs b/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidEntities/AsteroidEntity.cs index edea3f37..c269b5b1 100644 --- a/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidEntities/AsteroidEntity.cs +++ b/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/AsteroidEntities/AsteroidEntity.cs @@ -85,30 +85,9 @@ public static AsteroidEntity CreateAsteroid(Vector3D position, float size, Vecto var ent = new AsteroidEntity(); Log.Info($"Creating AsteroidEntity at Position: {position}, Size: {size}, InitialVelocity: {initialVelocity}, Type: {type}"); - // Server-side: Generate a unique ID if none is provided - if (MyAPIGateway.Session.IsServer) + if (entityId.HasValue) { - if (entityId.HasValue) - { - ent.EntityId = entityId.Value; - } - else - { - ent.EntityId = MyEntityIdentifier.AllocateId(); // Generate a unique ID - } - } - else - { - // Client-side: Use the provided ID - if (entityId.HasValue) - { - ent.EntityId = entityId.Value; - } - else - { - Log.Info("Client did not receive a valid entity ID. Skipping asteroid creation."); - return null; - } + ent.EntityId = entityId.Value; } try From ec1dd0c7a37d1fa977c8b6e5ad2b5176c4153fbe Mon Sep 17 00:00:00 2001 From: InvalidArgument3 Date: Fri, 14 Jun 2024 18:29:00 -0500 Subject: [PATCH 2/2] Update MainSession.cs --- .../Data/Scripts/DynamicAsteroids/MainSession.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/MainSession.cs b/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/MainSession.cs index 4db61cba..ab0c9193 100644 --- a/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/MainSession.cs +++ b/Dynamic Asteroids/Data/Scripts/DynamicAsteroids/MainSession.cs @@ -164,10 +164,10 @@ private void OnMessageReceived(byte[] message) else { Log.Info($"Client: Failed to find asteroid with ID {asteroidMessage.EntityId} for removal"); - foreach (var entity in MyEntities.GetEntities()) - { - Log.Info($"Client: Existing Entity ID: {entity.EntityId}"); - } + //foreach (var entity in MyEntities.GetEntities()) + //{ + // Log.Info($"Client: Existing Entity ID: {entity.EntityId}"); + //} } } else if (asteroidMessage.IsInitialCreation)