Added "VulnerableToEMP" property to Powered. Can be edited in sub editor. Reactors and relays are not affected by EMP by default. Closes #495

This commit is contained in:
Joonas Rikkonen
2018-07-18 15:07:21 +03:00
parent d6ec1bc339
commit 30a453191f
4 changed files with 14 additions and 10 deletions
@@ -78,15 +78,13 @@ namespace Barotrauma
{
float distSqr = Vector2.DistanceSquared(item.WorldPosition, worldPosition);
if (distSqr > displayRangeSqr) continue;
//ignore reactors (don't want to blow them up)
if (item.GetComponent<Reactor>() != null) continue;
float distFactor = 1.0f - (float)Math.Sqrt(distSqr) / displayRange;
//damage repairable power-consuming items
var powerTransfer = item.GetComponent<Powered>();
if (powerTransfer != null && item.FixRequirements.Count > 0)
var powered = item.GetComponent<Powered>();
if (powered == null || !powered.VulnerableToEMP) continue;
if (item.FixRequirements.Count > 0)
{
item.Condition -= 100 * empStrength * distFactor;
}