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,5 +1,4 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using Barotrauma.IO;
using System.Linq;
@@ -10,8 +9,7 @@ namespace Barotrauma
{
class NPCConversationCollection : Prefab
{
// Thread-safe dictionary for language-based collections
public static readonly ConcurrentDictionary<LanguageIdentifier, PrefabCollection<NPCConversationCollection>> Collections = new ConcurrentDictionary<LanguageIdentifier, PrefabCollection<NPCConversationCollection>>();
public static readonly Dictionary<LanguageIdentifier, PrefabCollection<NPCConversationCollection>> Collections = new Dictionary<LanguageIdentifier, PrefabCollection<NPCConversationCollection>>();
public readonly LanguageIdentifier Language;
@@ -162,24 +160,7 @@ namespace Barotrauma
return currentFlags;
}
// Thread-safe previous conversations tracking using copy-on-write pattern
private static volatile List<NPCConversation> _previousConversations = new List<NPCConversation>();
private static readonly object _previousConversationsLock = new object();
private static List<NPCConversation> previousConversations => _previousConversations;
private static void AddToPreviousConversations(NPCConversation conversation)
{
lock (_previousConversationsLock)
{
var newList = new List<NPCConversation>(_previousConversations);
newList.Insert(0, conversation);
if (newList.Count > MaxPreviousConversations)
{
newList.RemoveAt(MaxPreviousConversations);
}
_previousConversations = newList;
}
}
private static readonly List<NPCConversation> previousConversations = new List<NPCConversation>();
public static List<(Character speaker, string line)> CreateRandom(List<Character> availableSpeakers)
{
@@ -300,7 +281,8 @@ namespace Barotrauma
if (baseConversation == null)
{
AddToPreviousConversations(selectedConversation);
previousConversations.Insert(0, selectedConversation);
if (previousConversations.Count > MaxPreviousConversations) previousConversations.RemoveAt(MaxPreviousConversations);
}
lineList.Add((speaker, selectedConversation.Line));
CreateConversation(availableSpeakers, assignedSpeakers, selectedConversation, lineList, availableConversations);