(2a4bd39c2) Merge branch 'dev' into human-ai
This commit is contained in:
@@ -217,7 +217,6 @@ namespace Barotrauma
|
||||
currItemPriority = itemPriority;
|
||||
targetItem = item;
|
||||
moveToTarget = rootContainer ?? item;
|
||||
|
||||
}
|
||||
//if searched through all the items and a target wasn't found, can't be completed
|
||||
if (currSearchIndex >= Item.ItemList.Count - 1 && targetItem == null)
|
||||
|
||||
@@ -199,11 +199,5 @@ namespace Barotrauma
|
||||
float interactionDistance = Target is Item i ? ConvertUnits.ToSimUnits(i.InteractDistance * 0.9f) : 0;
|
||||
CloseEnough = Math.Max(interactionDistance, CloseEnough);
|
||||
}
|
||||
|
||||
private void CalculateCloseEnough()
|
||||
{
|
||||
float interactionDistance = Target is Item i ? ConvertUnits.ToSimUnits(i.InteractDistance * 0.9f) : 0;
|
||||
CloseEnough = Math.Max(interactionDistance, CloseEnough);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,21 +74,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
if (objectiveManager.CurrentObjective == this)
|
||||
{
|
||||
if (randomTimer > 0)
|
||||
{
|
||||
randomTimer -= deltaTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetRandom();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsCompleted() => false;
|
||||
public override bool CanBeCompleted => true;
|
||||
|
||||
|
||||
@@ -82,6 +82,10 @@ namespace Barotrauma
|
||||
{
|
||||
isCompleted = true;
|
||||
}
|
||||
if (component.AIOperate(deltaTime, character, this))
|
||||
{
|
||||
isCompleted = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2023,6 +2023,10 @@ namespace Barotrauma
|
||||
{
|
||||
IsRagdolled = IsForceRagdolled;
|
||||
}
|
||||
else if (IsRemotePlayer)
|
||||
{
|
||||
IsRagdolled = IsKeyDown(InputType.Ragdoll);
|
||||
}
|
||||
//Keep us ragdolled if we were forced or we're too speedy to unragdoll
|
||||
else if (allowRagdoll && (!IsRagdolled || AnimController.Collider.LinearVelocity.LengthSquared() < 1f))
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Barotrauma
|
||||
if (!CheatsEnabled && IsCheat)
|
||||
{
|
||||
NewMessage("You need to enable cheats using the command \"enablecheats\" before you can use the command \"" + names[0] + "\".", Color.Red);
|
||||
if (GameMain.Config.UseSteam)
|
||||
if (Steam.SteamManager.USE_STEAM)
|
||||
{
|
||||
NewMessage("Enabling cheats will disable Steam achievements during this play session.", Color.Red);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Barotrauma
|
||||
|
||||
public bool CheatsEnabled;
|
||||
|
||||
const int InitialMoney = 4700;
|
||||
const int InitialMoney = 8700;
|
||||
public const int HullRepairCost = 500, ItemRepairCost = 500;
|
||||
|
||||
protected bool watchmenSpawned;
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace Barotrauma
|
||||
if (CheatsEnabled)
|
||||
{
|
||||
DebugConsole.CheatsEnabled = true;
|
||||
if (GameMain.Config.UseSteam && !SteamAchievementManager.CheatsEnabled)
|
||||
if (Steam.SteamManager.USE_STEAM && !SteamAchievementManager.CheatsEnabled)
|
||||
{
|
||||
SteamAchievementManager.CheatsEnabled = true;
|
||||
#if CLIENT
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace Barotrauma
|
||||
public bool SpecularityEnabled { get; set; }
|
||||
public bool ChromaticAberrationEnabled { get; set; }
|
||||
|
||||
public bool PauseOnFocusLost { get; set; } = true;
|
||||
public bool MuteOnFocusLost { get; set; }
|
||||
public bool UseDirectionalVoiceChat { get; set; }
|
||||
|
||||
@@ -77,24 +78,17 @@ namespace Barotrauma
|
||||
|
||||
#if DEBUG
|
||||
//steam functionality can be enabled/disabled in debug builds
|
||||
public bool UseSteam;
|
||||
public bool RequireSteamAuthentication
|
||||
{
|
||||
get { return requireSteamAuthentication && UseSteam; }
|
||||
get { return requireSteamAuthentication && Steam.SteamManager.USE_STEAM; }
|
||||
set { requireSteamAuthentication = value; }
|
||||
}
|
||||
public bool UseSteamMatchmaking
|
||||
{
|
||||
get { return useSteamMatchmaking && UseSteam; }
|
||||
get { return useSteamMatchmaking && Steam.SteamManager.USE_STEAM; }
|
||||
set { useSteamMatchmaking = value; }
|
||||
}
|
||||
|
||||
#else
|
||||
//steam functionality determined at compile time
|
||||
public bool UseSteam
|
||||
{
|
||||
get { return Steam.SteamManager.USE_STEAM; }
|
||||
}
|
||||
public bool RequireSteamAuthentication
|
||||
{
|
||||
get { return requireSteamAuthentication && Steam.SteamManager.USE_STEAM; }
|
||||
@@ -438,9 +432,6 @@ namespace Barotrauma
|
||||
VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false);
|
||||
SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false);
|
||||
|
||||
#if DEBUG
|
||||
UseSteam = doc.Root.GetAttributeBool("usesteam", true);
|
||||
#endif
|
||||
QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", "");
|
||||
|
||||
if (doc == null)
|
||||
@@ -850,6 +841,7 @@ namespace Barotrauma
|
||||
|
||||
EnableSplashScreen = doc.Root.GetAttributeBool("enablesplashscreen", EnableSplashScreen);
|
||||
|
||||
PauseOnFocusLost = doc.Root.GetAttributeBool("pauseonfocuslost", PauseOnFocusLost);
|
||||
AimAssistAmount = doc.Root.GetAttributeFloat("aimassistamount", AimAssistAmount);
|
||||
EnableMouseLook = doc.Root.GetAttributeBool("enablemouselook", EnableMouseLook);
|
||||
|
||||
@@ -1047,6 +1039,7 @@ namespace Barotrauma
|
||||
new XAttribute("quickstartsub", QuickStartSubmarineName),
|
||||
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
|
||||
new XAttribute("autoupdateworkshopitems", AutoUpdateWorkshopItems),
|
||||
new XAttribute("pauseonfocuslost", PauseOnFocusLost),
|
||||
new XAttribute("aimassistamount", aimAssistAmount),
|
||||
new XAttribute("enablemouselook", EnableMouseLook),
|
||||
new XAttribute("chatopen", ChatOpen),
|
||||
@@ -1155,9 +1148,9 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (Tutorial tutorial in Tutorial.Tutorials)
|
||||
{
|
||||
if (tutorial.Completed && !CompletedTutorialNames.Contains(tutorial.Name))
|
||||
if (tutorial.Completed && !CompletedTutorialNames.Contains(tutorial.Identifier))
|
||||
{
|
||||
CompletedTutorialNames.Add(tutorial.Name);
|
||||
CompletedTutorialNames.Add(tutorial.Identifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -580,8 +580,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public virtual bool HasRequiredItems(Character character, bool addMessage, string msg = null)
|
||||
{
|
||||
if (!requiredItems.Any()) return true;
|
||||
if (character.Inventory == null) return false;
|
||||
if (!requiredItems.Any()) { return true; }
|
||||
if (character.Inventory == null) { return false; }
|
||||
bool hasRequiredItems = false;
|
||||
bool canContinue = true;
|
||||
if (requiredItems.ContainsKey(RelatedItem.RelationType.Equipped))
|
||||
@@ -615,7 +615,15 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
bool Predicate(Item it) => it != null && it.Condition > 0.0f && relatedItem.MatchesItem(it);
|
||||
bool shouldBreak = false;
|
||||
if (relatedItem.IsOptional)
|
||||
bool inEditor = false;
|
||||
#if CLIENT
|
||||
inEditor = Screen.Selected == GameMain.SubEditorScreen;
|
||||
#endif
|
||||
if (relatedItem.IgnoreInEditor && inEditor)
|
||||
{
|
||||
hasRequiredItems = true;
|
||||
}
|
||||
else if (relatedItem.IsOptional)
|
||||
{
|
||||
if (!hasRequiredItems)
|
||||
{
|
||||
@@ -784,6 +792,7 @@ namespace Barotrauma.Items.Components
|
||||
newRequiredItem.statusEffects = prevRequiredItem.statusEffects;
|
||||
newRequiredItem.Msg = prevRequiredItem.Msg;
|
||||
newRequiredItem.IsOptional = prevRequiredItem.IsOptional;
|
||||
newRequiredItem.IgnoreInEditor = prevRequiredItem.IgnoreInEditor;
|
||||
}
|
||||
|
||||
if (!requiredItems.ContainsKey(newRequiredItem.Type))
|
||||
|
||||
@@ -829,6 +829,25 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
if (targetItem.Prefab.DeconstructItems.Any())
|
||||
{
|
||||
inputContainer.Inventory.RemoveItem(targetItem);
|
||||
Entity.Spawner.AddToRemoveQueue(targetItem);
|
||||
MoveInputQueue();
|
||||
PutItemsToLinkedContainer();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (outputContainer.Inventory.Items.All(i => i != null))
|
||||
{
|
||||
targetItem.Drop(dropper: null);
|
||||
}
|
||||
else
|
||||
{
|
||||
outputContainer.Inventory.TryPutItem(targetItem, user: null, createNetworkEvent: true);
|
||||
}
|
||||
}
|
||||
|
||||
if (targetItem.Prefab.DeconstructItems.Any())
|
||||
{
|
||||
inputContainer.Inventory.RemoveItem(targetItem);
|
||||
|
||||
@@ -212,33 +212,6 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2? PosToMaintain
|
||||
{
|
||||
get { return posToMaintain; }
|
||||
set { posToMaintain = value; }
|
||||
}
|
||||
|
||||
struct ObstacleDebugInfo
|
||||
{
|
||||
public Vector2 Point1;
|
||||
public Vector2 Point2;
|
||||
|
||||
public Vector2? Intersection;
|
||||
|
||||
public float Dot;
|
||||
|
||||
public Vector2 AvoidStrength;
|
||||
|
||||
public ObstacleDebugInfo(GraphEdge edge, Vector2? intersection, float dot, Vector2 avoidStrength)
|
||||
{
|
||||
Point1 = edge.Point1;
|
||||
Point2 = edge.Point2;
|
||||
Intersection = intersection;
|
||||
Dot = dot;
|
||||
AvoidStrength = avoidStrength;
|
||||
}
|
||||
}
|
||||
|
||||
//edge point 1, edge point 2, avoid strength
|
||||
private List<ObstacleDebugInfo> debugDrawObstacles = new List<ObstacleDebugInfo>();
|
||||
|
||||
|
||||
@@ -1464,6 +1464,10 @@ namespace Barotrauma
|
||||
{
|
||||
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
||||
}
|
||||
if (!broken)
|
||||
{
|
||||
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
||||
}
|
||||
ApplyStatusEffects(!waterProof && inWater ? ActionType.InWater : ActionType.NotInWater, deltaTime);
|
||||
|
||||
if (body == null || !body.Enabled || !inWater || ParentInventory != null || Removed) { return; }
|
||||
|
||||
@@ -17,8 +17,8 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
public bool IsOptional { get; set; }
|
||||
|
||||
private string[] identifiers;
|
||||
|
||||
public bool IgnoreInEditor { get; set; }
|
||||
|
||||
private string[] excludedIdentifiers;
|
||||
|
||||
@@ -35,23 +35,20 @@ namespace Barotrauma
|
||||
|
||||
public string JoinedIdentifiers
|
||||
{
|
||||
get { return string.Join(",", identifiers); }
|
||||
get { return string.Join(",", Identifiers); }
|
||||
set
|
||||
{
|
||||
if (value == null) return;
|
||||
|
||||
identifiers = value.Split(',');
|
||||
for (int i = 0; i < identifiers.Length; i++)
|
||||
Identifiers = value.Split(',');
|
||||
for (int i = 0; i < Identifiers.Length; i++)
|
||||
{
|
||||
identifiers[i] = identifiers[i].Trim().ToLowerInvariant();
|
||||
Identifiers[i] = Identifiers[i].Trim().ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string[] Identifiers
|
||||
{
|
||||
get { return identifiers; }
|
||||
}
|
||||
|
||||
public string[] Identifiers { get; private set; }
|
||||
|
||||
public string JoinedExcludedIdentifiers
|
||||
{
|
||||
@@ -72,7 +69,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (item == null) return false;
|
||||
if (excludedIdentifiers.Any(id => item.Prefab.Identifier == id || item.HasTag(id))) return false;
|
||||
return identifiers.Any(id => item.Prefab.Identifier == id || item.HasTag(id));
|
||||
return Identifiers.Any(id => item.Prefab.Identifier == id || item.HasTag(id));
|
||||
}
|
||||
|
||||
public RelatedItem(string[] identifiers, string[] excludedIdentifiers)
|
||||
@@ -81,7 +78,7 @@ namespace Barotrauma
|
||||
{
|
||||
identifiers[i] = identifiers[i].Trim().ToLowerInvariant();
|
||||
}
|
||||
this.identifiers = identifiers;
|
||||
this.Identifiers = identifiers;
|
||||
|
||||
for (int i = 0; i < excludedIdentifiers.Length; i++)
|
||||
{
|
||||
@@ -141,7 +138,8 @@ namespace Barotrauma
|
||||
element.Add(
|
||||
new XAttribute("identifiers", JoinedIdentifiers),
|
||||
new XAttribute("type", type.ToString()),
|
||||
new XAttribute("optional", IsOptional));
|
||||
new XAttribute("optional", IsOptional),
|
||||
new XAttribute("ignoreineditor", IgnoreInEditor));
|
||||
|
||||
if (excludedIdentifiers.Length > 0)
|
||||
{
|
||||
@@ -223,6 +221,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
ri.IsOptional = element.GetAttributeBool("optional", false);
|
||||
ri.IgnoreInEditor = element.GetAttributeBool("ignoreineditor", false);
|
||||
return ri;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -645,6 +645,25 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public string DisplayName
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
private string roomName;
|
||||
[Editable, Serialize("", true, translationTextTag: "RoomName.")]
|
||||
public string RoomName
|
||||
{
|
||||
get { return roomName; }
|
||||
set
|
||||
{
|
||||
if (roomName == value) { return; }
|
||||
roomName = value;
|
||||
DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName;
|
||||
}
|
||||
}
|
||||
|
||||
public override Rectangle Rect
|
||||
{
|
||||
get
|
||||
|
||||
@@ -7,15 +7,7 @@ namespace Barotrauma.Steam
|
||||
{
|
||||
partial class SteamManager
|
||||
{
|
||||
#if DEBUG
|
||||
public static bool USE_STEAM
|
||||
{
|
||||
get { return GameMain.Config.UseSteam; }
|
||||
}
|
||||
#else
|
||||
//cannot enable/disable steam in release builds
|
||||
public const bool USE_STEAM = true;
|
||||
#endif
|
||||
|
||||
public const uint AppID = 602960;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -15,7 +16,15 @@ namespace Barotrauma
|
||||
private static string[] serverMessageCharacters = new string[] { "~", "[", "]", "=" };
|
||||
|
||||
public static string Language;
|
||||
|
||||
public static bool NoWhiteSpace
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!textPacks.ContainsKey(Language)) { return false; }
|
||||
return textPacks[Language].Any(t => t.NoWhiteSpace);
|
||||
}
|
||||
}
|
||||
|
||||
private static HashSet<string> availableLanguages = new HashSet<string>();
|
||||
public static IEnumerable<string> AvailableLanguages
|
||||
{
|
||||
|
||||
@@ -12,7 +12,9 @@ namespace Barotrauma
|
||||
|
||||
private Dictionary<string, List<string>> texts;
|
||||
|
||||
private string filePath;
|
||||
public readonly bool NoWhiteSpace;
|
||||
|
||||
private readonly string filePath;
|
||||
|
||||
public TextPack(string filePath)
|
||||
{
|
||||
@@ -23,6 +25,7 @@ namespace Barotrauma
|
||||
if (doc == null || doc.Root == null) return;
|
||||
|
||||
Language = doc.Root.GetAttributeString("language", "Unknown");
|
||||
NoWhiteSpace = doc.Root.GetAttributeBool("nowhitespace", false);
|
||||
|
||||
foreach (XElement subElement in doc.Root.Elements())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user