Skip to content

Commit

Permalink
Merge pull request #51 from InvalidArgument3/roidnetworking-narrowing…
Browse files Browse the repository at this point in the history
…downthecause

dupe ID fix attempt #1
  • Loading branch information
InvalidArgument3 authored Jun 14, 2024
2 parents 0eb7b45 + 3681837 commit fbf28c8
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ private void OnMessageReceived(byte[] message)
Log.Info($"IsInitialCreation: {asteroidMessage.IsInitialCreation}");
Log.Info($"Rotation: {asteroidMessage.GetRotation()}");

// Check if asteroid already exists
var existingAsteroid = MyEntities.GetEntityById(asteroidMessage.EntityId) as AsteroidEntity;
if (existingAsteroid != null)
{
Log.Info($"Client: Asteroid with ID {asteroidMessage.EntityId} already exists. Skipping creation.");
return;
}

if (asteroidMessage.IsRemoval)
{
var asteroid = MyEntities.GetEntityById(asteroidMessage.EntityId) as AsteroidEntity;
Expand Down

0 comments on commit fbf28c8

Please sign in to comment.