Deathgasp + last words / succumbing / fake deathgasp as crit actions (#18993)
This commit is contained in:
@@ -137,10 +137,17 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
/// <param name="shell"></param>
|
||||
/// <param name="player">The player doing the speaking</param>
|
||||
/// <param name="nameOverride">The name to use for the speaking entity. Usually this should just be modified via <see cref="TransformSpeakerNameEvent"/>. If this is set, the event will not get raised.</param>
|
||||
public void TrySendInGameICMessage(EntityUid source, string message, InGameICChatType desiredType, bool hideChat, bool hideLog = false,
|
||||
IConsoleShell? shell = null, IPlayerSession? player = null, string? nameOverride = null, bool checkRadioPrefix = true)
|
||||
public void TrySendInGameICMessage(
|
||||
EntityUid source,
|
||||
string message,
|
||||
InGameICChatType desiredType,
|
||||
bool hideChat, bool hideLog = false,
|
||||
IConsoleShell? shell = null,
|
||||
IPlayerSession? player = null, string? nameOverride = null,
|
||||
bool checkRadioPrefix = true,
|
||||
bool ignoreActionBlocker = false)
|
||||
{
|
||||
TrySendInGameICMessage(source, message, desiredType, hideChat ? ChatTransmitRange.HideChat : ChatTransmitRange.Normal, hideLog, shell, player, nameOverride, checkRadioPrefix);
|
||||
TrySendInGameICMessage(source, message, desiredType, hideChat ? ChatTransmitRange.HideChat : ChatTransmitRange.Normal, hideLog, shell, player, nameOverride, checkRadioPrefix, ignoreActionBlocker);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -153,8 +160,19 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
/// <param name="shell"></param>
|
||||
/// <param name="player">The player doing the speaking</param>
|
||||
/// <param name="nameOverride">The name to use for the speaking entity. Usually this should just be modified via <see cref="TransformSpeakerNameEvent"/>. If this is set, the event will not get raised.</param>
|
||||
public void TrySendInGameICMessage(EntityUid source, string message, InGameICChatType desiredType, ChatTransmitRange range, bool hideLog = false,
|
||||
IConsoleShell? shell = null, IPlayerSession? player = null, string? nameOverride = null, bool checkRadioPrefix = true)
|
||||
/// <param name="ignoreActionBlocker">If set to true, action blocker will not be considered for whether an entity can send this message.</param>
|
||||
public void TrySendInGameICMessage(
|
||||
EntityUid source,
|
||||
string message,
|
||||
InGameICChatType desiredType,
|
||||
ChatTransmitRange range,
|
||||
bool hideLog = false,
|
||||
IConsoleShell? shell = null,
|
||||
IPlayerSession? player = null,
|
||||
string? nameOverride = null,
|
||||
bool checkRadioPrefix = true,
|
||||
bool ignoreActionBlocker = false
|
||||
)
|
||||
{
|
||||
if (HasComp<GhostComponent>(source))
|
||||
{
|
||||
@@ -187,7 +205,7 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
// Was there an emote in the message? If so, send it.
|
||||
if (player != null && emoteStr != message && emoteStr != null)
|
||||
{
|
||||
SendEntityEmote(source, emoteStr, range, nameOverride);
|
||||
SendEntityEmote(source, emoteStr, range, nameOverride, ignoreActionBlocker);
|
||||
}
|
||||
|
||||
// This can happen if the entire string is sanitized out.
|
||||
@@ -199,7 +217,7 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
{
|
||||
if (TryProccessRadioMessage(source, message, out var modMessage, out var channel))
|
||||
{
|
||||
SendEntityWhisper(source, modMessage, range, channel, nameOverride);
|
||||
SendEntityWhisper(source, modMessage, range, channel, nameOverride, ignoreActionBlocker);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -208,19 +226,25 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
switch (desiredType)
|
||||
{
|
||||
case InGameICChatType.Speak:
|
||||
SendEntitySpeak(source, message, range, nameOverride, hideLog);
|
||||
SendEntitySpeak(source, message, range, nameOverride, hideLog, ignoreActionBlocker);
|
||||
break;
|
||||
case InGameICChatType.Whisper:
|
||||
SendEntityWhisper(source, message, range, null, nameOverride, hideLog);
|
||||
SendEntityWhisper(source, message, range, null, nameOverride, hideLog, ignoreActionBlocker);
|
||||
break;
|
||||
case InGameICChatType.Emote:
|
||||
SendEntityEmote(source, message, range, nameOverride, hideLog);
|
||||
SendEntityEmote(source, message, range, nameOverride, hideLog, ignoreActionBlocker);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void TrySendInGameOOCMessage(EntityUid source, string message, InGameOOCChatType type, bool hideChat,
|
||||
IConsoleShell? shell = null, IPlayerSession? player = null)
|
||||
public void TrySendInGameOOCMessage(
|
||||
EntityUid source,
|
||||
string message,
|
||||
InGameOOCChatType type,
|
||||
bool hideChat,
|
||||
IConsoleShell? shell = null,
|
||||
IPlayerSession? player = null
|
||||
)
|
||||
{
|
||||
if (!CanSendInGame(message, shell, player))
|
||||
return;
|
||||
@@ -262,8 +286,13 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
/// <param name="sender">The sender (Communications Console in Communications Console Announcement)</param>
|
||||
/// <param name="playSound">Play the announcement sound</param>
|
||||
/// <param name="colorOverride">Optional color for the announcement message</param>
|
||||
public void DispatchGlobalAnnouncement(string message, string sender = "Central Command",
|
||||
bool playSound = true, SoundSpecifier? announcementSound = null, Color? colorOverride = null)
|
||||
public void DispatchGlobalAnnouncement(
|
||||
string message,
|
||||
string sender = "Central Command",
|
||||
bool playSound = true,
|
||||
SoundSpecifier? announcementSound = null,
|
||||
Color? colorOverride = null
|
||||
)
|
||||
{
|
||||
var wrappedMessage = Loc.GetString("chat-manager-sender-announcement-wrap-message", ("sender", sender), ("message", FormattedMessage.EscapeText(message)));
|
||||
_chatManager.ChatMessageToAll(ChatChannel.Radio, message, wrappedMessage, default, false, true, colorOverride);
|
||||
@@ -282,8 +311,13 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
/// <param name="sender">The sender (Communications Console in Communications Console Announcement)</param>
|
||||
/// <param name="playDefaultSound">Play the announcement sound</param>
|
||||
/// <param name="colorOverride">Optional color for the announcement message</param>
|
||||
public void DispatchStationAnnouncement(EntityUid source, string message, string sender = "Central Command",
|
||||
bool playDefaultSound = true, SoundSpecifier? announcementSound = null, Color? colorOverride = null)
|
||||
public void DispatchStationAnnouncement(
|
||||
EntityUid source,
|
||||
string message,
|
||||
string sender = "Central Command",
|
||||
bool playDefaultSound = true,
|
||||
SoundSpecifier? announcementSound = null,
|
||||
Color? colorOverride = null)
|
||||
{
|
||||
var wrappedMessage = Loc.GetString("chat-manager-sender-announcement-wrap-message", ("sender", sender), ("message", FormattedMessage.EscapeText(message)));
|
||||
var station = _stationSystem.GetOwningStation(source);
|
||||
@@ -312,9 +346,16 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
|
||||
#region Private API
|
||||
|
||||
private void SendEntitySpeak(EntityUid source, string originalMessage, ChatTransmitRange range, string? nameOverride, bool hideLog = false)
|
||||
private void SendEntitySpeak(
|
||||
EntityUid source,
|
||||
string originalMessage,
|
||||
ChatTransmitRange range,
|
||||
string? nameOverride,
|
||||
bool hideLog = false,
|
||||
bool ignoreActionBlocker = false
|
||||
)
|
||||
{
|
||||
if (!_actionBlocker.CanSpeak(source))
|
||||
if (!_actionBlocker.CanSpeak(source) && !ignoreActionBlocker)
|
||||
return;
|
||||
|
||||
var message = TransformSpeech(source, originalMessage);
|
||||
@@ -366,9 +407,17 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
}
|
||||
}
|
||||
|
||||
private void SendEntityWhisper(EntityUid source, string originalMessage, ChatTransmitRange range, RadioChannelPrototype? channel, string? nameOverride, bool hideLog = false)
|
||||
private void SendEntityWhisper(
|
||||
EntityUid source,
|
||||
string originalMessage,
|
||||
ChatTransmitRange range,
|
||||
RadioChannelPrototype? channel,
|
||||
string? nameOverride,
|
||||
bool hideLog = false,
|
||||
bool ignoreActionBlocker = false
|
||||
)
|
||||
{
|
||||
if (!_actionBlocker.CanSpeak(source))
|
||||
if (!_actionBlocker.CanSpeak(source) && !ignoreActionBlocker)
|
||||
return;
|
||||
|
||||
var message = TransformSpeech(source, originalMessage);
|
||||
@@ -449,16 +498,27 @@ public sealed partial class ChatSystem : SharedChatSystem
|
||||
}
|
||||
}
|
||||
|
||||
private void SendEntityEmote(EntityUid source, string action, ChatTransmitRange range, string? nameOverride, bool hideLog = false, bool checkEmote = true)
|
||||
private void SendEntityEmote(
|
||||
EntityUid source,
|
||||
string action,
|
||||
ChatTransmitRange range,
|
||||
string? nameOverride,
|
||||
bool hideLog = false,
|
||||
bool checkEmote = true,
|
||||
bool ignoreActionBlocker = false
|
||||
)
|
||||
{
|
||||
if (!_actionBlocker.CanEmote(source)) return;
|
||||
if (!_actionBlocker.CanEmote(source) && !ignoreActionBlocker)
|
||||
return;
|
||||
|
||||
// get the entity's apparent name (if no override provided).
|
||||
string name = FormattedMessage.EscapeText(nameOverride ?? Identity.Name(source, EntityManager));
|
||||
var ent = Identity.Entity(source, EntityManager);
|
||||
string name = FormattedMessage.EscapeText(nameOverride ?? Name(ent));
|
||||
|
||||
// Emotes use Identity.Name, since it doesn't actually involve your voice at all.
|
||||
var wrappedMessage = Loc.GetString("chat-manager-entity-me-wrap-message",
|
||||
("entityName", name),
|
||||
("entity", ent),
|
||||
("message", FormattedMessage.EscapeText(action)));
|
||||
|
||||
if (checkEmote)
|
||||
|
||||
Reference in New Issue
Block a user