diff --git a/Content.Client/CombatMode/CombatModeSystem.cs b/Content.Client/CombatMode/CombatModeSystem.cs index 2c938b1b93..1aa817dd78 100644 --- a/Content.Client/CombatMode/CombatModeSystem.cs +++ b/Content.Client/CombatMode/CombatModeSystem.cs @@ -6,6 +6,12 @@ using Robust.Client.Input; using Robust.Client.Player; using Robust.Shared.Configuration; +using Robust.Client.GameObjects; +using Content.Shared.StatusIcon.Components; +using Content.Client.Actions; +using System.Numerics; +using Robust.Shared.GameObjects; +using Robust.Shared.Utility; namespace Content.Client.CombatMode; @@ -21,14 +27,17 @@ public sealed class CombatModeSystem : SharedCombatModeSystem /// Raised whenever combat mode changes. /// public event Action? LocalPlayerCombatModeUpdated; + private EntityQuery _spriteQuery; // Everwood public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnHandleState); - + SubscribeLocalEvent(UpdateCombatModeIndicator); // Everwood EDIT Subs.CVar(_cfg, CCVars.CombatModeIndicatorsPointShow, OnShowCombatIndicatorsChanged, true); + + _spriteQuery = GetEntityQuery(); // Everwood } private void OnHandleState(EntityUid uid, CombatModeComponent component, ref AfterAutoHandleStateEvent args) @@ -91,4 +100,27 @@ private void OnShowCombatIndicatorsChanged(bool isShow) _overlayManager.RemoveOverlay(); } } + + // Everwood START + private void UpdateCombatModeIndicator(EntityUid uid, CombatModeComponent comp, ref GetStatusIconsEvent _) + { + if (!_spriteQuery.TryComp(uid, out var sprite)) + return; + + if (comp.IsInCombatMode) + { + if (!sprite.LayerMapTryGet("combat_mode_indicator", out var layer)) + { + layer = sprite.AddLayer(new SpriteSpecifier.Rsi(new ResPath("_Everwood/Effects/combat_mode.rsi"), "combat_mode")); + sprite.LayerMapSet("combat_mode_indicator", layer); + } + } + else + { + if (sprite.LayerMapTryGet("combat_mode_indicator", out var layerToRemove)) + { + sprite.RemoveLayer(layerToRemove); + } + } + } // Everwood END } diff --git a/Content.Shared/CombatMode/SharedCombatModeSystem.cs b/Content.Shared/CombatMode/SharedCombatModeSystem.cs index 60d1362bb0..870e5a03fa 100644 --- a/Content.Shared/CombatMode/SharedCombatModeSystem.cs +++ b/Content.Shared/CombatMode/SharedCombatModeSystem.cs @@ -1,7 +1,11 @@ using Content.Shared.Actions; +using Content.Shared.CombatMode; // Everwood using Content.Shared.MouseRotator; using Content.Shared.Movement.Components; using Content.Shared.Popups; +using Robust.Shared.Audio; // Everwood +using Robust.Shared.Audio.Systems; // Everwood +using Robust.Shared.GameObjects; // Everwood using Robust.Shared.Network; using Robust.Shared.Timing; @@ -13,6 +17,7 @@ public abstract class SharedCombatModeSystem : EntitySystem [Dependency] private readonly INetManager _netMan = default!; [Dependency] private readonly SharedActionsSystem _actionsSystem = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; // Everwood public override void Initialize() { @@ -50,9 +55,13 @@ private void OnActionPerform(EntityUid uid, CombatModeComponent component, Toggl if (!_netMan.IsClient || !Timing.IsFirstTimePredicted) return; - var msg = component.IsInCombatMode ? "action-popup-combat-enabled" : "action-popup-combat-disabled"; - _popup.PopupEntity(Loc.GetString(msg), args.Performer, args.Performer); + // Everwood START + _audio.PlayPvs(component.IsInCombatMode ? "/Audio/_Everwood/Effects/CombatMode/on.ogg" : "/Audio/_Ataraxia/Effects/CombatMode/off.ogg", uid); + +// var msg = component.IsInCombatMode ? "action-popup-combat-enabled" : "action-popup-combat-disabled"; +// _popup.PopupEntity(Loc.GetString(msg), args.Performer, args.Performer); } + // Everwood END public void SetCanDisarm(EntityUid entity, bool canDisarm, CombatModeComponent? component = null) { diff --git a/Resources/Audio/_Everwood/Effects/CombatMode/attributions.yml b/Resources/Audio/_Everwood/Effects/CombatMode/attributions.yml new file mode 100644 index 0000000000..de3ab606bb --- /dev/null +++ b/Resources/Audio/_Everwood/Effects/CombatMode/attributions.yml @@ -0,0 +1,4 @@ +- files: ["on.ogg", "off.ogg"] + license: "CC-BY-NC-SA-3.0" + copyright: 'Taken from /tg/station at commit 87c4c6ae94acd6ac8000bc0c2f43fc2cfc928224 and https://github.com/BlueMoon-Labs/MOLOT-BlueMoon-Station/blob/master/sound/machines/chime.ogg. Converted to mono by PuroSlavKing' + source: "https://github.com/tgstation/tgstation/blob/87c4c6ae94acd6ac8000bc0c2f43fc2cfc928224" diff --git a/Resources/Audio/_Everwood/Effects/CombatMode/off.ogg b/Resources/Audio/_Everwood/Effects/CombatMode/off.ogg new file mode 100644 index 0000000000..98df1726e9 Binary files /dev/null and b/Resources/Audio/_Everwood/Effects/CombatMode/off.ogg differ diff --git a/Resources/Audio/_Everwood/Effects/CombatMode/on.ogg b/Resources/Audio/_Everwood/Effects/CombatMode/on.ogg new file mode 100644 index 0000000000..20548c73cd Binary files /dev/null and b/Resources/Audio/_Everwood/Effects/CombatMode/on.ogg differ diff --git a/Resources/Textures/_Everwood/Effects/combat_mode.rsi/combat_mode.png b/Resources/Textures/_Everwood/Effects/combat_mode.rsi/combat_mode.png new file mode 100644 index 0000000000..40c2444eb5 Binary files /dev/null and b/Resources/Textures/_Everwood/Effects/combat_mode.rsi/combat_mode.png differ diff --git a/Resources/Textures/_Everwood/Effects/combat_mode.rsi/meta.json b/Resources/Textures/_Everwood/Effects/combat_mode.rsi/meta.json new file mode 100644 index 0000000000..7264508ae9 --- /dev/null +++ b/Resources/Textures/_Everwood/Effects/combat_mode.rsi/meta.json @@ -0,0 +1,30 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Taken from https://github.com/BlueMoon-Labs/MOLOT-BlueMoon-Station/blob/master/modular_sand/icons/mob/combat_indicator.dmi | Edited by PuroSlavKing (Github)", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "combat_mode", + "delays": [ + [ + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1 + ] + ] + } + ] +}