v1.6.17.0 (Unto the Breach update)

This commit is contained in:
Regalis11
2024-10-22 17:29:04 +03:00
parent e74b3cdb17
commit 6e6c17e100
417 changed files with 17166 additions and 5870 deletions
@@ -337,18 +337,24 @@ namespace Barotrauma
}
}
public float GetResistance(Identifier afflictionId)
/// <summary>
/// How much resistance to the specified affliction does this affliction currently give?
/// </summary>
public float GetResistance(Identifier afflictionId, LimbType limbType)
{
if (Strength < Prefab.ActivationThreshold) { return 0.0f; }
var affliction = AfflictionPrefab.Prefabs[afflictionId];
AfflictionPrefab.Effect currentEffect = GetActiveEffect();
if (currentEffect == null) { return 0.0f; }
if (!currentEffect.ResistanceFor.Any(r =>
r == affliction.Identifier ||
r == affliction.AfflictionType))
{
return 0.0f;
}
bool hasResistanceForAffliction = currentEffect.ResistanceFor.Any(identifier =>
identifier == affliction.Identifier ||
identifier == affliction.AfflictionType);
if (!hasResistanceForAffliction) { return 0.0f; }
bool hasResistanceForLimb = limbType == LimbType.None || currentEffect.ResistanceLimbs.None() || currentEffect.ResistanceLimbs.Contains(limbType);
if (!hasResistanceForLimb) { return 0.0f; }
return MathHelper.Lerp(
currentEffect.MinResistance,
currentEffect.MaxResistance,
@@ -430,7 +436,7 @@ namespace Barotrauma
}
else if (currentEffect.StrengthChange > 0) // Reduce strengthening of afflictions if resistant
{
_strength += currentEffect.StrengthChange * deltaTime * (1f - characterHealth.GetResistance(Prefab));
_strength += currentEffect.StrengthChange * deltaTime * (1f - characterHealth.GetResistance(Prefab, targetLimb?.type ?? LimbType.None));
}
// Don't use the property, because it's virtual and some afflictions like husk overload it for external use.
_strength = MathHelper.Clamp(_strength, 0.0f, Prefab.MaxStrength);
@@ -13,7 +13,7 @@
public override void Update(CharacterHealth characterHealth, Limb targetLimb, float deltaTime)
{
base.Update(characterHealth, targetLimb, deltaTime);
float bloodlossResistance = GetResistance(characterHealth.BloodlossAffliction.Identifier);
float bloodlossResistance = characterHealth.GetResistance(characterHealth.BloodlossAffliction.Prefab, targetLimb?.type ?? LimbType.None);
characterHealth.BloodlossAmount += Strength * (1.0f - bloodlossResistance) / 60.0f * deltaTime;
if (Source != null)
{
@@ -28,8 +28,6 @@ namespace Barotrauma
private bool stun = false;
private readonly List<Affliction> huskInfection = new List<Affliction>();
[Serialize(0f, IsPropertySaveable.Yes), Editable]
public override float Strength
{
@@ -62,7 +60,7 @@ namespace Barotrauma
}
}
private readonly AfflictionPrefabHusk HuskPrefab;
public readonly AfflictionPrefabHusk HuskPrefab;
private float DormantThreshold => HuskPrefab.DormantThreshold;
private float ActiveThreshold => HuskPrefab.ActiveThreshold;
@@ -129,7 +127,7 @@ namespace Barotrauma
{
State = InfectionState.Final;
ActivateHusk();
ApplyDamage(deltaTime, applyForce: true);
ApplyDamage(deltaTime);
character.SetStun(5);
}
}
@@ -192,27 +190,41 @@ namespace Barotrauma
prevDisplayedMessage = State;
}
private void ApplyDamage(float deltaTime, bool applyForce)
private const float DamageCooldown = 0.1f;
private float damageCooldownTimer;
private void ApplyDamage(float deltaTime)
{
int limbCount = character.AnimController.Limbs.Count(l => !l.IgnoreCollisions && !l.IsSevered && !l.Hidden);
if (damageCooldownTimer > 0)
{
damageCooldownTimer -= deltaTime;
return;
}
damageCooldownTimer = DamageCooldown;
int limbCount = character.AnimController.Limbs.Count(IsValidLimb);
foreach (Limb limb in character.AnimController.Limbs)
{
if (limb.IsSevered) { continue; }
if (limb.Hidden) { continue; }
if (!IsValidLimb(limb)) { continue; }
float random = Rand.Value();
huskInfection.Clear();
huskInfection.Add(AfflictionPrefab.InternalDamage.Instantiate(random * 10 * deltaTime / limbCount));
if (random == 0) { continue; }
const float damageRate = 2;
float dmg = random / limbCount * damageRate;
character.LastDamageSource = null;
float force = applyForce ? random * 0.5f * limb.Mass : 0;
character.DamageLimb(limb.WorldPosition, limb, huskInfection, 0, false, Rand.Vector(force));
var afflictions = AfflictionPrefab.InternalDamage.Instantiate(dmg).ToEnumerable();
const float forceMultiplier = 5;
float force = dmg * limb.Mass * forceMultiplier;
character.DamageLimb(limb.WorldPosition, limb, afflictions, stun: 0, playSound: false, Rand.Vector(force), ignoreDamageOverlay: true, recalculateVitality: false);
}
character.CharacterHealth.RecalculateVitality();
static bool IsValidLimb(Limb limb) => !limb.IgnoreCollisions && !limb.IsSevered && !limb.Hidden;
}
public void ActivateHusk()
{
if (huskAppendage == null && character.Params.UseHuskAppendage)
{
huskAppendage = AttachHuskAppendage(character, Prefab as AfflictionPrefabHusk);
var huskAffliction = Prefab as AfflictionPrefabHusk;
huskAppendage = AttachHuskAppendage(character, huskAffliction, GetHuskedSpeciesName(character.Params, huskAffliction));
}
if (Prefab is AfflictionPrefabHusk { NeedsAir: false })
@@ -287,7 +299,7 @@ namespace Barotrauma
Entity.Spawner.AddEntityToRemoveQueue(character);
UnsubscribeFromDeathEvent();
Identifier huskedSpeciesName = GetHuskedSpeciesName(character.SpeciesName, Prefab as AfflictionPrefabHusk);
Identifier huskedSpeciesName = GetHuskedSpeciesName(character.Params, Prefab as AfflictionPrefabHusk);
CharacterPrefab prefab = CharacterPrefab.FindBySpeciesName(huskedSpeciesName);
if (prefab == null)
@@ -314,6 +326,7 @@ namespace Barotrauma
husk.Info.Character = husk;
husk.Info.TeamID = CharacterTeamType.None;
}
husk.AllowPlayDead = character.AllowPlayDead;
if (Prefab is AfflictionPrefabHusk huskPrefab)
{
@@ -379,11 +392,9 @@ namespace Barotrauma
yield return CoroutineStatus.Success;
}
public static List<Limb> AttachHuskAppendage(Character character, AfflictionPrefabHusk matchingAffliction, ContentXElement appendageDefinition = null, Ragdoll ragdoll = null)
public static List<Limb> AttachHuskAppendage(Character character, AfflictionPrefabHusk matchingAffliction, Identifier huskedSpeciesName, ContentXElement appendageDefinition = null, Ragdoll ragdoll = null)
{
var appendage = new List<Limb>();
Identifier nonhuskedSpeciesName = GetNonHuskedSpeciesName(character.SpeciesName, matchingAffliction);
Identifier huskedSpeciesName = GetHuskedSpeciesName(nonhuskedSpeciesName, matchingAffliction);
CharacterPrefab huskPrefab = CharacterPrefab.FindBySpeciesName(huskedSpeciesName);
if (huskPrefab?.ConfigElement == null)
{
@@ -406,10 +417,7 @@ namespace Barotrauma
ContentPath pathToAppendage = element.GetAttributeContentPath("path") ?? ContentPath.Empty;
XDocument doc = XMLExtensions.TryLoadXml(pathToAppendage);
if (doc == null) { return appendage; }
if (ragdoll == null)
{
ragdoll = character.AnimController;
}
ragdoll ??= character.AnimController;
if (ragdoll.Dir < 1.0f)
{
ragdoll.Flip();
@@ -463,19 +471,31 @@ namespace Barotrauma
ragdoll.AddLimb(huskAppendage);
ragdoll.AddJoint(jointParams);
appendage.Add(huskAppendage);
}
}
}
return appendage;
}
public static Identifier GetHuskedSpeciesName(Identifier speciesName, AfflictionPrefabHusk prefab)
public static Identifier GetHuskedSpeciesName(CharacterParams character, AfflictionPrefabHusk prefab)
{
return new Identifier(speciesName.Value + prefab.HuskedSpeciesName.Value);
Identifier huskedSpecies = character.HuskedSpecies;
if (huskedSpecies.IsEmpty)
{
// Default pattern: Crawler -> Crawlerhusk, Human -> Humanhusk
return new Identifier(character.SpeciesName.Value + prefab.HuskedSpeciesName.Value);
}
return huskedSpecies;
}
public static Identifier GetNonHuskedSpeciesName(Identifier huskedSpeciesName, AfflictionPrefabHusk prefab)
public static Identifier GetNonHuskedSpeciesName(CharacterParams character, AfflictionPrefabHusk prefab)
{
return huskedSpeciesName.Remove(prefab.HuskedSpeciesName);
Identifier nonHuskedSpecies = character.NonHuskedSpecies;
if (nonHuskedSpecies.IsEmpty)
{
// Default pattern: Crawlerhusk -> Crawler, Humanhusk -> Human
return character.SpeciesName.Remove(prefab.HuskedSpeciesName);
}
return nonHuskedSpecies;
}
}
}
@@ -329,6 +329,11 @@ namespace Barotrauma
/// </summary>
public readonly ImmutableArray<Identifier> ResistanceFor;
/// <summary>
/// List of limb types that the resistance applies to. If empty, the resistance applies to the whole body.
/// </summary>
public readonly ImmutableArray<LimbType> ResistanceLimbs;
[Serialize(0.0f, IsPropertySaveable.No,
description: "The amount of resistance to the afflictions specified by ResistanceFor to apply at this effect's lowest strength.")]
public float MinResistance { get; private set; }
@@ -359,6 +364,14 @@ namespace Barotrauma
description: "Color to tint the affected character's entire body with at this effect's highest strength. The alpha channel is used to determine how much to tint the character.")]
public Color MaxBodyTint { get; private set; }
[Serialize(0.0f, IsPropertySaveable.No,
description: "Range of the \"thermal goggles overlay\" enabled by the affliction.")]
public float ThermalOverlayRange { get; private set; }
[Serialize("255,0,0,255", IsPropertySaveable.No,
description: $"Color of the \"thermal goggles overlay\" enabled by the affliction. Only has an effect if {nameof(ThermalOverlayRange)} is larger than 0.")]
public Color ThermalOverlayColor { get; private set; }
/// <summary>
/// StatType that will be applied to the affected character when the effect is active that is proportional to the effect's strength.
/// </summary>
@@ -423,6 +436,8 @@ namespace Barotrauma
SerializableProperty.DeserializeProperties(this, element);
ResistanceFor = element.GetAttributeIdentifierArray("resistancefor", Array.Empty<Identifier>())!.ToImmutableArray();
ResistanceLimbs = element.GetAttributeEnumArray<LimbType>("resistancelimbs", Array.Empty<LimbType>()).ToImmutableArray();
BlockTransformation = element.GetAttributeIdentifierArray("blocktransformation", Array.Empty<Identifier>())!.ToImmutableArray();
var afflictionStatValues = new Dictionary<StatTypes, AppliedStatValue>();
@@ -594,7 +609,7 @@ namespace Barotrauma
}
else
{
MinInterval = Math.Max(element.GetAttributeFloat(nameof(MinInterval), 1.0f), 1.0f);
MinInterval = Math.Max(element.GetAttributeFloat(nameof(MinInterval), 1.0f), 0.1f);
MaxInterval = Math.Max(element.GetAttributeFloat(nameof(MaxInterval), 1.0f), MinInterval);
MinStrength = Math.Max(element.GetAttributeFloat(nameof(MinStrength), 0f), 0f);
MaxStrength = Math.Max(element.GetAttributeFloat(nameof(MaxStrength), MinStrength), MinStrength);
@@ -612,6 +627,7 @@ 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 DisguisedAsHuskType = "disguiseashusk".ToIdentifier();
public static AfflictionPrefab InternalDamage => Prefabs["internaldamage"];
public static AfflictionPrefab BiteWounds => Prefabs["bitewounds"];
@@ -624,7 +640,7 @@ namespace Barotrauma
public static AfflictionPrefab OrganDamage => Prefabs["organdamage"];
public static AfflictionPrefab Stun => Prefabs[StunType];
public static AfflictionPrefab RadiationSickness => Prefabs["radiationsickness"];
public static AfflictionPrefab HuskInfection => Prefabs["huskinfection"];
public static readonly PrefabCollection<AfflictionPrefab> Prefabs = new PrefabCollection<AfflictionPrefab>();
@@ -898,7 +914,10 @@ namespace Barotrauma
if (element.GetAttribute("nameidentifier") != null)
{
Name = TextManager.Get(element.GetAttributeString("nameidentifier", string.Empty)).Fallback(Name);
string nameIdentifier = element.GetAttributeString("nameidentifier", string.Empty);
Name = TextManager.Get(nameIdentifier)
.Fallback(TextManager.Get($"AfflictionName.{nameIdentifier}"))
.Fallback(Name);
}
LimbSpecific = element.GetAttributeBool("limbspecific", false);
@@ -248,6 +248,12 @@ namespace Barotrauma
/// Was the character in full health at the beginning of the frame?
/// </summary>
public bool WasInFullHealth { get; private set; }
/// <summary>
/// Show the blood overlay screen space effect when the character takes damage.
/// Enabled normally, but can be disabled for some special cases.
/// </summary>
public bool ShowDamageOverlay = true;
public Affliction PressureAffliction
{
@@ -442,7 +448,7 @@ namespace Barotrauma
return strength;
}
public void ApplyAffliction(Limb targetLimb, Affliction affliction, bool allowStacking = true, bool ignoreUnkillability = false)
public void ApplyAffliction(Limb targetLimb, Affliction affliction, bool allowStacking = true, bool ignoreUnkillability = false, bool recalculateVitality = true)
{
if (Character.GodMode) { return; }
if (!ignoreUnkillability)
@@ -456,12 +462,12 @@ namespace Barotrauma
//if a limb-specific affliction is applied to no specific limb, apply to all limbs
foreach (LimbHealth limbHealth in limbHealths)
{
AddLimbAffliction(limbHealth, affliction, allowStacking: allowStacking);
AddLimbAffliction(limbHealth, limb: null, affliction, allowStacking: allowStacking, recalculateVitality: recalculateVitality);
}
}
else
{
AddLimbAffliction(targetLimb, affliction, allowStacking: allowStacking);
AddLimbAffliction(targetLimb, affliction, allowStacking: allowStacking, recalculateVitality: recalculateVitality);
}
}
else
@@ -470,14 +476,17 @@ namespace Barotrauma
}
}
public float GetResistance(AfflictionPrefab afflictionPrefab)
/// <summary>
/// How much resistance all the afflictions the character has give to the specified affliction?
/// </summary>
public float GetResistance(AfflictionPrefab afflictionPrefab, LimbType limbType)
{
// This is a % resistance (0 to 1.0)
float resistance = 0.0f;
foreach (KeyValuePair<Affliction, LimbHealth> kvp in afflictions)
{
var affliction = kvp.Key;
resistance += affliction.GetResistance(afflictionPrefab.Identifier);
resistance += affliction.GetResistance(afflictionPrefab.Identifier, limbType);
}
// This is a multiplier, ie. 0.0 = 100% resistance and 1.0 = 0% resistance
float abilityResistanceMultiplier = Character.GetAbilityResistance(afflictionPrefab);
@@ -610,7 +619,11 @@ namespace Barotrauma
CalculateVitality();
}
public void ApplyDamage(Limb hitLimb, AttackResult attackResult, bool allowStacking = true)
/// <summary>
///
/// </summary>
/// <param name="recalculateVitality">Set false only as an optimization when you manually call <see cref="RecalculateVitality"/>. Only applies to limb specific afflictions.</param>
public void ApplyDamage(Limb hitLimb, AttackResult attackResult, bool allowStacking = true, bool recalculateVitality = true)
{
if (Unkillable || Character.GodMode) { return; }
if (hitLimb.HealthIndex < 0 || hitLimb.HealthIndex >= limbHealths.Count)
@@ -619,18 +632,19 @@ namespace Barotrauma
"\" only has health configured for" + limbHealths.Count + " limbs but the limb " + hitLimb.type + " is targeting index " + hitLimb.HealthIndex);
return;
}
foreach (Affliction newAffliction in attackResult.Afflictions)
{
if (newAffliction.Prefab.LimbSpecific)
{
AddLimbAffliction(hitLimb, newAffliction, allowStacking);
AddLimbAffliction(hitLimb, newAffliction, allowStacking, recalculateVitality: recalculateVitality);
}
else
{
// Always recalculate vitality for non-limb specific afflictions.
AddAffliction(newAffliction, allowStacking);
}
}
}
}
private void KillIfOutOfVitality()
@@ -664,9 +678,8 @@ namespace Barotrauma
if (bleedingDamageAmount > 0.0f && DoesBleed) { afflictions.Add(AfflictionPrefab.Bleeding.Instantiate(bleedingDamageAmount), limbHealth); }
if (burnDamageAmount > 0.0f) { afflictions.Add(AfflictionPrefab.Burn.Instantiate(burnDamageAmount), limbHealth); }
}
CalculateVitality();
KillIfOutOfVitality();
RecalculateVitality();
}
public float GetLimbDamage(Limb limb, Identifier afflictionType)
@@ -697,6 +710,17 @@ namespace Barotrauma
}
}
public void RemoveAfflictions(Func<Affliction, bool> predicate)
{
afflictionsToRemove.Clear();
afflictionsToRemove.AddRange(afflictions.Keys.Where(affliction => predicate(affliction)));
foreach (var affliction in afflictionsToRemove)
{
afflictions.Remove(affliction);
}
CalculateVitality();
}
public void RemoveAllAfflictions()
{
afflictionsToRemove.Clear();
@@ -731,7 +755,11 @@ namespace Barotrauma
CalculateVitality();
}
private void AddLimbAffliction(Limb limb, Affliction newAffliction, bool allowStacking = true)
/// <summary>
///
/// </summary>
/// <param name="recalculateVitality">Set false only as an optimization when you manually call <see cref="RecalculateVitality"/></param>
private void AddLimbAffliction(Limb limb, Affliction newAffliction, bool allowStacking = true, bool recalculateVitality = true)
{
if (!newAffliction.Prefab.LimbSpecific || limb == null) { return; }
if (limb.HealthIndex < 0 || limb.HealthIndex >= limbHealths.Count)
@@ -740,11 +768,16 @@ namespace Barotrauma
"\" only has health configured for" + limbHealths.Count + " limbs but the limb " + limb.type + " is targeting index " + limb.HealthIndex);
return;
}
AddLimbAffliction(limbHealths[limb.HealthIndex], newAffliction, allowStacking);
AddLimbAffliction(limbHealths[limb.HealthIndex], limb, newAffliction, allowStacking, recalculateVitality);
}
private void AddLimbAffliction(LimbHealth limbHealth, Affliction newAffliction, bool allowStacking = true)
/// <summary>
///
/// </summary>
/// <param name="recalculateVitality">Set false only as an optimization when you manually call <see cref="RecalculateVitality"/></param>
private void AddLimbAffliction(LimbHealth limbHealth, Limb limb, Affliction newAffliction, bool allowStacking = true, bool recalculateVitality = true)
{
LimbType limbType = limb?.type ?? LimbType.None;
if (Character.Params.IsMachine && !newAffliction.Prefab.AffectMachines) { return; }
if (!DoesBleed && newAffliction is AfflictionBleeding) { return; }
if (!Character.NeedsOxygen && newAffliction.Prefab == AfflictionPrefab.OxygenLow) { return; }
@@ -778,7 +811,7 @@ namespace Barotrauma
if (existingAffliction != null)
{
float newStrength = newAffliction.Strength * (100.0f / MaxVitality) * (1f - GetResistance(existingAffliction.Prefab));
float newStrength = newAffliction.Strength * (100.0f / MaxVitality) * (1f - GetResistance(existingAffliction.Prefab, limbType));
if (allowStacking)
{
// Add the existing strength
@@ -789,15 +822,17 @@ namespace Barotrauma
existingAffliction.Strength = newStrength;
existingAffliction.Duration = existingAffliction.Prefab.Duration;
if (newAffliction.Source != null) { existingAffliction.Source = newAffliction.Source; }
CalculateVitality();
KillIfOutOfVitality();
if (recalculateVitality)
{
RecalculateVitality();
}
return;
}
//create a new instance of the affliction to make sure we don't use the same instance for multiple characters
//or modify the affliction instance of an Attack or a StatusEffect
var copyAffliction = newAffliction.Prefab.Instantiate(
Math.Min(newAffliction.Prefab.MaxStrength, newAffliction.Strength * (100.0f / MaxVitality) * (1f - GetResistance(newAffliction.Prefab))),
Math.Min(newAffliction.Prefab.MaxStrength, newAffliction.Strength * (100.0f / MaxVitality) * (1f - GetResistance(newAffliction.Prefab, limbType))),
newAffliction.Source);
afflictions.Add(copyAffliction, limbHealth);
AchievementManager.OnAfflictionReceived(copyAffliction, Character);
@@ -805,8 +840,10 @@ namespace Barotrauma
Character.HealthUpdateInterval = 0.0f;
CalculateVitality();
KillIfOutOfVitality();
if (recalculateVitality)
{
RecalculateVitality();
}
#if CLIENT
if (OpenHealthWindow != this && limbHealth != null)
{
@@ -817,7 +854,7 @@ namespace Barotrauma
private void AddAffliction(Affliction newAffliction, bool allowStacking = true)
{
AddLimbAffliction(limbHealth: null, newAffliction, allowStacking);
AddLimbAffliction(limbHealth: null, limb: null, newAffliction, allowStacking);
}
partial void UpdateSkinTint();
@@ -902,14 +939,15 @@ namespace Barotrauma
if (!Character.GodMode)
{
#if CLIENT
if (Character.IsVisible)
updateVisualsTimer -= deltaTime;
if (Character.IsVisible && updateVisualsTimer <= 0.0f)
{
UpdateLimbAfflictionOverlays();
UpdateSkinTint();
updateVisualsTimer = UpdateVisualsInterval;
}
#endif
CalculateVitality();
KillIfOutOfVitality();
RecalculateVitality();
}
}
@@ -941,7 +979,7 @@ namespace Barotrauma
/// <summary>
/// 0-1.
/// </summary>
public float OxygenLowResistance => !Character.NeedsOxygen ? 1 : GetResistance(oxygenLowAffliction.Prefab);
public float OxygenLowResistance => !Character.NeedsOxygen ? 1 : GetResistance(oxygenLowAffliction.Prefab, LimbType.None);
private void UpdateOxygen(float deltaTime)
{
@@ -951,7 +989,7 @@ namespace Barotrauma
return;
}
float oxygenlowResistance = GetResistance(oxygenLowAffliction.Prefab);
float oxygenlowResistance = GetResistance(oxygenLowAffliction.Prefab, LimbType.None);
float prevOxygen = OxygenAmount;
if (IsUnconscious)
{
@@ -991,13 +1029,13 @@ namespace Barotrauma
CalculateVitality();
}
public void CalculateVitality()
private void CalculateVitality()
{
vitality = MaxVitality;
IsParalyzed = false;
if (Unkillable || Character.GodMode) { return; }
foreach (var (affliction, limbHealth) in afflictions)
foreach ((Affliction affliction, LimbHealth limbHealth) in afflictions)
{
float vitalityDecrease = affliction.GetVitalityDecrease(this);
if (limbHealth != null)
@@ -1020,6 +1058,12 @@ namespace Barotrauma
}
#endif
}
public void RecalculateVitality()
{
CalculateVitality();
KillIfOutOfVitality();
}
private static float GetVitalityMultiplier(Affliction affliction, LimbHealth limbHealth)
{
@@ -53,7 +53,7 @@ namespace Barotrauma
private set
{
rawAfflictionIdentifierString = value;
ParseAfflictionIdentifiers();
parsedAfflictionIdentifiers = rawAfflictionIdentifierString.ToIdentifiers().ToImmutableArray();
}
}
@@ -67,7 +67,7 @@ namespace Barotrauma
private set
{
rawAfflictionTypeString = value;
ParseAfflictionTypes();
parsedAfflictionTypes = rawAfflictionTypeString.ToIdentifiers().ToImmutableArray();
}
}
@@ -119,30 +119,6 @@ namespace Barotrauma
}
}
private void ParseAfflictionTypes()
{
if (string.IsNullOrWhiteSpace(rawAfflictionTypeString))
{
parsedAfflictionTypes = Enumerable.Empty<Identifier>().ToImmutableArray();
return;
}
parsedAfflictionTypes = rawAfflictionTypeString.Split(',', '')
.Select(s => s.Trim()).ToIdentifiers().ToImmutableArray();
}
private void ParseAfflictionIdentifiers()
{
if (string.IsNullOrWhiteSpace(rawAfflictionIdentifierString))
{
parsedAfflictionIdentifiers = Enumerable.Empty<Identifier>().ToImmutableArray();
return;
}
parsedAfflictionIdentifiers = rawAfflictionIdentifierString.Split(',', '')
.Select(s => s.Trim()).ToIdentifiers().ToImmutableArray();
}
public bool MatchesAfflictionIdentifier(string identifier) =>
MatchesAfflictionIdentifier(identifier.ToIdentifier());