Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop
This commit is contained in:
+1
-1
@@ -603,7 +603,6 @@ namespace Barotrauma
|
||||
public static readonly Identifier SpaceHerpesType = "spaceherpes".ToIdentifier();
|
||||
public static readonly Identifier AlienInfectedType = "alieninfected".ToIdentifier();
|
||||
public static readonly Identifier InvertControlsType = "invertcontrols".ToIdentifier();
|
||||
public static readonly Identifier HuskInfectionType = "huskinfection".ToIdentifier();
|
||||
|
||||
public static AfflictionPrefab InternalDamage => Prefabs["internaldamage"];
|
||||
public static AfflictionPrefab BiteWounds => Prefabs["bitewounds"];
|
||||
@@ -613,6 +612,7 @@ namespace Barotrauma
|
||||
public static AfflictionPrefab OxygenLow => Prefabs["oxygenlow"];
|
||||
public static AfflictionPrefab Bloodloss => Prefabs["bloodloss"];
|
||||
public static AfflictionPrefab Pressure => Prefabs["pressure"];
|
||||
public static AfflictionPrefab OrganDamage => Prefabs["organdamage"];
|
||||
public static AfflictionPrefab Stun => Prefabs[StunType];
|
||||
public static AfflictionPrefab RadiationSickness => Prefabs["radiationsickness"];
|
||||
|
||||
|
||||
@@ -161,6 +161,12 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// How much vitality the character would have if it was alive?
|
||||
/// E.g. a character killed by disconnection or with console commands may not have any vitality-reducing afflictions despite being dead
|
||||
/// </summary>
|
||||
public float VitalityDisregardingDeath => vitality;
|
||||
|
||||
public float HealthPercentage => MathUtils.Percentage(Vitality, MaxVitality);
|
||||
|
||||
public float MaxVitality
|
||||
@@ -234,6 +240,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsParalyzed { get; private set; }
|
||||
|
||||
public float StunTimer { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -407,7 +415,17 @@ namespace Barotrauma
|
||||
return strength;
|
||||
}
|
||||
|
||||
public float GetAfflictionStrength(Identifier afflictionType, bool allowLimbAfflictions = true)
|
||||
public float GetAfflictionStrengthByType(Identifier afflictionType, bool allowLimbAfflictions = true)
|
||||
{
|
||||
return GetAfflictionStrength(afflictionType, afflictionidentifier: Identifier.Empty, allowLimbAfflictions);
|
||||
}
|
||||
|
||||
public float GetAfflictionStrengthByIdentifier(Identifier afflictionIdentifier, bool allowLimbAfflictions = true)
|
||||
{
|
||||
return GetAfflictionStrength(afflictionType: Identifier.Empty, afflictionIdentifier, allowLimbAfflictions);
|
||||
}
|
||||
|
||||
public float GetAfflictionStrength(Identifier afflictionType, Identifier afflictionidentifier, bool allowLimbAfflictions = true)
|
||||
{
|
||||
float strength = 0.0f;
|
||||
foreach (KeyValuePair<Affliction, LimbHealth> kvp in afflictions)
|
||||
@@ -415,7 +433,8 @@ namespace Barotrauma
|
||||
if (!allowLimbAfflictions && kvp.Value != null) { continue; }
|
||||
var affliction = kvp.Key;
|
||||
if (affliction.Strength < affliction.Prefab.ActivationThreshold) { continue; }
|
||||
if (affliction.Prefab.AfflictionType == afflictionType)
|
||||
if ((affliction.Prefab.AfflictionType == afflictionType || afflictionType.IsEmpty) &&
|
||||
(affliction.Prefab.Identifier == afflictionidentifier || afflictionidentifier.IsEmpty))
|
||||
{
|
||||
strength += affliction.Strength;
|
||||
}
|
||||
@@ -725,7 +744,7 @@ namespace Barotrauma
|
||||
if (!Character.NeedsOxygen && newAffliction.Prefab == AfflictionPrefab.OxygenLow) { return; }
|
||||
if (Character.Params.Health.StunImmunity && newAffliction.Prefab.AfflictionType == AfflictionPrefab.StunType)
|
||||
{
|
||||
if (Character.EmpVulnerability <= 0 || GetAfflictionStrength(AfflictionPrefab.EMPType, allowLimbAfflictions: false) <= 0)
|
||||
if (Character.EmpVulnerability <= 0 || GetAfflictionStrengthByType(AfflictionPrefab.EMPType, allowLimbAfflictions: false) <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -969,6 +988,7 @@ namespace Barotrauma
|
||||
public void CalculateVitality()
|
||||
{
|
||||
Vitality = MaxVitality;
|
||||
IsParalyzed = false;
|
||||
if (Unkillable || Character.GodMode) { return; }
|
||||
|
||||
foreach (KeyValuePair<Affliction, LimbHealth> kvp in afflictions)
|
||||
@@ -982,6 +1002,12 @@ namespace Barotrauma
|
||||
}
|
||||
Vitality -= vitalityDecrease;
|
||||
affliction.CalculateDamagePerSecond(vitalityDecrease);
|
||||
|
||||
if (affliction.Strength >= affliction.Prefab.MaxStrength &&
|
||||
affliction.Prefab.AfflictionType == AfflictionPrefab.ParalysisType)
|
||||
{
|
||||
IsParalyzed = true;
|
||||
}
|
||||
}
|
||||
#if CLIENT
|
||||
if (IsUnconscious)
|
||||
|
||||
Reference in New Issue
Block a user