v1.2.7.0 (Winter Update hotfix)
This commit is contained in:
+1
@@ -454,6 +454,7 @@ namespace Barotrauma
|
||||
if (!itemInventory.Container.HasRequiredItems(character, addMessage: false)) { continue; }
|
||||
}
|
||||
float itemPriority = item.Prefab.BotPriority;
|
||||
if (itemPriority <= 0) { continue; }
|
||||
if (GetItemPriority != null)
|
||||
{
|
||||
itemPriority *= GetItemPriority(item);
|
||||
|
||||
+4
@@ -163,6 +163,10 @@ namespace Barotrauma
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (autonomousObjective.IgnoreAtNonOutpost && !Level.IsLoadedFriendlyOutpost)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var objective = CreateObjective(order, autonomousObjective.PriorityModifier);
|
||||
if (objective != null && objective.CanBeCompleted)
|
||||
{
|
||||
|
||||
@@ -740,28 +740,32 @@ namespace Barotrauma
|
||||
{
|
||||
Stairs = character.SelectedBy.AnimController.Stairs;
|
||||
}
|
||||
|
||||
var collisionResponse = getStairCollisionResponse();
|
||||
if (collisionResponse == LimbStairCollisionResponse.ClimbWithLimbCollision)
|
||||
{
|
||||
Stairs = structure;
|
||||
}
|
||||
else
|
||||
{
|
||||
var collisionResponse = handleLimbStairCollision();
|
||||
if (collisionResponse == LimbStairCollisionResponse.ClimbWithLimbCollision)
|
||||
{
|
||||
Stairs = structure;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (collisionResponse == LimbStairCollisionResponse.DontClimbStairs) { Stairs = null; }
|
||||
if (collisionResponse == LimbStairCollisionResponse.DontClimbStairs) { Stairs = null; }
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
LimbStairCollisionResponse handleLimbStairCollision()
|
||||
LimbStairCollisionResponse getStairCollisionResponse()
|
||||
{
|
||||
//don't collide with stairs if
|
||||
|
||||
//1. bottom of the collider is at the bottom of the stairs and the character isn't trying to move upwards
|
||||
float stairBottomPos = ConvertUnits.ToSimUnits(structure.Rect.Y - structure.Rect.Height + 10);
|
||||
if (colliderBottom.Y < stairBottomPos && targetMovement.Y < 0.5f) { return LimbStairCollisionResponse.DontClimbStairs; }
|
||||
if (character.SelectedBy != null &&
|
||||
character.SelectedBy.AnimController.GetColliderBottom().Y < stairBottomPos &&
|
||||
character.SelectedBy.AnimController.targetMovement.Y < 0.5f)
|
||||
{
|
||||
return LimbStairCollisionResponse.DontClimbStairs;
|
||||
}
|
||||
|
||||
//2. bottom of the collider is at the top of the stairs and the character isn't trying to move downwards
|
||||
if (targetMovement.Y >= 0.0f && colliderBottom.Y >= ConvertUnits.ToSimUnits(structure.Rect.Y - Submarine.GridSize.Y * 5)) { return LimbStairCollisionResponse.DontClimbStairs; }
|
||||
|
||||
+1
-1
@@ -904,7 +904,7 @@ namespace Barotrauma
|
||||
string indicatorLimbName = element.GetAttributeString("indicatorlimb", "Torso");
|
||||
if (!Enum.TryParse(indicatorLimbName, out IndicatorLimb))
|
||||
{
|
||||
DebugConsole.ThrowError("Error in affliction prefab " + Name + " - limb type \"" + indicatorLimbName + "\" not found.");
|
||||
DebugConsole.ThrowErrorLocalized("Error in affliction prefab " + Name + " - limb type \"" + indicatorLimbName + "\" not found.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,11 +150,11 @@ namespace Barotrauma
|
||||
if (itemElement.Attribute("name") != null)
|
||||
{
|
||||
string itemName = itemElement.Attribute("name").Value;
|
||||
DebugConsole.ThrowError("Error in Job config (" + Name + ") - use item identifiers instead of names to configure the items.");
|
||||
DebugConsole.ThrowErrorLocalized("Error in Job config (" + Name + ") - use item identifiers instead of names to configure the items.");
|
||||
itemPrefab = MapEntityPrefab.FindByName(itemName) as ItemPrefab;
|
||||
if (itemPrefab == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Tried to spawn \"" + Name + "\" with the item \"" + itemName + "\". Matching item prefab not found.");
|
||||
DebugConsole.ThrowErrorLocalized("Tried to spawn \"" + Name + "\" with the item \"" + itemName + "\". Matching item prefab not found.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ namespace Barotrauma
|
||||
itemPrefab = MapEntityPrefab.FindByIdentifier(itemIdentifier.ToIdentifier()) as ItemPrefab;
|
||||
if (itemPrefab == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Tried to spawn \"" + Name + "\" with the item \"" + itemIdentifier + "\". Matching item prefab not found.");
|
||||
DebugConsole.ThrowErrorLocalized("Tried to spawn \"" + Name + "\" with the item \"" + itemIdentifier + "\". Matching item prefab not found.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,14 @@ namespace Barotrauma
|
||||
public readonly Identifier Identifier;
|
||||
public readonly Identifier Option;
|
||||
public readonly float PriorityModifier;
|
||||
/// <summary>
|
||||
/// The order is ignored in outpost levels. Doesn't apply to outpost NPCs.
|
||||
/// </summary>
|
||||
public readonly bool IgnoreAtOutpost;
|
||||
/// <summary>
|
||||
/// The order is ignored in "normal" non-outpost levels
|
||||
/// </summary>
|
||||
public readonly bool IgnoreAtNonOutpost;
|
||||
|
||||
public AutonomousObjective(XElement element)
|
||||
{
|
||||
@@ -29,6 +36,7 @@ namespace Barotrauma
|
||||
PriorityModifier = element.GetAttributeFloat("prioritymodifier", 1);
|
||||
PriorityModifier = MathHelper.Max(PriorityModifier, 0);
|
||||
IgnoreAtOutpost = element.GetAttributeBool("ignoreatoutpost", false);
|
||||
IgnoreAtNonOutpost = element.GetAttributeBool("ignoreatnonoutpost", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,14 +252,14 @@ namespace Barotrauma
|
||||
{
|
||||
if (itemElement.Element("name") != null)
|
||||
{
|
||||
DebugConsole.ThrowError("Error in job config \"" + Name + "\" - use identifiers instead of names to configure the items.");
|
||||
DebugConsole.ThrowErrorLocalized("Error in job config \"" + Name + "\" - use identifiers instead of names to configure the items.");
|
||||
continue;
|
||||
}
|
||||
|
||||
Identifier itemIdentifier = itemElement.GetAttributeIdentifier("identifier", Identifier.Empty);
|
||||
if (itemIdentifier.IsEmpty)
|
||||
{
|
||||
DebugConsole.ThrowError("Error in job config \"" + Name + "\" - item with no identifier.");
|
||||
DebugConsole.ThrowErrorLocalized("Error in job config \"" + Name + "\" - item with no identifier.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+10
-5
@@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using Barotrauma.Items.Components;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma.Abilities
|
||||
{
|
||||
@@ -25,11 +24,15 @@ namespace Barotrauma.Abilities
|
||||
private readonly Identifier[] tags;
|
||||
private readonly WeaponType weapontype;
|
||||
private readonly bool ignoreNonHarmfulAttacks;
|
||||
|
||||
private readonly bool ignoreOwnAttacks;
|
||||
|
||||
public AbilityConditionAttackData(CharacterTalent characterTalent, ContentXElement conditionElement) : base(characterTalent, conditionElement)
|
||||
{
|
||||
itemIdentifier = conditionElement.GetAttributeString("itemidentifier", string.Empty);
|
||||
tags = conditionElement.GetAttributeIdentifierArray("tags", Array.Empty<Identifier>());
|
||||
ignoreNonHarmfulAttacks = conditionElement.GetAttributeBool("ignorenonharmfulattacks", false);
|
||||
itemIdentifier = conditionElement.GetAttributeString(nameof(itemIdentifier), string.Empty);
|
||||
tags = conditionElement.GetAttributeIdentifierArray(nameof(tags), Array.Empty<Identifier>());
|
||||
ignoreNonHarmfulAttacks = conditionElement.GetAttributeBool(nameof(ignoreNonHarmfulAttacks), false);
|
||||
ignoreOwnAttacks = conditionElement.GetAttributeBool(nameof(ignoreOwnAttacks), false);
|
||||
|
||||
string weaponTypeStr = conditionElement.GetAttributeString("weapontype", "Any");
|
||||
if (!Enum.TryParse(weaponTypeStr, ignoreCase: true, out weapontype))
|
||||
@@ -43,6 +46,8 @@ namespace Barotrauma.Abilities
|
||||
{
|
||||
if (abilityObject is AbilityAttackData attackData)
|
||||
{
|
||||
if (ignoreOwnAttacks && attackData.Attacker == character) { return false; }
|
||||
|
||||
if (ignoreNonHarmfulAttacks && attackData.SourceAttack != null)
|
||||
{
|
||||
if (attackData.SourceAttack.Stun <= 0.0f && (attackData.SourceAttack.Afflictions?.All(a => a.Key.Prefab.IsBuff) ?? true))
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#nullable enable
|
||||
|
||||
namespace Barotrauma.Abilities
|
||||
{
|
||||
internal sealed class CharacterAbilityReplaceAffliction : CharacterAbility
|
||||
{
|
||||
private readonly Identifier afflictionId;
|
||||
private readonly Identifier newAfflictionId;
|
||||
private readonly float strengthMultiplier;
|
||||
|
||||
public CharacterAbilityReplaceAffliction(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement) : base(characterAbilityGroup, abilityElement)
|
||||
{
|
||||
afflictionId = abilityElement.GetAttributeIdentifier("afflictionid", abilityElement.GetAttributeIdentifier("affliction", Identifier.Empty));
|
||||
newAfflictionId = abilityElement.GetAttributeIdentifier("newafflictionid", abilityElement.GetAttributeIdentifier("newaffliction", Identifier.Empty));
|
||||
|
||||
strengthMultiplier = abilityElement.GetAttributeFloat("strengthmultiplier", 1.0f);
|
||||
|
||||
if (afflictionId.IsEmpty)
|
||||
{
|
||||
DebugConsole.ThrowError($"Error in {nameof(CharacterAbilityReplaceAffliction)} - affliction identifier not set.");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ApplyEffect()
|
||||
{
|
||||
var affliction = Character.CharacterHealth.GetAffliction(afflictionId);
|
||||
if (affliction != null)
|
||||
{
|
||||
float afflictionStrength = affliction.Strength;
|
||||
Limb limb = Character.CharacterHealth.GetAfflictionLimb(affliction);
|
||||
Character.CharacterHealth.ReduceAfflictionOnAllLimbs(affliction.Identifier, afflictionStrength);
|
||||
if (!newAfflictionId.IsEmpty && AfflictionPrefab.Prefabs.TryGet(newAfflictionId, out var newAfflictionPrefab))
|
||||
{
|
||||
Character.CharacterHealth.ApplyAffliction(targetLimb: limb, newAfflictionPrefab.Instantiate(afflictionStrength * strengthMultiplier));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void VerifyState(bool conditionsMatched, float timeSinceLastUpdate)
|
||||
{
|
||||
if (conditionsMatched)
|
||||
{
|
||||
ApplyEffect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -1,14 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma.Abilities
|
||||
{
|
||||
class CharacterAbilityGroupInterval : CharacterAbilityGroup
|
||||
{
|
||||
private float interval { get; set; }
|
||||
private readonly float interval;
|
||||
public float TimeSinceLastUpdate { get; private set; }
|
||||
|
||||
private float effectDelay;
|
||||
private readonly float effectDelay;
|
||||
private float effectDelayTimer;
|
||||
|
||||
|
||||
|
||||
@@ -2561,9 +2561,9 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public static void ThrowError(LocalizedString error, Exception e = null, bool createMessageBox = false, bool appendStackTrace = false)
|
||||
public static void ThrowErrorLocalized(LocalizedString error, Exception e = null, ContentPackage contentPackage = null, bool createMessageBox = false, bool appendStackTrace = false)
|
||||
{
|
||||
ThrowError(error.Value, e, createMessageBox, appendStackTrace);
|
||||
ThrowError(error.Value, e, contentPackage, createMessageBox, appendStackTrace);
|
||||
}
|
||||
|
||||
public static void ThrowError(string error, Exception e = null, ContentPackage contentPackage = null, bool createMessageBox = false, bool appendStackTrace = false)
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -36,8 +33,7 @@ namespace Barotrauma
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
if (isFinished) { return; }
|
||||
var afflictionPrefab = AfflictionPrefab.List.FirstOrDefault(p => p.Identifier == Affliction);
|
||||
if (afflictionPrefab != null)
|
||||
if (AfflictionPrefab.Prefabs.TryGet(Affliction, out var afflictionPrefab))
|
||||
{
|
||||
var targets = ParentEvent.GetTargets(TargetTag);
|
||||
foreach (var target in targets)
|
||||
|
||||
@@ -364,12 +364,12 @@ namespace Barotrauma
|
||||
|
||||
if (!Enum.TryParse(missionTypeName.Value, true, out Type))
|
||||
{
|
||||
DebugConsole.ThrowError("Error in mission prefab \"" + Name + "\" - \"" + missionTypeName + "\" is not a valid mission type.");
|
||||
DebugConsole.ThrowErrorLocalized("Error in mission prefab \"" + Name + "\" - \"" + missionTypeName + "\" is not a valid mission type.");
|
||||
return;
|
||||
}
|
||||
if (Type == MissionType.None)
|
||||
{
|
||||
DebugConsole.ThrowError("Error in mission prefab \"" + Name + "\" - mission type cannot be none.");
|
||||
DebugConsole.ThrowErrorLocalized("Error in mission prefab \"" + Name + "\" - mission type cannot be none.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugConsole.ThrowError("Error in mission prefab \"" + Name + "\" - unsupported mission type \"" + Type.ToString() + "\"");
|
||||
DebugConsole.ThrowErrorLocalized("Error in mission prefab \"" + Name + "\" - unsupported mission type \"" + Type.ToString() + "\"");
|
||||
}
|
||||
if (constructor == null)
|
||||
{
|
||||
|
||||
@@ -269,7 +269,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (response.ErrorException != null)
|
||||
{
|
||||
DebugConsole.ThrowError(TextManager.GetWithVariable("MasterServerErrorException", "[error]", response.ErrorException.ToString()));
|
||||
DebugConsole.ThrowErrorLocalized(TextManager.GetWithVariable("MasterServerErrorException", "[error]", response.ErrorException.ToString()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -278,13 +278,13 @@ namespace Barotrauma
|
||||
switch (response.StatusCode)
|
||||
{
|
||||
case HttpStatusCode.NotFound:
|
||||
DebugConsole.ThrowError(TextManager.GetWithVariable("MasterServerError404", "[masterserverurl]", consentServerUrl));
|
||||
DebugConsole.ThrowErrorLocalized(TextManager.GetWithVariable("MasterServerError404", "[masterserverurl]", consentServerUrl));
|
||||
break;
|
||||
case HttpStatusCode.ServiceUnavailable:
|
||||
DebugConsole.ThrowError(TextManager.Get("MasterServerErrorUnavailable"));
|
||||
DebugConsole.ThrowErrorLocalized(TextManager.Get("MasterServerErrorUnavailable"));
|
||||
break;
|
||||
default:
|
||||
DebugConsole.ThrowError(TextManager.GetWithVariables("MasterServerErrorDefault",
|
||||
DebugConsole.ThrowErrorLocalized(TextManager.GetWithVariables("MasterServerErrorDefault",
|
||||
("[statuscode]", response.StatusCode.ToString()),
|
||||
("[statusdescription]", response.StatusDescription)));
|
||||
break;
|
||||
|
||||
@@ -557,7 +557,7 @@ namespace Barotrauma
|
||||
|
||||
if (availableTransition == TransitionType.None)
|
||||
{
|
||||
DebugConsole.ThrowError("Failed to load a new campaign level. No available level transitions " +
|
||||
DebugConsole.ThrowErrorLocalized("Failed to load a new campaign level. No available level transitions " +
|
||||
"(current location: " + (map.CurrentLocation?.DisplayName ?? "null") + ", " +
|
||||
"selected location: " + (map.SelectedLocation?.DisplayName ?? "null") + ", " +
|
||||
"leaving sub: " + (leavingSub?.Info?.Name ?? "null") + ", " +
|
||||
@@ -568,7 +568,7 @@ namespace Barotrauma
|
||||
}
|
||||
if (nextLevel == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Failed to load a new campaign level. No available level transitions " +
|
||||
DebugConsole.ThrowErrorLocalized("Failed to load a new campaign level. No available level transitions " +
|
||||
"(transition type: " + availableTransition + ", " +
|
||||
"current location: " + (map.CurrentLocation?.DisplayName ?? "null") + ", " +
|
||||
"selected location: " + (map.SelectedLocation?.DisplayName ?? "null") + ", " +
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (recipe.RequiredItems.Length > inputContainer.Capacity)
|
||||
{
|
||||
DebugConsole.ThrowError("Error in item \"" + item.Name + "\": There's not enough room in the input inventory for the ingredients of \"" + recipe.TargetItem.Name + "\"!");
|
||||
DebugConsole.ThrowErrorLocalized("Error in item \"" + item.Name + "\": There's not enough room in the input inventory for the ingredients of \"" + recipe.TargetItem.Name + "\"!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace Barotrauma
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("Deleting item assembly \"" + Name + "\" failed.", e);
|
||||
DebugConsole.ThrowErrorLocalized("Deleting item assembly \"" + Name + "\" failed.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -570,9 +570,9 @@ namespace Barotrauma
|
||||
if (nameIdentifier.IsEmpty)
|
||||
{
|
||||
//backwards compatibility
|
||||
rawName = element.GetAttributeString("basename", "");
|
||||
nameIdentifier = rawName.ToIdentifier();
|
||||
DisplayName = element.GetAttributeString("name", "");
|
||||
rawName = element.GetAttributeString("rawname", element.GetAttributeString("basename", DisplayName.Value));
|
||||
nameIdentifier = rawName.ToIdentifier();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1088,12 +1088,12 @@ namespace Barotrauma
|
||||
{
|
||||
if (!Type.HasHireableCharacters)
|
||||
{
|
||||
DebugConsole.ThrowError("Cannot hire a character from location \"" + DisplayName + "\" - the location has no hireable characters.\n" + Environment.StackTrace.CleanupStackTrace());
|
||||
DebugConsole.ThrowErrorLocalized("Cannot hire a character from location \"" + DisplayName + "\" - the location has no hireable characters.\n" + Environment.StackTrace.CleanupStackTrace());
|
||||
return;
|
||||
}
|
||||
if (HireManager == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Cannot hire a character from location \"" + DisplayName + "\" - hire manager has not been instantiated.\n" + Environment.StackTrace.CleanupStackTrace());
|
||||
DebugConsole.ThrowErrorLocalized("Cannot hire a character from location \"" + DisplayName + "\" - hire manager has not been instantiated.\n" + Environment.StackTrace.CleanupStackTrace());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace Barotrauma
|
||||
if (subElement.GetAttribute("sourcerect") == null &&
|
||||
subElement.GetAttribute("sheetindex") == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Warning - sprite sourcerect not configured for structure \"" + Name + "\"!");
|
||||
DebugConsole.ThrowErrorLocalized("Warning - sprite sourcerect not configured for structure \"" + Name + "\"!");
|
||||
}
|
||||
#if CLIENT
|
||||
if (subElement.GetAttributeBool("fliphorizontal", false))
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Barotrauma.Networking
|
||||
string permissionsStr = element.GetAttributeString("permissions", "");
|
||||
if (!Enum.TryParse(permissionsStr, out Permissions))
|
||||
{
|
||||
DebugConsole.ThrowError("Error in permission preset \"" + DisplayName + "\" - " + permissionsStr + " is not a valid permission!");
|
||||
DebugConsole.ThrowErrorLocalized("Error in permission preset \"" + DisplayName + "\" - " + permissionsStr + " is not a valid permission!");
|
||||
}
|
||||
|
||||
PermittedCommands = new HashSet<DebugConsole.Command>();
|
||||
@@ -66,7 +66,7 @@ namespace Barotrauma.Networking
|
||||
if (command == null)
|
||||
{
|
||||
#if SERVER
|
||||
DebugConsole.ThrowError("Error in permission preset \"" + DisplayName + "\" - " + commandName + "\" is not a valid console command.");
|
||||
DebugConsole.ThrowErrorLocalized("Error in permission preset \"" + DisplayName + "\" - " + commandName + "\" is not a valid console command.");
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user