Fix some action-blocker bugs (#6050)

This commit is contained in:
Leon Friedrich
2022-01-08 00:57:20 +13:00
committed by GitHub
parent c29489ff4d
commit 2f3b6fb28e
3 changed files with 23 additions and 10 deletions

View File

@@ -8,12 +8,12 @@ namespace Content.Shared.Speech
{
base.Initialize();
SubscribeLocalEvent<SharedSpeechComponent, SpeakAttemptEvent>(OnSpeakAttempt);
SubscribeLocalEvent<SpeakAttemptEvent>(OnSpeakAttempt);
}
private void OnSpeakAttempt(EntityUid uid, SharedSpeechComponent component, SpeakAttemptEvent args)
private void OnSpeakAttempt(SpeakAttemptEvent args)
{
if (!component.Enabled)
if (!TryComp(args.Uid, out SharedSpeechComponent? speech) || !speech.Enabled)
args.Cancel();
}
}