Release 1.10.5.0 - Autumn Update 2025
This commit is contained in:
@@ -501,10 +501,14 @@ namespace Barotrauma
|
||||
{
|
||||
float newCutoff = MathHelper.Lerp(0.0f, 0.65f, Sections[i].damage / MaxHealth);
|
||||
|
||||
if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.05f)
|
||||
//change the parameters of the damage effect and start a new sprite batch if the damage is different by 5% or more
|
||||
if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f ||
|
||||
//if we were previously rendering some small amount of damage but now 0 damage, make sure we update the parameters
|
||||
//"no damage" vs "just a tiny fraction of damage" makes a difference, even though normally 5% differences in damage aren't noticeable
|
||||
MathUtils.NearlyEqual(newCutoff, 0.0f) != MathUtils.NearlyEqual(Submarine.DamageEffectCutoff, 0.0f))
|
||||
{
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred,
|
||||
BlendState.NonPremultiplied, SamplerState.LinearWrap,
|
||||
null, null,
|
||||
damageEffect,
|
||||
|
||||
@@ -160,37 +160,39 @@ namespace Barotrauma
|
||||
|
||||
public static float DamageEffectCutoff;
|
||||
|
||||
private static readonly List<Structure> depthSortedDamageable = new List<Structure>();
|
||||
|
||||
public static void DrawDamageable(SpriteBatch spriteBatch, Effect damageEffect, bool editing = false, Predicate<MapEntity> predicate = null)
|
||||
{
|
||||
if (!editing && visibleEntities != null)
|
||||
var entitiesToRender = !editing && visibleEntities != null ? visibleEntities : MapEntity.MapEntityList;
|
||||
|
||||
depthSortedDamageable.Clear();
|
||||
|
||||
//insertion sort according to draw depth
|
||||
foreach (MapEntity e in entitiesToRender)
|
||||
{
|
||||
foreach (MapEntity e in visibleEntities)
|
||||
if (e is Structure structure && structure.DrawDamageEffect)
|
||||
{
|
||||
if (e is Structure structure && structure.DrawDamageEffect)
|
||||
if (predicate != null)
|
||||
{
|
||||
if (predicate != null)
|
||||
{
|
||||
if (!predicate(structure)) { continue; }
|
||||
}
|
||||
structure.DrawDamage(spriteBatch, damageEffect, editing);
|
||||
if (!predicate(e)) { continue; }
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Structure structure in Structure.WallList)
|
||||
{
|
||||
if (structure.DrawDamageEffect)
|
||||
float drawDepth = structure.GetDrawDepth();
|
||||
int i = 0;
|
||||
while (i < depthSortedDamageable.Count)
|
||||
{
|
||||
if (predicate != null)
|
||||
{
|
||||
if (!predicate(structure)) { continue; }
|
||||
}
|
||||
structure.DrawDamage(spriteBatch, damageEffect, editing);
|
||||
float otherDrawDepth = depthSortedDamageable[i].GetDrawDepth();
|
||||
if (otherDrawDepth < drawDepth) { break; }
|
||||
i++;
|
||||
}
|
||||
depthSortedDamageable.Insert(i, structure);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Structure s in depthSortedDamageable)
|
||||
{
|
||||
s.DrawDamage(spriteBatch, damageEffect, editing);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawPaintedColors(SpriteBatch spriteBatch, bool editing = false, Predicate<MapEntity> predicate = null)
|
||||
@@ -287,7 +289,7 @@ namespace Barotrauma
|
||||
if (combinedHulls.ContainsKey(hull) || combinedHulls.Values.Any(hh => hh.Contains(hull))) { continue; }
|
||||
|
||||
List<Hull> linkedHulls = new List<Hull>();
|
||||
MiniMap.GetLinkedHulls(hull, linkedHulls);
|
||||
hull.GetLinkedHulls(linkedHulls);
|
||||
|
||||
linkedHulls.Remove(hull);
|
||||
|
||||
@@ -297,7 +299,6 @@ namespace Barotrauma
|
||||
{
|
||||
combinedHulls.Add(hull, new HashSet<Hull>());
|
||||
}
|
||||
|
||||
combinedHulls[hull].Add(linkedHull);
|
||||
}
|
||||
}
|
||||
@@ -567,6 +568,8 @@ namespace Barotrauma
|
||||
{
|
||||
if (item.GetComponent<OxygenGenerator>() is not OxygenGenerator oxygenGenerator) { continue; }
|
||||
|
||||
oxygenGenerator.GetVents();
|
||||
|
||||
Dictionary<Hull, float> hullOxygenFlow = new Dictionary<Hull, float>();
|
||||
|
||||
foreach (var linkedTo in item.linkedTo)
|
||||
|
||||
Reference in New Issue
Block a user