Two more events (#6906)

* vent clog!

* forgot you

* Breaker flip event, to annoy engineering.

* small fix.
This commit is contained in:
Moony
2022-02-26 21:04:01 -06:00
committed by GitHub
parent 1c45674871
commit 8b2184a53c
7 changed files with 163 additions and 5 deletions

View File

@@ -57,11 +57,7 @@ namespace Content.Server.Power.EntitySystems
if (access == null || _accessReader.IsAllowed(access, args.Session.AttachedEntity.Value))
{
component.MainBreakerEnabled = !component.MainBreakerEnabled;
Comp<PowerNetworkBatteryComponent>(uid).CanDischarge = component.MainBreakerEnabled;
UpdateUIState(uid, component);
SoundSystem.Play(Filter.Pvs(uid), component.OnReceiveMessageSound.GetSound(), uid, AudioParams.Default.WithVolume(-2f));
ApcToggleBreaker(uid, component);
}
else
{
@@ -70,6 +66,18 @@ namespace Content.Server.Power.EntitySystems
}
}
public void ApcToggleBreaker(EntityUid uid, ApcComponent? apc = null, PowerNetworkBatteryComponent? battery = null)
{
if (!Resolve(uid, ref apc, ref battery))
return;
apc.MainBreakerEnabled = !apc.MainBreakerEnabled;
battery.CanDischarge = apc.MainBreakerEnabled;
UpdateUIState(uid, apc);
SoundSystem.Play(Filter.Pvs(uid), apc.OnReceiveMessageSound.GetSound(), uid, AudioParams.Default.WithVolume(-2f));
}
private void OnEmagged(EntityUid uid, ApcComponent comp, GotEmaggedEvent args)
{
if(!comp.Emagged)