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:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -735,6 +737,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()
|
||||
{
|
||||
return Filter.Empty()
|
||||
@@ -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>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Content.Server.Speech.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed partial class UnblockableSpeechComponent : Component
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.Speech.Components;
|
||||
|
||||
namespace Content.Server.Speech.EntitySystems
|
||||
{
|
||||
public sealed class UnblockableSpeechSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<UnblockableSpeechComponent, CheckIgnoreSpeechBlockerEvent>(OnCheck);
|
||||
}
|
||||
|
||||
private void OnCheck(EntityUid uid, UnblockableSpeechComponent component, CheckIgnoreSpeechBlockerEvent args)
|
||||
{
|
||||
args.IgnoreBlocker = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,6 +124,7 @@
|
||||
- type: Speech
|
||||
speechVerb: Robotic
|
||||
speechSounds: Pai
|
||||
- type: UnblockableSpeech
|
||||
- type: Construction
|
||||
graph: Cyborg
|
||||
containers:
|
||||
|
||||
Reference in New Issue
Block a user