Small optimization: structures that haven't taken damage aren't rendered using the damage shader
This commit is contained in:
@@ -61,6 +61,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public float lastUpdate;
|
public float lastUpdate;
|
||||||
|
|
||||||
|
private bool takenDamage;
|
||||||
|
|
||||||
public SpriteEffects SpriteEffects = SpriteEffects.None;
|
public SpriteEffects SpriteEffects = SpriteEffects.None;
|
||||||
|
|
||||||
public bool resizeHorizontal
|
public bool resizeHorizontal
|
||||||
@@ -141,7 +143,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return prefab.HasBody;
|
return takenDamage && prefab.HasBody;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -753,6 +755,8 @@ namespace Barotrauma
|
|||||||
bool hadHole = SectionBodyDisabled(sectionIndex);
|
bool hadHole = SectionBodyDisabled(sectionIndex);
|
||||||
sections[sectionIndex].damage = MathHelper.Clamp(damage, 0.0f, prefab.MaxHealth);
|
sections[sectionIndex].damage = MathHelper.Clamp(damage, 0.0f, prefab.MaxHealth);
|
||||||
|
|
||||||
|
takenDamage = sections.Any(s => s.damage > 0.0f);
|
||||||
|
|
||||||
bool hasHole = SectionBodyDisabled(sectionIndex);
|
bool hasHole = SectionBodyDisabled(sectionIndex);
|
||||||
|
|
||||||
if (hadHole == hasHole) return;
|
if (hadHole == hasHole) return;
|
||||||
@@ -928,6 +932,8 @@ namespace Barotrauma
|
|||||||
s.sections[index].damage =
|
s.sections[index].damage =
|
||||||
ToolBox.GetAttributeFloat(subElement, "damage", 0.0f);
|
ToolBox.GetAttributeFloat(subElement, "damage", 0.0f);
|
||||||
|
|
||||||
|
s.takenDamage = s.takenDamage || s.sections[index].damage > 0.0f;
|
||||||
|
|
||||||
s.sections[index].GapID = ToolBox.GetAttributeInt(subElement, "gap", -1);
|
s.sections[index].GapID = ToolBox.GetAttributeInt(subElement, "gap", -1);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user