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;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user