Build 0.17.14.0
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
using Barotrauma.Items.Components;
|
||||
using Barotrauma.Networking;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class EntitySpawner : Entity, IServerSerializable
|
||||
{
|
||||
public readonly List<(Entity entity, bool isRemoval)> receivedEvents = new List<(Entity entity, bool isRemoval)>();
|
||||
|
||||
public void ClientEventRead(IReadMessage message, float sendingTime)
|
||||
{
|
||||
bool remove = message.ReadBoolean();
|
||||
@@ -12,7 +15,6 @@ namespace Barotrauma
|
||||
if (remove)
|
||||
{
|
||||
ushort entityId = message.ReadUInt16();
|
||||
|
||||
var entity = FindEntityByID(entityId);
|
||||
if (entity != null)
|
||||
{
|
||||
@@ -27,6 +29,7 @@ namespace Barotrauma
|
||||
{
|
||||
DebugConsole.Log("Received entity removal message for ID " + entityId + ". Entity with a matching ID not found.");
|
||||
}
|
||||
receivedEvents.Add((entity, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -34,13 +37,29 @@ namespace Barotrauma
|
||||
{
|
||||
case (byte)SpawnableType.Item:
|
||||
var newItem = Item.ReadSpawnData(message, true);
|
||||
if (newItem is Item item && item.Container?.GetComponent<Fabricator>() != null)
|
||||
if (newItem == null)
|
||||
{
|
||||
GameAnalyticsManager.AddDesignEvent("ItemFabricated:" + (GameMain.GameSession?.GameMode?.Preset.Identifier ?? "none".ToIdentifier()) + ":" + item.Prefab.Identifier);
|
||||
DebugConsole.ThrowError("Received an item spawn message, but spawning the item failed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (newItem.Container?.GetComponent<Fabricator>() != null)
|
||||
{
|
||||
GameAnalyticsManager.AddDesignEvent("ItemFabricated:" + (GameMain.GameSession?.GameMode?.Preset.Identifier ?? "none".ToIdentifier()) + ":" + newItem.Prefab.Identifier);
|
||||
}
|
||||
receivedEvents.Add((newItem, false));
|
||||
}
|
||||
break;
|
||||
case (byte)SpawnableType.Character:
|
||||
Character.ReadSpawnData(message);
|
||||
var character = Character.ReadSpawnData(message);
|
||||
if (character == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Received character spawn message, but spawning the character failed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
receivedEvents.Add((character, false));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DebugConsole.ThrowError("Received invalid entity spawn message (unknown spawnable type)");
|
||||
|
||||
Reference in New Issue
Block a user