Build 0.21.1.0

This commit is contained in:
Markus Isberg
2023-01-13 18:10:35 +02:00
parent 2f7205fb4b
commit 697ec52120
155 changed files with 2423 additions and 1237 deletions
@@ -602,6 +602,18 @@ namespace Barotrauma
break;
}
}
for (int i = 0; i < effects.Count; i++)
{
for (int j = i + 1; j < effects.Count; j++)
{
var a = effects[i];
var b = effects[j];
if (a.MinStrength < b.MaxStrength && b.MinStrength < a.MaxStrength)
{
DebugConsole.AddWarning($"Affliction \"{Identifier}\" contains effects with overlapping strength ranges. Only one effect can be active at a time, meaning one of the effects won't work.");
}
}
}
}
public void ClearEffects()
@@ -230,6 +230,11 @@ namespace Barotrauma
public float StunTimer { get; private set; }
/// <summary>
/// Was the character in full health at the beginning of the frame?
/// </summary>
public bool WasInFullHealth { get; private set; }
public Affliction PressureAffliction
{
get { return pressureAffliction; }
@@ -772,6 +777,8 @@ namespace Barotrauma
public void Update(float deltaTime)
{
WasInFullHealth = vitality >= MaxVitality;
UpdateOxygen(deltaTime);
StunTimer = Stun > 0 ? StunTimer + deltaTime : 0;
@@ -878,7 +885,11 @@ namespace Barotrauma
private void UpdateOxygen(float deltaTime)
{
if (!Character.NeedsOxygen) { return; }
if (!Character.NeedsOxygen)
{
oxygenLowAffliction.Strength = 0.0f;
return;
}
float oxygenlowResistance = GetResistance(oxygenLowAffliction.Prefab);
float prevOxygen = OxygenAmount;
@@ -980,6 +991,8 @@ namespace Barotrauma
UpdateLimbAfflictionOverlays();
UpdateSkinTint();
Character.Kill(type, affliction);
WasInFullHealth = false;
#if CLIENT
DisplayVitalityDelay = 0.0f;
DisplayedVitality = Vitality;
@@ -1024,17 +1037,18 @@ namespace Barotrauma
}
private readonly List<Affliction> allAfflictions = new List<Affliction>();
private List<Affliction> GetAllAfflictions(bool mergeSameAfflictions)
private List<Affliction> GetAllAfflictions(bool mergeSameAfflictions, Func<Affliction, bool> predicate = null)
{
allAfflictions.Clear();
if (!mergeSameAfflictions)
{
allAfflictions.AddRange(afflictions.Keys);
allAfflictions.AddRange(predicate == null ? afflictions.Keys : afflictions.Keys.Where(predicate));
}
else
{
foreach (Affliction affliction in afflictions.Keys)
{
if (predicate != null && !predicate(affliction)) { continue; }
var existingAffliction = allAfflictions.Find(a => a.Prefab == affliction.Prefab);
if (existingAffliction == null)
{