Revert "OBT1.1.0 Merge branch 'dev_pte' into dev"

This reverts commit 177cf89756, reversing
changes made to 42ba733cd4.
This commit is contained in:
Eero
2025-12-29 11:18:11 +08:00
parent 177cf89756
commit 046483b9da
86 changed files with 800 additions and 2496 deletions
@@ -1,6 +1,5 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using Barotrauma.IO;
@@ -21,10 +20,10 @@ namespace Barotrauma
public const ushort MaxEntityCount = ushort.MaxValue - 4; //ushort.MaxValue - 4 because the 4 values above are reserved values
private static readonly ConcurrentDictionary<ushort, Entity> dictionary = new ConcurrentDictionary<ushort, Entity>();
private static readonly Dictionary<ushort, Entity> dictionary = new Dictionary<ushort, Entity>();
public static IReadOnlyCollection<Entity> GetEntities()
{
return (IReadOnlyCollection<Entity>)dictionary.Values;
return dictionary.Values;
}
public static int EntityCount => dictionary.Count;
@@ -123,11 +122,13 @@ namespace Barotrauma
//give a unique ID
ID = DetermineID(id, submarine);
if (!dictionary.TryAdd(ID, this))
if (dictionary.ContainsKey(ID))
{
throw new Exception($"ID {ID} is taken by {dictionary[ID]}");
}
dictionary.Add(ID, this);
CreationStackTrace = "";
#if DEBUG
var st = new StackTrace(skipFrames: 2, fNeedFileInfo: true);
@@ -146,6 +147,7 @@ namespace Barotrauma
CreationStackTrace += $"{fileName}@{fileLineNumber}; ";
}
#endif
#warning TODO: consider removing this mutex, entity creation probably shouldn't be multithreaded
lock (creationCounterMutex)
{
CreationIndex = creationCounter;
@@ -259,7 +261,7 @@ namespace Barotrauma
DebugConsole.ThrowError($"Error while removing item \"{item}\"", exception);
}
}
Item.ClearAllItemCollections();
Item.ItemList.Clear();
}
if (Character.CharacterList.Count > 0)
{
@@ -323,7 +325,7 @@ namespace Barotrauma
}
else
{
dictionary.TryRemove(ID, out _);
dictionary.Remove(ID);
}
IdFreed = true;
}