Borgs can now speak while in Crit (#21802)

* Borgs can speak while crit, also radio bug fix

* Revert "Borgs can speak while crit, also radio bug fix"

This reverts commit e1136ad781229cf5fc3cadcf70742168fc73d961.

* Borgs can speak in crit + radio bug fix

* Tied to a new generic component on SpeechComponent

* Ignoring Speech Block via Component uses an event!

* Remove debug logs and bypass if already true
This commit is contained in:
Skye
2023-12-01 19:25:20 -05:00
committed by GitHub
parent 8185212a02
commit 751bed509e
4 changed files with 52 additions and 1 deletions

View File

@@ -196,6 +196,8 @@ public sealed partial class ChatSystem : SharedChatSystem
if (!CanSendInGame(message, shell, player))
return;
ignoreActionBlocker = CheckIgnoreSpeechBlocker(source, ignoreActionBlocker);
// this method is a disaster
// every second i have to spend working with this code is fucking agony
// scientists have to wonder how any of this was merged
@@ -239,7 +241,7 @@ public sealed partial class ChatSystem : SharedChatSystem
{
if (TryProccessRadioMessage(source, message, out var modMessage, out var channel))
{
SendEntityWhisper(source, modMessage, range, channel, nameOverride, ignoreActionBlocker);
SendEntityWhisper(source, modMessage, range, channel, nameOverride, hideLog, ignoreActionBlocker);
return;
}
}
@@ -734,6 +736,17 @@ public sealed partial class ChatSystem : SharedChatSystem
return ev.Message;
}
public bool CheckIgnoreSpeechBlocker(EntityUid sender, bool ignoreBlocker)
{
if (ignoreBlocker)
return ignoreBlocker;
var ev = new CheckIgnoreSpeechBlockerEvent(sender, ignoreBlocker);
RaiseLocalEvent(sender, ev, true);
return ev.IgnoreBlocker;
}
private IEnumerable<INetChannel> GetDeadChatClients()
{
@@ -872,6 +885,18 @@ public sealed class TransformSpeechEvent : EntityEventArgs
}
}
public sealed class CheckIgnoreSpeechBlockerEvent : EntityEventArgs
{
public EntityUid Sender;
public bool IgnoreBlocker;
public CheckIgnoreSpeechBlockerEvent(EntityUid sender, bool ignoreBlocker)
{
Sender = sender;
IgnoreBlocker = ignoreBlocker;
}
}
/// <summary>
/// Raised on an entity when it speaks, either through 'say' or 'whisper'.
/// </summary>