(f5be65240) Optimized explosions a bit, toned down wall damage effect when the wall has a small amount of damage.
This commit is contained in:
@@ -292,8 +292,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (damageEffect != null)
|
if (damageEffect != null)
|
||||||
{
|
{
|
||||||
float newCutoff = Sections[i].damage > 0 ?
|
float newCutoff = MathHelper.Lerp(0.0f, 0.65f, Sections[i].damage / Prefab.Health);
|
||||||
MathHelper.Lerp(0.2f, 0.65f, Sections[i].damage / Prefab.Health) : 0.0f;
|
|
||||||
|
|
||||||
if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f || color != Submarine.DamageEffectColor)
|
if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f || color != Submarine.DamageEffectColor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,8 +28,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public Explosion(float range, float force, float damage, float structureDamage, float empStrength = 0.0f)
|
public Explosion(float range, float force, float damage, float structureDamage, float empStrength = 0.0f)
|
||||||
{
|
{
|
||||||
attack = new Attack(damage, 0.0f, 0.0f, structureDamage, range);
|
attack = new Attack(damage, 0.0f, 0.0f, structureDamage, range)
|
||||||
attack.SeverLimbsProbability = 1.0f;
|
{
|
||||||
|
SeverLimbsProbability = 1.0f
|
||||||
|
};
|
||||||
this.force = force;
|
this.force = force;
|
||||||
this.empStrength = empStrength;
|
this.empStrength = empStrength;
|
||||||
sparks = true;
|
sparks = true;
|
||||||
@@ -165,10 +167,23 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (attack.Range <= 0.0f) return;
|
if (attack.Range <= 0.0f) return;
|
||||||
|
|
||||||
|
//long range for the broad distance check, because large characters may still be in range even if their collider isn't
|
||||||
|
float broadRange = Math.Max(attack.Range * 10.0f, 10000.0f);
|
||||||
|
|
||||||
foreach (Character c in Character.CharacterList)
|
foreach (Character c in Character.CharacterList)
|
||||||
{
|
{
|
||||||
|
if (!c.Enabled ||
|
||||||
|
Math.Abs(c.WorldPosition.X - worldPosition.X) > broadRange ||
|
||||||
|
Math.Abs(c.WorldPosition.Y - worldPosition.Y) > broadRange)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Vector2 explosionPos = worldPosition;
|
Vector2 explosionPos = worldPosition;
|
||||||
if (c.Submarine != null) explosionPos -= c.Submarine.Position;
|
if (c.Submarine != null) { explosionPos -= c.Submarine.Position; }
|
||||||
|
|
||||||
|
Hull hull = Hull.FindHull(ConvertUnits.ToDisplayUnits(explosionPos), null, false);
|
||||||
|
bool underWater = hull == null || explosionPos.Y < hull.Surface;
|
||||||
|
|
||||||
Hull hull = Hull.FindHull(ConvertUnits.ToDisplayUnits(explosionPos), null, false);
|
Hull hull = Hull.FindHull(ConvertUnits.ToDisplayUnits(explosionPos), null, false);
|
||||||
bool underWater = hull == null || explosionPos.Y < hull.Surface;
|
bool underWater = hull == null || explosionPos.Y < hull.Surface;
|
||||||
@@ -185,7 +200,7 @@ namespace Barotrauma
|
|||||||
float limbRadius = Math.Max(Math.Max(limb.body.width * 0.5f, limb.body.height * 0.5f), limb.body.radius);
|
float limbRadius = Math.Max(Math.Max(limb.body.width * 0.5f, limb.body.height * 0.5f), limb.body.radius);
|
||||||
dist = Math.Max(0.0f, dist - FarseerPhysics.ConvertUnits.ToDisplayUnits(limbRadius));
|
dist = Math.Max(0.0f, dist - FarseerPhysics.ConvertUnits.ToDisplayUnits(limbRadius));
|
||||||
|
|
||||||
if (dist > attack.Range) continue;
|
if (dist > attack.Range) { continue; }
|
||||||
|
|
||||||
float distFactor = 1.0f - dist / attack.Range;
|
float distFactor = 1.0f - dist / attack.Range;
|
||||||
|
|
||||||
@@ -259,8 +274,7 @@ namespace Barotrauma
|
|||||||
float dist = 600.0f;
|
float dist = 600.0f;
|
||||||
foreach (MapEntity entity in MapEntity.mapEntityList)
|
foreach (MapEntity entity in MapEntity.mapEntityList)
|
||||||
{
|
{
|
||||||
Structure structure = entity as Structure;
|
if (!(entity is Structure structure)) { continue; }
|
||||||
if (structure == null) continue;
|
|
||||||
|
|
||||||
if (structure.HasBody &&
|
if (structure.HasBody &&
|
||||||
!structure.IsPlatform &&
|
!structure.IsPlatform &&
|
||||||
|
|||||||
Reference in New Issue
Block a user