Unstable 0.15.13.0

This commit is contained in:
Markus Isberg
2021-11-01 23:58:29 +09:00
parent a43b540d4b
commit 935fc112bc
13 changed files with 39 additions and 11 deletions
@@ -201,9 +201,9 @@ namespace Barotrauma
currentTarget = target;
Vector2 currentPos = host.SimPosition;
pathFinder.InsideSubmarine = character.Submarine != null && !character.Submarine.Info.IsRuin;
pathFinder.ApplyPenaltyToOutsideNodes = character.Submarine != null && character.PressureProtection <= 0;
pathFinder.ApplyPenaltyToOutsideNodes = character.Submarine != null && character.PressureProtection <= 0;
var newPath = pathFinder.FindPath(currentPos, target, character.Submarine, "(Character: " + character.Name + ")", minGapSize, startNodeFilter, endNodeFilter, nodeFilter, checkVisibility: checkVisibility);
bool useNewPath = needsNewPath || currentPath == null || currentPath.CurrentNode == null || character.Submarine != null && findPathTimer < -1 && Math.Abs(character.AnimController.TargetMovement.X) <= 0;
bool useNewPath = needsNewPath || currentPath == null || currentPath.CurrentNode == null || character.Submarine != null && findPathTimer < -1 && Math.Abs(character.AnimController.TargetMovement.Combine()) <= 0;
if (newPath.Unreachable || newPath.Nodes.None())
{
useNewPath = false;
@@ -220,10 +220,12 @@ namespace Barotrauma
// Use the new path if it has significantly lower cost (don't change the path if it has marginally smaller cost. This reduces navigating backwards due to new path that is calculated from the node just behind us).
float t = (float)currentPath.CurrentIndex / (currentPath.Nodes.Count - 1);
useNewPath = newPath.Cost < currentPath.Cost * MathHelper.Lerp(0.95f, 0, t);
if (!useNewPath && character.Submarine != null)
if (!useNewPath && character.Submarine != null && !character.IsClimbing)
{
// It's possible that the current path was calculated from a start point that is no longer valid.
// Therefore, let's accept also paths with a greater cost than the current, if the current node is much farther than the new start node.
// This is a special case for cases e.g. where the character falls and thus needs a new path.
// Don't do this outside or when climbing ladders, because both cause issues.
useNewPath = Vector2.DistanceSquared(character.WorldPosition, currentPath.CurrentNode.WorldPosition) > Math.Pow(Vector2.Distance(character.WorldPosition, newPath.Nodes.First().WorldPosition) * 3, 2);
}
}
@@ -309,15 +311,12 @@ namespace Barotrauma
}
if (currentPath.Finished)
{
var lastNode = currentPath.Nodes.LastOrDefault();
if (lastNode == null)
Vector2 pos2 = host.SimPosition;
if (character != null && character.Submarine == null && CurrentPath.Nodes.Count > 0 && CurrentPath.Nodes.Last().Submarine != null)
{
return Vector2.Zero;
}
else
{
return ConvertUnits.ToSimUnits(lastNode.WorldPosition - host.WorldPosition);
pos2 -= CurrentPath.Nodes.Last().Submarine.SimPosition;
}
return currentTarget - pos2;
}
bool doorsChecked = false;
if (!character.LockHands && buttonPressCooldown <= 0.0f)
@@ -8,6 +8,7 @@ namespace Barotrauma.Abilities
private readonly AbilityFlags abilityFlag;
private bool lastState;
public override bool AllowClientSimulation => true;
public CharacterAbilityModifyFlag(CharacterAbilityGroup characterAbilityGroup, XElement abilityElement) : base(characterAbilityGroup, abilityElement)
{
@@ -6,6 +6,7 @@ namespace Barotrauma.Abilities
class CharacterAbilityModifyReduceAffliction : CharacterAbility
{
float addedAmountMultiplier;
public override bool AllowClientSimulation => true;
public CharacterAbilityModifyReduceAffliction(CharacterAbilityGroup characterAbilityGroup, XElement abilityElement) : base(characterAbilityGroup, abilityElement)
{
@@ -7,6 +7,7 @@ namespace Barotrauma.Abilities
private readonly string resistanceId;
private readonly float resistance;
bool lastState;
public override bool AllowClientSimulation => true;
// should probably be split to different classes
public CharacterAbilityModifyResistance(CharacterAbilityGroup characterAbilityGroup, XElement abilityElement) : base(characterAbilityGroup, abilityElement)
@@ -7,6 +7,7 @@ namespace Barotrauma.Abilities
private readonly StatTypes statType;
private readonly float value;
bool lastState;
public override bool AllowClientSimulation => true;
public CharacterAbilityModifyStat(CharacterAbilityGroup characterAbilityGroup, XElement abilityElement) : base(characterAbilityGroup, abilityElement)
{
@@ -8,6 +8,7 @@ namespace Barotrauma.Abilities
private readonly StatTypes statType;
private readonly float maxValue;
private float lastValue = 0f;
public override bool AllowClientSimulation => true;
public CharacterAbilityModifyStatToFlooding(CharacterAbilityGroup characterAbilityGroup, XElement abilityElement) : base(characterAbilityGroup, abilityElement)
{
@@ -9,6 +9,7 @@ namespace Barotrauma.Abilities
private readonly float statPerLevel;
private readonly int maxLevel;
private float lastValue = 0f;
public override bool AllowClientSimulation => true;
public CharacterAbilityModifyStatToLevel(CharacterAbilityGroup characterAbilityGroup, XElement abilityElement) : base(characterAbilityGroup, abilityElement)
{
@@ -10,6 +10,7 @@ namespace Barotrauma.Abilities
private readonly string skillIdentifier;
private readonly bool useAll;
private float lastValue = 0f;
public override bool AllowClientSimulation => true;
public CharacterAbilityModifyStatToSkill(CharacterAbilityGroup characterAbilityGroup, XElement abilityElement) : base(characterAbilityGroup, abilityElement)
{
@@ -8,6 +8,7 @@ namespace Barotrauma.Abilities
private float maxValue;
private string afflictionIdentifier;
private float lastValue = 0f;
public override bool AllowClientSimulation => true;
public CharacterAbilityPsychoClown(CharacterAbilityGroup characterAbilityGroup, XElement abilityElement) : base(characterAbilityGroup, abilityElement)
{
@@ -74,7 +74,7 @@ namespace Barotrauma.Items.Components
{
Matrix bodyTransform = Matrix.CreateRotationZ(item.body == null ? MathHelper.ToRadians(item.Rotation) : item.body.Rotation);
Vector2 flippedPos = barrelPos;
if (item.body.Dir < 0.0f) { flippedPos.X = -flippedPos.X; }
if (item.body != null && item.body.Dir < 0.0f) { flippedPos.X = -flippedPos.X; }
return Vector2.Transform(flippedPos, bodyTransform) * item.Scale;
}
}
@@ -75,6 +75,7 @@ namespace Barotrauma.Items.Components
float closestDist = float.PositiveInfinity;
foreach (Item targetItem in Item.ItemList)
{
if (targetItem.NonInteractable || targetItem.NonPlayerTeamInteractable || targetItem.HiddenInGame) { continue; }
if (OnlyInOwnSub)
{
if (targetItem.Submarine != item.Submarine) { continue; }