3 using System.Collections.Generic;
21 DebugConsole.Log($
"Received entity removal message for \"{entity}\".");
24 if (item.Prefab.ContentPackage == ContentPackageManager.VanillaCorePackage &&
26 Rand.Range(0.0f, 1.0f) < 0.05f)
35 DebugConsole.Log(
"Received entity removal message for ID " + entityId +
". Entity with a matching ID not found.");
43 case (
byte)SpawnableType.Item:
47 DebugConsole.ThrowError(
"Received an item spawn message, but spawning the item failed.");
51 if (newItem.Container?.GetComponent<
Fabricator>() !=
null)
53 if (newItem.Prefab.ContentPackage == ContentPackageManager.VanillaCorePackage &&
55 Rand.Range(0.0f, 1.0f) < 0.05f)
63 case (
byte)SpawnableType.Character:
65 if (character ==
null)
67 DebugConsole.ThrowError(
"Received character spawn message, but spawning the character failed.");
75 DebugConsole.ThrowError(
"Received invalid entity spawn message (unknown spawnable type)");
static Character ReadSpawnData(IReadMessage inc)
static Entity FindEntityByID(ushort ID)
Find an entity based on the ID
void ClientEventRead(IReadMessage message, float sendingTime)
readonly List<(Entity entity, bool isRemoval)> receivedEvents
static GameSession?? GameSession
readonly Identifier Identifier
static Item ReadSpawnData(IReadMessage msg, bool spawn=true)
Interface for entities that the server can send events to the clients