Emp more effects (#14550)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Slava0135
2023-05-06 04:38:09 +03:00
committed by GitHub
parent 7b667663fa
commit 4d47562dde
18 changed files with 245 additions and 14 deletions

View File

@@ -224,19 +224,20 @@ namespace Content.Server.Light.EntitySystems
/// <summary>
/// Try to break bulb inside light fixture
/// </summary>
public void TryDestroyBulb(EntityUid uid, PoweredLightComponent? light = null)
public bool TryDestroyBulb(EntityUid uid, PoweredLightComponent? light = null)
{
// check bulb state
var bulbUid = GetBulb(uid, light);
if (bulbUid == null || !EntityManager.TryGetComponent(bulbUid.Value, out LightBulbComponent? lightBulb))
return;
return false;
if (lightBulb.State == LightBulbState.Broken)
return;
return false;
// break it
_bulbSystem.SetState(bulbUid.Value, LightBulbState.Broken, lightBulb);
_bulbSystem.PlayBreakSound(bulbUid.Value, lightBulb);
UpdateLight(uid, light);
return true;
}
#endregion
@@ -428,8 +429,8 @@ namespace Content.Server.Light.EntitySystems
private void OnEmpPulse(EntityUid uid, PoweredLightComponent component, ref EmpPulseEvent args)
{
args.Affected = true;
TryDestroyBulb(uid, component);
if (TryDestroyBulb(uid, component))
args.Affected = true;
}
}
}