Build 0.17.15.0
This commit is contained in:
@@ -57,8 +57,6 @@ namespace Barotrauma
|
||||
private readonly int speakerIndex;
|
||||
private readonly ImmutableHashSet<Identifier> allowedSpeakerTags;
|
||||
private readonly bool requireNextLine;
|
||||
// used primarily for team1 characters interacting with escorted personnel (TODO: not used anywhere)
|
||||
private readonly bool requireSight;
|
||||
|
||||
public NPCConversation(XElement element)
|
||||
{
|
||||
@@ -75,7 +73,6 @@ namespace Barotrauma
|
||||
|
||||
Responses = element.Elements().Select(s => new NPCConversation(s)).ToImmutableArray();
|
||||
requireNextLine = element.GetAttributeBool("requirenextline", false);
|
||||
requireSight = element.GetAttributeBool("requiresight", false);
|
||||
}
|
||||
|
||||
private static List<Identifier> GetCurrentFlags(Character speaker)
|
||||
@@ -162,23 +159,38 @@ namespace Barotrauma
|
||||
return currentFlags;
|
||||
}
|
||||
|
||||
private static List<NPCConversation> previousConversations = new List<NPCConversation>();
|
||||
private static readonly List<NPCConversation> previousConversations = new List<NPCConversation>();
|
||||
|
||||
public static List<Pair<Character, string>> CreateRandom(List<Character> availableSpeakers)
|
||||
public static List<(Character speaker, string line)> CreateRandom(List<Character> availableSpeakers)
|
||||
{
|
||||
Dictionary<int, Character> assignedSpeakers = new Dictionary<int, Character>();
|
||||
List<Pair<Character, string>> lines = new List<Pair<Character, string>>();
|
||||
List<(Character speaker, string line)> lines = new List<(Character speaker, string line)>();
|
||||
|
||||
var language = GameSettings.CurrentConfig.Language;
|
||||
if (language != TextManager.DefaultLanguage && !NPCConversationCollection.Collections.ContainsKey(language))
|
||||
{
|
||||
DebugConsole.AddWarning($"Could not find NPC conversations for the language \"{language}\". Using \"{TextManager.DefaultLanguage}\" instead..");
|
||||
language = TextManager.DefaultLanguage;
|
||||
}
|
||||
|
||||
CreateConversation(availableSpeakers, assignedSpeakers, null, lines,
|
||||
availableConversations: NPCConversationCollection.Collections[GameSettings.CurrentConfig.Language].SelectMany(cc => cc.Conversations).ToList());
|
||||
availableConversations: NPCConversationCollection.Collections[language].SelectMany(cc => cc.Conversations).ToList());
|
||||
return lines;
|
||||
}
|
||||
|
||||
public static List<Pair<Character, string>> CreateRandom(List<Character> availableSpeakers, IEnumerable<Identifier> requiredFlags)
|
||||
public static List<(Character speaker, string line)> CreateRandom(List<Character> availableSpeakers, IEnumerable<Identifier> requiredFlags)
|
||||
{
|
||||
Dictionary<int, Character> assignedSpeakers = new Dictionary<int, Character>();
|
||||
List<Pair<Character, string>> lines = new List<Pair<Character, string>>();
|
||||
var availableConversations = NPCConversationCollection.Collections[GameSettings.CurrentConfig.Language]
|
||||
List<(Character speaker, string line)> lines = new List<(Character speaker, string line)>();
|
||||
|
||||
var language = GameSettings.CurrentConfig.Language;
|
||||
if (language != TextManager.DefaultLanguage && !NPCConversationCollection.Collections.ContainsKey(language))
|
||||
{
|
||||
DebugConsole.AddWarning($"Could not find NPC conversations for the language \"{language}\". Using \"{TextManager.DefaultLanguage}\" instead..");
|
||||
language = TextManager.DefaultLanguage;
|
||||
}
|
||||
|
||||
var availableConversations = NPCConversationCollection.Collections[language]
|
||||
.SelectMany(cc => cc.Conversations.Where(c => requiredFlags.All(f => c.Flags.Contains(f)))).ToList();
|
||||
if (availableConversations.Count > 0)
|
||||
{
|
||||
@@ -191,7 +203,7 @@ namespace Barotrauma
|
||||
List<Character> availableSpeakers,
|
||||
Dictionary<int, Character> assignedSpeakers,
|
||||
NPCConversation baseConversation,
|
||||
IList<Pair<Character, string>> lineList,
|
||||
IList<(Character speaker, string line)> lineList,
|
||||
IList<NPCConversation> availableConversations,
|
||||
bool ignoreFlags = false)
|
||||
{
|
||||
@@ -271,7 +283,7 @@ namespace Barotrauma
|
||||
previousConversations.Insert(0, selectedConversation);
|
||||
if (previousConversations.Count > MaxPreviousConversations) previousConversations.RemoveAt(MaxPreviousConversations);
|
||||
}
|
||||
lineList.Add(new Pair<Character, string>(speaker, selectedConversation.Line));
|
||||
lineList.Add((speaker, selectedConversation.Line));
|
||||
CreateConversation(availableSpeakers, assignedSpeakers, selectedConversation, lineList, availableConversations);
|
||||
}
|
||||
|
||||
|
||||
@@ -2729,12 +2729,15 @@ namespace Barotrauma
|
||||
|
||||
if (!Enabled) { return; }
|
||||
|
||||
if (Level.Loaded != null && WorldPosition.Y < Level.MaxEntityDepth ||
|
||||
(Submarine != null && Submarine.WorldPosition.Y < Level.MaxEntityDepth))
|
||||
if (Level.Loaded != null)
|
||||
{
|
||||
Enabled = false;
|
||||
Kill(CauseOfDeathType.Pressure, null);
|
||||
return;
|
||||
if (WorldPosition.Y < Level.MaxEntityDepth ||
|
||||
(Submarine != null && Submarine.WorldPosition.Y < Level.MaxEntityDepth))
|
||||
{
|
||||
Enabled = false;
|
||||
Kill(CauseOfDeathType.Pressure, null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ApplyStatusEffects(ActionType.Always, deltaTime);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -12,7 +11,7 @@ namespace Barotrauma
|
||||
|
||||
public readonly List<string> AllowedDialogTags;
|
||||
|
||||
private float commonness;
|
||||
private readonly float commonness;
|
||||
public float Commonness
|
||||
{
|
||||
get { return commonness; }
|
||||
@@ -20,12 +19,22 @@ namespace Barotrauma
|
||||
|
||||
public static IEnumerable<NPCPersonalityTrait> GetAll(LanguageIdentifier language)
|
||||
{
|
||||
if (language != TextManager.DefaultLanguage && !NPCConversationCollection.Collections.ContainsKey(language))
|
||||
{
|
||||
DebugConsole.AddWarning($"Could not find NPC personality traits for the language \"{language}\". Using \"{TextManager.DefaultLanguage}\" instead..");
|
||||
language = TextManager.DefaultLanguage;
|
||||
}
|
||||
return NPCConversationCollection.Collections[language]
|
||||
.SelectMany(cc => cc.PersonalityTraits.Values);
|
||||
}
|
||||
|
||||
public static NPCPersonalityTrait Get(LanguageIdentifier language, Identifier traitName)
|
||||
{
|
||||
if (language != TextManager.DefaultLanguage && !NPCConversationCollection.Collections.ContainsKey(language))
|
||||
{
|
||||
DebugConsole.AddWarning($"Could not find NPC personality traits for the language \"{language}\". Using \"{TextManager.DefaultLanguage}\" instead..");
|
||||
language = TextManager.DefaultLanguage;
|
||||
}
|
||||
return NPCConversationCollection.Collections[language]
|
||||
.FirstOrDefault(cc => cc.PersonalityTraits.ContainsKey(traitName))
|
||||
.PersonalityTraits[traitName];
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Barotrauma
|
||||
const float ConversationIntervalMax = 180.0f;
|
||||
const float ConversationIntervalMultiplierMultiplayer = 5.0f;
|
||||
private float conversationTimer, conversationLineTimer;
|
||||
private readonly List<Pair<Character, string>> pendingConversationLines = new List<Pair<Character, string>>();
|
||||
private readonly List<(Character speaker, string line)> pendingConversationLines = new List<(Character speaker, string line)>();
|
||||
|
||||
public const int MaxCrewSize = 16;
|
||||
|
||||
@@ -339,7 +339,7 @@ namespace Barotrauma
|
||||
|
||||
#region Dialog
|
||||
|
||||
public void AddConversation(List<Pair<Character, string>> conversationLines)
|
||||
public void AddConversation(List<(Character speaker, string line)> conversationLines)
|
||||
{
|
||||
if (conversationLines == null || conversationLines.Count == 0) { return; }
|
||||
pendingConversationLines.AddRange(conversationLines);
|
||||
@@ -428,16 +428,16 @@ namespace Barotrauma
|
||||
if (conversationLineTimer <= 0.0f)
|
||||
{
|
||||
//speaker of the next line can't speak, interrupt the conversation
|
||||
if (pendingConversationLines[0].First.SpeechImpediment >= 100.0f)
|
||||
if (pendingConversationLines[0].speaker.SpeechImpediment >= 100.0f)
|
||||
{
|
||||
pendingConversationLines.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
pendingConversationLines[0].First.Speak(pendingConversationLines[0].Second, null);
|
||||
pendingConversationLines[0].speaker.Speak(pendingConversationLines[0].line, null);
|
||||
if (pendingConversationLines.Count > 1)
|
||||
{
|
||||
conversationLineTimer = MathHelper.Clamp(pendingConversationLines[0].Second.Length * 0.1f, 1.0f, 5.0f);
|
||||
conversationLineTimer = MathHelper.Clamp(pendingConversationLines[0].line.Length * 0.1f, 1.0f, 5.0f);
|
||||
}
|
||||
pendingConversationLines.RemoveAt(0);
|
||||
}
|
||||
|
||||
@@ -1789,7 +1789,7 @@ namespace Barotrauma
|
||||
if (Math.Abs(body.LinearVelocity.X) > 0.01f || Math.Abs(body.LinearVelocity.Y) > 0.01f || transformDirty)
|
||||
{
|
||||
UpdateTransform();
|
||||
if (CurrentHull == null && body.SimPosition.Y < ConvertUnits.ToSimUnits(Level.MaxEntityDepth))
|
||||
if (CurrentHull == null && Level.Loaded != null && body.SimPosition.Y < ConvertUnits.ToSimUnits(Level.MaxEntityDepth))
|
||||
{
|
||||
Spawner?.AddItemToRemoveQueue(this);
|
||||
return;
|
||||
|
||||
@@ -8,10 +8,7 @@ using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Barotrauma.IO;
|
||||
using Voronoi2;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -25,7 +22,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
//all entities are disabled after they reach this depth
|
||||
public const int MaxEntityDepth = -300000;
|
||||
public const int MaxEntityDepth = -1000000;
|
||||
public const float ShaftHeight = 1000.0f;
|
||||
/// <summary>
|
||||
/// The level generator won't try to adjust the width of the main path above this limit.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Steamworks.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -74,6 +75,24 @@ namespace Barotrauma.Steam
|
||||
return Steamworks.SteamClient.Name;
|
||||
}
|
||||
|
||||
public static uint GetNumSubscribedItems()
|
||||
{
|
||||
if (!IsInitialized || !Steamworks.SteamClient.IsValid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return Steamworks.SteamUGC.NumSubscribedItems;
|
||||
}
|
||||
|
||||
public static PublishedFileId[] GetSubscribedItems()
|
||||
{
|
||||
if (!IsInitialized || !Steamworks.SteamClient.IsValid)
|
||||
{
|
||||
return new PublishedFileId[0];
|
||||
}
|
||||
return Steamworks.SteamUGC.GetSubscribedItems();
|
||||
}
|
||||
|
||||
public static bool UnlockAchievement(string achievementIdentifier) =>
|
||||
UnlockAchievement(achievementIdentifier.ToIdentifier());
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Barotrauma
|
||||
#if DEBUG
|
||||
if (!lStr.IsNullOrEmpty() && lStr.Contains("‖"))
|
||||
{
|
||||
if (Debugger.IsAttached) { Debugger.Break(); }
|
||||
//if (Debugger.IsAttached) { Debugger.Break(); }
|
||||
}
|
||||
#endif
|
||||
return Plain(lStr ?? string.Empty);
|
||||
|
||||
Reference in New Issue
Block a user