Deathgasp changes for mutes (#19025)

Co-authored-by: Errant <35878406+errant@users.noreply.github.com>
This commit is contained in:
Errant
2023-08-22 06:05:16 +00:00
committed by GitHub
parent a470f8f40b
commit 2565a045ca
3 changed files with 17 additions and 0 deletions

View File

@@ -2,6 +2,9 @@
using Content.Server.Chat.Systems; using Content.Server.Chat.Systems;
using Content.Server.GameTicking; using Content.Server.GameTicking;
using Content.Server.Mind.Components; using Content.Server.Mind.Components;
using Content.Server.Popups;
using Content.Server.Speech.Muting;
using Content.Shared.ActionBlocker;
using Content.Shared.Actions; using Content.Shared.Actions;
using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems; using Content.Shared.Mobs.Systems;
@@ -16,10 +19,12 @@ namespace Content.Server.Mobs;
/// </summary> /// </summary>
public sealed class CritMobActionsSystem : EntitySystem public sealed class CritMobActionsSystem : EntitySystem
{ {
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly ChatSystem _chat = default!; [Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly DeathgaspSystem _deathgasp = default!; [Dependency] private readonly DeathgaspSystem _deathgasp = default!;
[Dependency] private readonly IServerConsoleHost _host = default!; [Dependency] private readonly IServerConsoleHost _host = default!;
[Dependency] private readonly MobStateSystem _mobState = default!; [Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly QuickDialogSystem _quickDialog = default!; [Dependency] private readonly QuickDialogSystem _quickDialog = default!;
private const int MaxLastWordsLength = 30; private const int MaxLastWordsLength = 30;
@@ -47,6 +52,12 @@ public sealed class CritMobActionsSystem : EntitySystem
if (!_mobState.IsCritical(uid)) if (!_mobState.IsCritical(uid))
return; return;
if (HasComp<MutedComponent>(uid))
{
_popupSystem.PopupEntity(Loc.GetString("fake-death-muted"), uid, uid);
return;
}
args.Handled = _deathgasp.Deathgasp(uid); args.Handled = _deathgasp.Deathgasp(uid);
} }
@@ -58,6 +69,7 @@ public sealed class CritMobActionsSystem : EntitySystem
_quickDialog.OpenDialog(actor.PlayerSession, Loc.GetString("action-name-crit-last-words"), "", _quickDialog.OpenDialog(actor.PlayerSession, Loc.GetString("action-name-crit-last-words"), "",
(string lastWords) => (string lastWords) =>
{ {
// Intentionally does not check for muteness
if (actor.PlayerSession.AttachedEntity != uid if (actor.PlayerSession.AttachedEntity != uid
|| !_mobState.IsCritical(uid)) || !_mobState.IsCritical(uid))
return; return;

View File

@@ -1,4 +1,5 @@
using Content.Server.Chat.Systems; using Content.Server.Chat.Systems;
using Content.Server.Speech.Muting;
using Content.Shared.Mobs; using Content.Shared.Mobs;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
@@ -33,6 +34,9 @@ public sealed class DeathgaspSystem: EntitySystem
if (!Resolve(uid, ref component, false)) if (!Resolve(uid, ref component, false))
return false; return false;
if (HasComp<MutedComponent>(uid))
return false;
_chat.TryEmoteWithChat(uid, component.Prototype, ignoreActionBlocker: true); _chat.TryEmoteWithChat(uid, component.Prototype, ignoreActionBlocker: true);
return true; return true;

View File

@@ -1 +1,2 @@
speech-muted = You can't speak right now! speech-muted = You can't speak right now!
fake-death-muted = You can't fake your death without a voice!