(36d2ff935) Merge branch 'dev' of github.com:Regalis11/Barotrauma-development into dev
This commit is contained in:
@@ -485,7 +485,11 @@ namespace Barotrauma
|
||||
}
|
||||
else if (ObjectiveManager.CurrentOrder is AIObjectiveRescueAll rescueAll && rescueAll.Targets.None())
|
||||
{
|
||||
Character.Speak(TextManager.Get("DialogNoRescueTargets"), null, 3.0f, "norescuetargets");
|
||||
//TODO: re-enable on all languages after DialogNoRescueTargets has been translated
|
||||
if (TextManager.Language == "English")
|
||||
{
|
||||
Character.Speak(TextManager.Get("DialogNoRescueTargets"), null, 3.0f, "norescuetargets");
|
||||
}
|
||||
}
|
||||
else if (ObjectiveManager.CurrentOrder is AIObjectivePumpWater pumpWater && pumpWater.Targets.None())
|
||||
{
|
||||
|
||||
@@ -22,7 +22,16 @@ namespace Barotrauma
|
||||
public AIObjectiveRescue(Character character, Character targetCharacter, AIObjectiveManager objectiveManager, float priorityModifier = 1)
|
||||
: base(character, objectiveManager, priorityModifier)
|
||||
{
|
||||
if (targetCharacter != character)
|
||||
if (targetCharacter == null)
|
||||
{
|
||||
string errorMsg = "Attempted to create a Rescue objective with no target!\n" + Environment.StackTrace;
|
||||
DebugConsole.ThrowError(errorMsg);
|
||||
GameAnalyticsManager.AddErrorEventOnce("AIObjectiveRescue:ctor:targetnull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
abandon = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetCharacter == character)
|
||||
{
|
||||
// TODO: enable healing self too
|
||||
abandon = true;
|
||||
@@ -39,6 +48,11 @@ namespace Barotrauma
|
||||
|
||||
protected override void Act(float deltaTime)
|
||||
{
|
||||
if (targetCharacter == null || targetCharacter.Removed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Unconcious target is not in a safe place -> Move to a safe place first
|
||||
if (targetCharacter.IsUnconscious && HumanAIController.GetHullSafety(targetCharacter.CurrentHull, targetCharacter) < HumanAIController.HULL_SAFETY_THRESHOLD)
|
||||
{
|
||||
@@ -206,13 +220,19 @@ namespace Barotrauma
|
||||
|
||||
public override bool IsCompleted()
|
||||
{
|
||||
if (targetCharacter == null || targetCharacter.Removed)
|
||||
{
|
||||
abandon = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isCompleted = targetCharacter.Bleeding <= 0 && targetCharacter.Vitality / targetCharacter.MaxVitality > AIObjectiveRescueAll.GetVitalityThreshold(objectiveManager);
|
||||
if (isCompleted)
|
||||
{
|
||||
character.Speak(TextManager.Get("DialogTargetHealed").Replace("[targetname]", targetCharacter.Name),
|
||||
null, 1.0f, "targethealed" + targetCharacter.Name, 60.0f);
|
||||
}
|
||||
return isCompleted || targetCharacter.Removed || targetCharacter.IsDead;
|
||||
return isCompleted || targetCharacter.IsDead;
|
||||
}
|
||||
|
||||
public override float GetPriority()
|
||||
|
||||
@@ -240,6 +240,11 @@ namespace Barotrauma
|
||||
errorMessages = new List<string>();
|
||||
foreach (ContentFile file in Files)
|
||||
{
|
||||
#if SERVER
|
||||
//dedicated server doesn't care if the client executable is present or not
|
||||
if (file.Type == ContentType.Executable) { continue; }
|
||||
#endif
|
||||
|
||||
if (!File.Exists(file.Path))
|
||||
{
|
||||
errorMessages.Add("File \"" + file.Path + "\" not found.");
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -42,6 +43,26 @@ namespace Barotrauma
|
||||
GetTextFilesRecursive(subDir, ref list);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the name of the language in the respective language
|
||||
/// </summary>
|
||||
public static string GetTranslatedLanguageName(string language)
|
||||
{
|
||||
if (!textPacks.ContainsKey(language))
|
||||
{
|
||||
return language;
|
||||
}
|
||||
|
||||
foreach (var textPack in textPacks[language])
|
||||
{
|
||||
if (textPack.Language == language)
|
||||
{
|
||||
return textPack.TranslatedName;
|
||||
}
|
||||
}
|
||||
return language;
|
||||
}
|
||||
|
||||
public static void LoadTextPacks(IEnumerable<ContentPackage> selectedContentPackages)
|
||||
{
|
||||
@@ -111,8 +132,6 @@ namespace Barotrauma
|
||||
throw new Exception("No text packs available in English!");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (TextPack textPack in textPacks[Language])
|
||||
{
|
||||
@@ -393,42 +412,6 @@ namespace Barotrauma
|
||||
return isCJK.IsMatch(text);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
public static void CheckForDuplicates(string lang)
|
||||
{
|
||||
if (!textPacks.ContainsKey(lang))
|
||||
{
|
||||
DebugConsole.ThrowError("No text packs available for the selected language (" + lang + ")!");
|
||||
return;
|
||||
}
|
||||
|
||||
int packIndex = 0;
|
||||
foreach (TextPack textPack in textPacks[lang])
|
||||
{
|
||||
textPack.CheckForDuplicates(packIndex);
|
||||
packIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
public static void WriteToCSV()
|
||||
{
|
||||
string lang = "English";
|
||||
|
||||
if (!textPacks.ContainsKey(lang))
|
||||
{
|
||||
DebugConsole.ThrowError("No text packs available for the selected language (" + lang + ")!");
|
||||
return;
|
||||
}
|
||||
|
||||
int packIndex = 0;
|
||||
foreach (TextPack textPack in textPacks[lang])
|
||||
{
|
||||
textPack.WriteToCSV(packIndex);
|
||||
packIndex++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
public static void CheckForDuplicates(string lang)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,11 @@ namespace Barotrauma
|
||||
{
|
||||
public readonly string Language;
|
||||
|
||||
/// <summary>
|
||||
/// The name of the language in the language this pack is written in
|
||||
/// </summary>
|
||||
public readonly string TranslatedName;
|
||||
|
||||
private Dictionary<string, List<string>> texts;
|
||||
|
||||
private readonly string filePath;
|
||||
@@ -23,6 +28,7 @@ namespace Barotrauma
|
||||
if (doc == null || doc.Root == null) return;
|
||||
|
||||
Language = doc.Root.GetAttributeString("language", "Unknown");
|
||||
TranslatedName = doc.Root.GetAttributeString("translatedname", Language);
|
||||
|
||||
foreach (XElement subElement in doc.Root.Elements())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user