Revert "Revert "Emp more effects" (#16159)" (#16165)

This reverts commit 0da5a78509.
This commit is contained in:
metalgearsloth
2023-05-07 01:26:04 +10:00
committed by GitHub
parent de1613f7ef
commit f7950d07e2
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;
}
}
}