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

This reverts commit 046483b9da.
This commit is contained in:
NotAlwaysTrue
2026-04-30 21:59:54 +08:00
parent 02689d0d86
commit 25683dcf39
85 changed files with 2413 additions and 779 deletions
@@ -7,6 +7,7 @@ using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace Barotrauma
{
@@ -648,7 +649,11 @@ namespace Barotrauma
}
}
private static readonly Dictionary<Structure, float> damagedStructures = new Dictionary<Structure, float>();
// ThreadLocal for thread-safe structure damage tracking
private static readonly ThreadLocal<Dictionary<Structure, float>> damagedStructuresLocal =
new ThreadLocal<Dictionary<Structure, float>>(() => new Dictionary<Structure, float>());
private static Dictionary<Structure, float> damagedStructures => damagedStructuresLocal.Value;
/// <summary>
/// Returns a dictionary where the keys are the structures that took damage and the values are the amount of damage taken
/// </summary>