Unstable 0.16.5.0

This commit is contained in:
Markus Isberg
2022-02-17 00:03:08 +09:00
parent 2190fe08ef
commit a0696ecb74
51 changed files with 197 additions and 96 deletions
@@ -632,6 +632,7 @@ namespace Barotrauma
{
divingSuit.Drop(Character);
HandleRelocation(divingSuit);
ReequipUnequipped();
}
else if (findItemState == FindItemState.None || findItemState == FindItemState.DivingSuit)
{
@@ -659,6 +660,7 @@ namespace Barotrauma
{
divingSuit.Drop(Character);
HandleRelocation(divingSuit);
ReequipUnequipped();
}
}
}
@@ -677,6 +679,7 @@ namespace Barotrauma
{
mask.Drop(Character);
HandleRelocation(mask);
ReequipUnequipped();
}
else if (findItemState == FindItemState.None || findItemState == FindItemState.DivingMask)
{
@@ -701,6 +704,7 @@ namespace Barotrauma
{
mask.Drop(Character);
HandleRelocation(mask);
ReequipUnequipped();
}
}
}
@@ -2075,10 +2079,12 @@ namespace Barotrauma
public static bool IsItemTargetedBySomeone(ItemComponent target, CharacterTeamType team, out Character operatingCharacter)
{
operatingCharacter = null;
if (target?.Item == null) { return false; }
float highestPriority = -1.0f;
float highestPriorityModifier = -1.0f;
foreach (Character c in Character.CharacterList)
{
if (c == null) { continue; }
if (c.Removed) { continue; }
if (c.TeamID != team) { continue; }
if (c.IsIncapacitated) { continue; }
@@ -2087,12 +2093,12 @@ namespace Barotrauma
operatingCharacter = c;
return true;
}
if (c.AIController is HumanAIController humanAI)
if (c.AIController is HumanAIController humanAI && humanAI.ObjectiveManager is AIObjectiveManager objectiveManager)
{
foreach (var objective in humanAI.ObjectiveManager.Objectives)
foreach (var objective in objectiveManager.Objectives)
{
if (!(objective is AIObjectiveOperateItem operateObjective)) { continue; }
if (operateObjective.Component.Item != target.Item) { continue; }
if (operateObjective.Component?.Item != target.Item) { continue; }
if (operateObjective.Priority < highestPriority) { continue; }
if (operateObjective.PriorityModifier < highestPriorityModifier) { continue; }
operatingCharacter = c;
@@ -457,12 +457,20 @@ namespace Barotrauma
// Cannot use the head position, because not all characters have head or it can be below the total height of the character
float characterHeight = Math.Max(colliderSize.Y + character.AnimController.ColliderHeightFromFloor, minHeight);
float horizontalDistance = Math.Abs(collider.SimPosition.X - currentPath.CurrentNode.SimPosition.X);
bool isAboveFeet = currentPath.CurrentNode.SimPosition.Y > colliderBottom.Y;
bool isNotTooHigh = currentPath.CurrentNode.SimPosition.Y < colliderBottom.Y + characterHeight;
bool isTargetTooHigh = currentPath.CurrentNode.SimPosition.Y > colliderBottom.Y + characterHeight;
bool isTargetTooLow = currentPath.CurrentNode.SimPosition.Y < colliderBottom.Y;
var door = currentPath.CurrentNode.ConnectedDoor;
float margin = MathHelper.Lerp(1, 10, MathHelper.Clamp(Math.Abs(velocity.X) / 5, 0, 1));
if (currentPath.CurrentNode.Stairs != null && currentPath.NextNode?.Stairs == null)
{
margin = 1;
if (currentPath.CurrentNode.SimPosition.Y < colliderBottom.Y + character.AnimController.ColliderHeightFromFloor * 0.25f)
{
isTargetTooLow = true;
}
}
float targetDistance = Math.Max(colliderSize.X / 2 * margin, minWidth / 2);
if (horizontalDistance < targetDistance && isAboveFeet && isNotTooHigh && (door == null || door.CanBeTraversed))
if (horizontalDistance < targetDistance && !isTargetTooHigh && !isTargetTooLow && (door == null || door.CanBeTraversed))
{
NextNode(!doorsChecked);
}
@@ -3759,10 +3759,6 @@ namespace Barotrauma
if (!wasDead)
{
TryAdjustAttackerSkill(attacker, CharacterHealth.Vitality - prevVitality);
if (IsDead)
{
attacker?.RecordKill(this);
}
}
};
if (attackResult.Damage > 0)
@@ -4027,6 +4023,7 @@ namespace Barotrauma
var abilityCharacterKiller = new AbilityCharacterKiller(CauseOfDeath.Killer);
CheckTalents(AbilityEffectType.OnDieToCharacter, abilityCharacterKiller);
CauseOfDeath.Killer?.RecordKill(this);
if (GameMain.GameSession != null && Screen.Selected == GameMain.GameScreen)
{
@@ -4035,7 +4032,7 @@ namespace Barotrauma
KillProjSpecific(causeOfDeath, causeOfDeathAffliction, log);
if (info != null)
if (info != null)
{
info.CauseOfDeath = CauseOfDeath;
info.MissionsCompletedSinceDeath = 0;
@@ -4549,6 +4546,8 @@ namespace Barotrauma
if (addingFirstTime)
{
OnTalentGiven(talentPrefab);
GameAnalyticsManager.AddDesignEvent("TalentUnlocked:" + (info.Job?.Prefab.Identifier ?? "None") + ":" + talentPrefab.Identifier,
GameMain.GameSession?.Campaign?.TotalPlayTime ?? 0.0);
}
return true;
}
@@ -202,7 +202,7 @@ namespace Barotrauma
get { return pressureAffliction; }
}
public Character Character { get; private set; }
public readonly Character Character;
public CharacterHealth(Character character)
{