Prevent using LOOC in crit (#18297)
* Prevent crit players from using LOOC * fix comment
This commit is contained in:
@@ -6,7 +6,6 @@ using Content.Server.Chat.Managers;
|
|||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.Ghost.Components;
|
using Content.Server.Ghost.Components;
|
||||||
using Content.Server.Players;
|
using Content.Server.Players;
|
||||||
using Content.Server.Popups;
|
|
||||||
using Content.Server.Station.Components;
|
using Content.Server.Station.Components;
|
||||||
using Content.Server.Station.Systems;
|
using Content.Server.Station.Systems;
|
||||||
using Content.Shared.ActionBlocker;
|
using Content.Shared.ActionBlocker;
|
||||||
@@ -14,7 +13,6 @@ using Content.Shared.CCVar;
|
|||||||
using Content.Shared.Chat;
|
using Content.Shared.Chat;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Content.Shared.IdentityManagement;
|
using Content.Shared.IdentityManagement;
|
||||||
using Content.Shared.Inventory;
|
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
using Content.Shared.Radio;
|
using Content.Shared.Radio;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
@@ -48,8 +46,6 @@ public sealed partial class ChatSystem : SharedChatSystem
|
|||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
|
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
|
||||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
|
||||||
[Dependency] private readonly PopupSystem _popup = default!;
|
|
||||||
[Dependency] private readonly StationSystem _stationSystem = default!;
|
[Dependency] private readonly StationSystem _stationSystem = default!;
|
||||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
@@ -59,7 +55,8 @@ public sealed partial class ChatSystem : SharedChatSystem
|
|||||||
public const string DefaultAnnouncementSound = "/Audio/Announcements/announce.ogg";
|
public const string DefaultAnnouncementSound = "/Audio/Announcements/announce.ogg";
|
||||||
|
|
||||||
private bool _loocEnabled = true;
|
private bool _loocEnabled = true;
|
||||||
private bool _deadLoocEnabled = false;
|
private bool _deadLoocEnabled;
|
||||||
|
private bool _critLoocEnabled;
|
||||||
private readonly bool _adminLoocEnabled = true;
|
private readonly bool _adminLoocEnabled = true;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -68,6 +65,7 @@ public sealed partial class ChatSystem : SharedChatSystem
|
|||||||
InitializeEmotes();
|
InitializeEmotes();
|
||||||
_configurationManager.OnValueChanged(CCVars.LoocEnabled, OnLoocEnabledChanged, true);
|
_configurationManager.OnValueChanged(CCVars.LoocEnabled, OnLoocEnabledChanged, true);
|
||||||
_configurationManager.OnValueChanged(CCVars.DeadLoocEnabled, OnDeadLoocEnabledChanged, true);
|
_configurationManager.OnValueChanged(CCVars.DeadLoocEnabled, OnDeadLoocEnabledChanged, true);
|
||||||
|
_configurationManager.OnValueChanged(CCVars.CritLoocEnabled, OnCritLoocEnabledChanged, true);
|
||||||
|
|
||||||
SubscribeLocalEvent<GameRunLevelChangedEvent>(OnGameChange);
|
SubscribeLocalEvent<GameRunLevelChangedEvent>(OnGameChange);
|
||||||
}
|
}
|
||||||
@@ -78,6 +76,7 @@ public sealed partial class ChatSystem : SharedChatSystem
|
|||||||
ShutdownEmotes();
|
ShutdownEmotes();
|
||||||
_configurationManager.UnsubValueChanged(CCVars.LoocEnabled, OnLoocEnabledChanged);
|
_configurationManager.UnsubValueChanged(CCVars.LoocEnabled, OnLoocEnabledChanged);
|
||||||
_configurationManager.UnsubValueChanged(CCVars.DeadLoocEnabled, OnDeadLoocEnabledChanged);
|
_configurationManager.UnsubValueChanged(CCVars.DeadLoocEnabled, OnDeadLoocEnabledChanged);
|
||||||
|
_configurationManager.UnsubValueChanged(CCVars.CritLoocEnabled, OnCritLoocEnabledChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLoocEnabledChanged(bool val)
|
private void OnLoocEnabledChanged(bool val)
|
||||||
@@ -98,6 +97,16 @@ public sealed partial class ChatSystem : SharedChatSystem
|
|||||||
Loc.GetString(val ? "chat-manager-dead-looc-chat-enabled-message" : "chat-manager-dead-looc-chat-disabled-message"));
|
Loc.GetString(val ? "chat-manager-dead-looc-chat-enabled-message" : "chat-manager-dead-looc-chat-disabled-message"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnCritLoocEnabledChanged(bool val)
|
||||||
|
{
|
||||||
|
if (_critLoocEnabled == val)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_critLoocEnabled = val;
|
||||||
|
_chatManager.DispatchServerAnnouncement(
|
||||||
|
Loc.GetString(val ? "chat-manager-crit-looc-chat-enabled-message" : "chat-manager-crit-looc-chat-disabled-message"));
|
||||||
|
}
|
||||||
|
|
||||||
private void OnGameChange(GameRunLevelChangedEvent ev)
|
private void OnGameChange(GameRunLevelChangedEvent ev)
|
||||||
{
|
{
|
||||||
switch (ev.New)
|
switch (ev.New)
|
||||||
@@ -225,6 +234,10 @@ public sealed partial class ChatSystem : SharedChatSystem
|
|||||||
(HasComp<GhostComponent>(source) || _mobStateSystem.IsDead(source)))
|
(HasComp<GhostComponent>(source) || _mobStateSystem.IsDead(source)))
|
||||||
sendType = InGameOOCChatType.Dead;
|
sendType = InGameOOCChatType.Dead;
|
||||||
|
|
||||||
|
// If crit player LOOC is disabled, don't send the message at all.
|
||||||
|
if (!_critLoocEnabled && _mobStateSystem.IsCritical(source))
|
||||||
|
return;
|
||||||
|
|
||||||
switch (sendType)
|
switch (sendType)
|
||||||
{
|
{
|
||||||
case InGameOOCChatType.Dead:
|
case InGameOOCChatType.Dead:
|
||||||
@@ -452,6 +465,11 @@ public sealed partial class ChatSystem : SharedChatSystem
|
|||||||
if (!_adminLoocEnabled) return;
|
if (!_adminLoocEnabled) return;
|
||||||
}
|
}
|
||||||
else if (!_loocEnabled) return;
|
else if (!_loocEnabled) return;
|
||||||
|
|
||||||
|
// If crit player LOOC is disabled, don't send the message at all.
|
||||||
|
if (!_critLoocEnabled && _mobStateSystem.IsCritical(source))
|
||||||
|
return;
|
||||||
|
|
||||||
var wrappedMessage = Loc.GetString("chat-manager-entity-looc-wrap-message",
|
var wrappedMessage = Loc.GetString("chat-manager-entity-looc-wrap-message",
|
||||||
("entityName", name),
|
("entityName", name),
|
||||||
("message", FormattedMessage.EscapeText(message)));
|
("message", FormattedMessage.EscapeText(message)));
|
||||||
|
|||||||
@@ -1014,6 +1014,12 @@ namespace Content.Shared.CCVar
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly CVarDef<bool> DeadLoocEnabled = CVarDef.Create("looc.enabled_dead", false, CVar.NOTIFY | CVar.REPLICATED);
|
public static readonly CVarDef<bool> DeadLoocEnabled = CVarDef.Create("looc.enabled_dead", false, CVar.NOTIFY | CVar.REPLICATED);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True: Crit players can use LOOC
|
||||||
|
/// False: Crit player LOOC gets redirected to dead chat
|
||||||
|
/// </summary>
|
||||||
|
public static readonly CVarDef<bool> CritLoocEnabled = CVarDef.Create("looc.enabled_crit", false, CVar.NOTIFY | CVar.REPLICATED);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Entity Menu Grouping Types
|
* Entity Menu Grouping Types
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ chat-manager-looc-chat-enabled-message = LOOC chat has been enabled.
|
|||||||
chat-manager-looc-chat-disabled-message = LOOC chat has been disabled.
|
chat-manager-looc-chat-disabled-message = LOOC chat has been disabled.
|
||||||
chat-manager-dead-looc-chat-enabled-message = Dead players can now use LOOC.
|
chat-manager-dead-looc-chat-enabled-message = Dead players can now use LOOC.
|
||||||
chat-manager-dead-looc-chat-disabled-message = Dead players can no longer use LOOC.
|
chat-manager-dead-looc-chat-disabled-message = Dead players can no longer use LOOC.
|
||||||
|
chat-manager-crit-looc-chat-enabled-message = Crit players can now use LOOC.
|
||||||
|
chat-manager-crit-looc-chat-disabled-message = Crit players can no longer use LOOC.
|
||||||
chat-manager-admin-ooc-chat-enabled-message = Admin OOC chat has been enabled.
|
chat-manager-admin-ooc-chat-enabled-message = Admin OOC chat has been enabled.
|
||||||
chat-manager-admin-ooc-chat-disabled-message = Admin OOC chat has been disabled.
|
chat-manager-admin-ooc-chat-disabled-message = Admin OOC chat has been disabled.
|
||||||
chat-manager-max-message-length-exceeded-message = Your message exceeded {$limit} character limit
|
chat-manager-max-message-length-exceeded-message = Your message exceeded {$limit} character limit
|
||||||
|
|||||||
Reference in New Issue
Block a user