(208dc8793) Fixed ElectricalDischarger electricity effect staying visible if the item breaks or the component is deactivated from outside (e.g. via a StatusEffect or the parent component). Closes #1402

This commit is contained in:
Joonas Rikkonen
2019-04-10 15:13:08 +03:00
parent e94228d346
commit 488fded57f

View File

@@ -34,6 +34,20 @@ namespace Barotrauma.Items.Components
}
}
public override bool IsActive
{
get { return base.IsActive; }
set
{
base.IsActive = value;
if (!value)
{
nodes.Clear();
charactersInRange.Clear();
}
}
}
[Serialize(100.0f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 5000.0f)]
public float Range
{
@@ -126,14 +140,19 @@ namespace Barotrauma.Items.Components
}
else
{
nodes.Clear();
charactersInRange.Clear();
IsActive = false;
}
voltage = 0.0f;
}
public override void UpdateBroken(float deltaTime, Camera cam)
{
base.UpdateBroken(deltaTime, cam);
nodes.Clear();
charactersInRange.Clear();
}
private void Discharge()
{
ApplyStatusEffects(ActionType.OnUse, 1.0f);