diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs b/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs index cd5f49d430..e7336d73f3 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/HumanInventoryInterfaceController.cs @@ -27,11 +27,22 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory private ItemSlotButton _hudButtonPocket1 = default!; private ItemSlotButton _hudButtonPocket2 = default!; + private ItemSlotButton _hudButtonShoes = default!; + private ItemSlotButton _hudButtonJumpsuit = default!; + private ItemSlotButton _hudButtonGloves = default!; + private ItemSlotButton _hudButtonNeck = default!; + private ItemSlotButton _hudButtonHead = default!; private ItemSlotButton _hudButtonBelt = default!; private ItemSlotButton _hudButtonBack = default!; + private ItemSlotButton _hudButtonOClothing = default!; private ItemSlotButton _hudButtonId = default!; - private Control _rightQuickButtonsContainer = default!; - private Control _leftQuickButtonsContainer = default!; + private ItemSlotButton _hudButtonMask = default!; + private ItemSlotButton _hudButtonEyes = default!; + private ItemSlotButton _hudButtonEars = default!; + + private Control _topQuickButtonsContainer = default!; + private Control _bottomLeftQuickButtonsContainer = default!; + private Control _bottomRightQuickButtonsContainer = default!; public HumanInventoryInterfaceController(ClientInventoryComponent owner) : base(owner) { @@ -66,28 +77,55 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory AddButton(out _hudButtonPocket1, Slots.POCKET1, "pocket"); AddButton(out _hudButtonPocket2, Slots.POCKET2, "pocket"); - AddButton(out _hudButtonBack, Slots.BACKPACK, "back"); - AddButton(out _hudButtonBelt, Slots.BELT, "belt"); AddButton(out _hudButtonId, Slots.IDCARD, "id"); - _leftQuickButtonsContainer = new HBoxContainer + AddButton(out _hudButtonBack, Slots.BACKPACK, "back"); + + AddButton(out _hudButtonBelt, Slots.BELT, "belt"); + + AddButton(out _hudButtonShoes, Slots.SHOES, "shoes"); + AddButton(out _hudButtonJumpsuit, Slots.INNERCLOTHING, "uniform"); + AddButton(out _hudButtonOClothing, Slots.OUTERCLOTHING, "suit"); + AddButton(out _hudButtonGloves, Slots.GLOVES, "gloves"); + AddButton(out _hudButtonNeck, Slots.NECK, "neck"); + AddButton(out _hudButtonMask, Slots.MASK, "mask"); + AddButton(out _hudButtonEyes, Slots.EYES, "glasses"); + AddButton(out _hudButtonEars, Slots.EARS, "ears"); + AddButton(out _hudButtonHead, Slots.HEAD, "head"); + + _topQuickButtonsContainer = new HBoxContainer { Children = { - _hudButtonId, - _hudButtonBack, - _hudButtonBelt, + _hudButtonShoes, + _hudButtonJumpsuit, + _hudButtonOClothing, + _hudButtonGloves, + _hudButtonNeck, + _hudButtonMask, + _hudButtonEyes, + _hudButtonEars, + _hudButtonHead }, SeparationOverride = 5 }; - _rightQuickButtonsContainer = new HBoxContainer + + _bottomRightQuickButtonsContainer = new HBoxContainer { Children = { _hudButtonPocket1, _hudButtonPocket2, - // keeps this "balanced" with the left, so the hands will appear perfectly in the center - new Control{MinSize = (64, 64)} + _hudButtonId, + }, + SeparationOverride = 5 + }; + _bottomLeftQuickButtonsContainer = new HBoxContainer + { + Children = + { + _hudButtonBelt, + _hudButtonBack }, SeparationOverride = 5 }; @@ -172,8 +210,9 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory { base.PlayerAttached(); - GameHud.RightInventoryQuickButtonContainer.AddChild(_rightQuickButtonsContainer); - GameHud.LeftInventoryQuickButtonContainer.AddChild(_leftQuickButtonsContainer); + GameHud.BottomLeftInventoryQuickButtonContainer.AddChild(_bottomLeftQuickButtonsContainer); + GameHud.BottomRightInventoryQuickButtonContainer.AddChild(_bottomRightQuickButtonsContainer); + GameHud.TopInventoryQuickButtonContainer.AddChild(_topQuickButtonsContainer); // Update all the buttons to make sure they check out. @@ -195,8 +234,9 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory { base.PlayerDetached(); - GameHud.RightInventoryQuickButtonContainer.RemoveChild(_rightQuickButtonsContainer); - GameHud.LeftInventoryQuickButtonContainer.RemoveChild(_leftQuickButtonsContainer); + GameHud.BottomRightInventoryQuickButtonContainer.RemoveChild(_bottomRightQuickButtonsContainer); + GameHud.BottomLeftInventoryQuickButtonContainer.RemoveChild(_bottomLeftQuickButtonsContainer); + GameHud.TopInventoryQuickButtonContainer.RemoveChild(_topQuickButtonsContainer); foreach (var (slot, list) in _inventoryButtons) { diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/InventoryInterfaceController.cs b/Content.Client/GameObjects/Components/HUD/Inventory/InventoryInterfaceController.cs index 265f74547e..4f43b997bc 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/InventoryInterfaceController.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/InventoryInterfaceController.cs @@ -30,23 +30,11 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory public virtual void PlayerAttached() { GameHud.InventoryButtonVisible = true; - GameHud.InventoryButtonToggled = b => - { - if (b) - { - Window?.Open(); - } - else - { - Window?.Close(); - } - }; } public virtual void PlayerDetached() { GameHud.InventoryButtonVisible = false; - Window?.Close(); } public virtual void Dispose() diff --git a/Content.Client/GameObjects/Components/Mobs/CombatModeComponent.cs b/Content.Client/GameObjects/Components/Mobs/CombatModeComponent.cs index 0f055eb452..927c94594d 100644 --- a/Content.Client/GameObjects/Components/Mobs/CombatModeComponent.cs +++ b/Content.Client/GameObjects/Components/Mobs/CombatModeComponent.cs @@ -58,7 +58,6 @@ namespace Content.Client.GameObjects.Components.Mobs return; } - _gameHud.CombatModeActive = IsInCombatMode; _gameHud.TargetingZone = ActiveZone; } } diff --git a/Content.Client/GameObjects/EntitySystems/ClientInventorySystem.cs b/Content.Client/GameObjects/EntitySystems/ClientInventorySystem.cs index 47036a5ed0..d79d0f6d1f 100644 --- a/Content.Client/GameObjects/EntitySystems/ClientInventorySystem.cs +++ b/Content.Client/GameObjects/EntitySystems/ClientInventorySystem.cs @@ -34,45 +34,7 @@ namespace Content.Client.GameObjects.EntitySystems private void HandleOpenInventoryMenu() { - if (_playerManager.LocalPlayer?.ControlledEntity == null - || !_playerManager.LocalPlayer.ControlledEntity.TryGetComponent(out ClientInventoryComponent? clientInventory)) - { - return; - } - - var menu = clientInventory.InterfaceController.Window; - - if (menu == null) return; - - if (menu.IsOpen) - { - if (menu.IsAtFront()) - { - _setOpenValue(menu, false); - } - else - { - menu.MoveToFront(); - } - } - else - { - _setOpenValue(menu, true); - } - } - - private void _setOpenValue(SS14Window menu, bool value) - { - if (value) - { - _gameHud.InventoryButtonDown = true; - menu.OpenCentered(); - } - else - { - _gameHud.InventoryButtonDown = false; - menu.Close(); - } + _gameHud.InventoryButtonDown = !_gameHud.InventoryButtonDown; } } } diff --git a/Content.Client/GameObjects/EntitySystems/CombatModeSystem.cs b/Content.Client/GameObjects/EntitySystems/CombatModeSystem.cs index 0798517a82..fadc9b28ec 100644 --- a/Content.Client/GameObjects/EntitySystems/CombatModeSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/CombatModeSystem.cs @@ -25,13 +25,7 @@ namespace Content.Client.GameObjects.EntitySystems { base.Initialize(); - _gameHud.OnCombatModeChanged = OnCombatModeChanged; _gameHud.OnTargetingZoneChanged = OnTargetingZoneChanged; - - CommandBinds.Builder - .Bind(ContentKeyFunctions.ToggleCombatMode, - InputCmdHandler.FromDelegate(CombatModeToggled)) - .Register(); } public override void Shutdown() @@ -40,15 +34,6 @@ namespace Content.Client.GameObjects.EntitySystems base.Shutdown(); } - private void CombatModeToggled(ICommonSession? session) - { - if (_gameTiming.IsFirstTimePredicted) - { - EntityManager.RaisePredictiveEvent( - new CombatModeSystemMessages.SetCombatModeActiveMessage(!IsInCombatMode())); - } - } - public bool IsInCombatMode() { var entity = _playerManager.LocalPlayer?.ControlledEntity; @@ -64,10 +49,5 @@ namespace Content.Client.GameObjects.EntitySystems { EntityManager.RaisePredictiveEvent(new CombatModeSystemMessages.SetTargetZoneMessage(obj)); } - - private void OnCombatModeChanged(bool obj) - { - EntityManager.RaisePredictiveEvent(new CombatModeSystemMessages.SetCombatModeActiveMessage(obj)); - } } } diff --git a/Content.Client/Input/ContentContexts.cs b/Content.Client/Input/ContentContexts.cs index 3f0eb27416..b9dc944bb3 100644 --- a/Content.Client/Input/ContentContexts.cs +++ b/Content.Client/Input/ContentContexts.cs @@ -37,7 +37,6 @@ namespace Content.Client.Input human.AddFunction(ContentKeyFunctions.SmartEquipBackpack); human.AddFunction(ContentKeyFunctions.SmartEquipBelt); human.AddFunction(ContentKeyFunctions.MouseMiddle); - human.AddFunction(ContentKeyFunctions.ToggleCombatMode); human.AddFunction(ContentKeyFunctions.WideAttack); human.AddFunction(ContentKeyFunctions.ArcadeUp); human.AddFunction(ContentKeyFunctions.ArcadeDown); diff --git a/Content.Client/UserInterface/GameHud.cs b/Content.Client/UserInterface/GameHud.cs index 7857327b89..bba6f20f47 100644 --- a/Content.Client/UserInterface/GameHud.cs +++ b/Content.Client/UserInterface/GameHud.cs @@ -7,7 +7,6 @@ using Content.Shared.Input; using Robust.Client.Graphics; using Robust.Client.Input; using Robust.Client.ResourceManagement; -using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Shared.Input; using Robust.Shared.Input.Binding; @@ -40,7 +39,6 @@ namespace Content.Client.UserInterface // Inventory top button. bool InventoryButtonDown { get; set; } bool InventoryButtonVisible { get; set; } - Action? InventoryButtonToggled { get; set; } // Crafting top button. bool CraftingButtonDown { get; set; } @@ -64,13 +62,12 @@ namespace Content.Client.UserInterface Control HandsContainer { get; } Control SuspicionContainer { get; } - Control RightInventoryQuickButtonContainer { get; } - Control LeftInventoryQuickButtonContainer { get; } + Control BottomLeftInventoryQuickButtonContainer { get; } + Control BottomRightInventoryQuickButtonContainer { get; } + Control TopInventoryQuickButtonContainer { get; } bool CombatPanelVisible { get; set; } - bool CombatModeActive { get; set; } TargetingZone TargetingZone { get; set; } - Action? OnCombatModeChanged { get; set; } Action? OnTargetingZoneChanged { get; set; } Control VoteContainer { get; } @@ -94,7 +91,6 @@ namespace Content.Client.UserInterface private TopButton _buttonSandboxMenu = default!; private InfoWindow _infoWindow = default!; private TargetingDoll _targetingDoll = default!; - private Button _combatModeButton = default!; private VBoxContainer _combatPanelContainer = default!; private VBoxContainer _topNotificationContainer = default!; @@ -103,8 +99,9 @@ namespace Content.Client.UserInterface public Control HandsContainer { get; private set; } = default!; public Control SuspicionContainer { get; private set; } = default!; - public Control RightInventoryQuickButtonContainer { get; private set; } = default!; - public Control LeftInventoryQuickButtonContainer { get; private set; } = default!; + public Control TopInventoryQuickButtonContainer { get; private set; } = default!; + public Control BottomLeftInventoryQuickButtonContainer { get; private set; } = default!; + public Control BottomRightInventoryQuickButtonContainer { get; private set; } = default!; public bool CombatPanelVisible { @@ -112,19 +109,11 @@ namespace Content.Client.UserInterface set => _combatPanelContainer.Visible = value; } - public bool CombatModeActive - { - get => _combatModeButton.Pressed; - set => _combatModeButton.Pressed = value; - } - public TargetingZone TargetingZone { get => _targetingDoll.ActiveZone; set => _targetingDoll.ActiveZone = value; } - - public Action? OnCombatModeChanged { get; set; } public Action? OnTargetingZoneChanged { get; set; } public void AddTopNotification(TopNotification notification) @@ -196,7 +185,7 @@ namespace Content.Client.UserInterface _topButtonsContainer.AddChild(_buttonInventoryMenu); - _buttonInventoryMenu.OnToggled += args => InventoryButtonToggled?.Invoke(args.Pressed); + _buttonInventoryMenu.OnToggled += args => InventoryButtonDown = args.Pressed; // Crafting _buttonCraftingMenu = new TopButton(craftingTexture, ContentKeyFunctions.OpenCraftingMenu, _inputManager) @@ -272,13 +261,10 @@ namespace Content.Client.UserInterface _combatPanelContainer = new VBoxContainer { + HorizontalAlignment = Control.HAlignment.Left, + VerticalAlignment = Control.VAlignment.Bottom, Children = { - (_combatModeButton = new Button - { - Text = Loc.GetString("Combat Mode"), - ToggleMode = true - }), (_targetingDoll = new TargetingDoll(_resourceCache)) } }; @@ -287,14 +273,13 @@ namespace Content.Client.UserInterface LC.SetGrowVertical(_combatPanelContainer, LC.GrowDirection.Begin); LC.SetAnchorAndMarginPreset(_combatPanelContainer, LC.LayoutPreset.BottomRight); LC.SetMarginBottom(_combatPanelContainer, -10f); - RootControl.AddChild(_combatPanelContainer); - _combatModeButton.OnToggled += args => OnCombatModeChanged?.Invoke(args.Pressed); _targetingDoll.OnZoneChanged += args => OnTargetingZoneChanged?.Invoke(args); - var centerBottomContainer = new HBoxContainer + var centerBottomContainer = new VBoxContainer { - SeparationOverride = 5 + SeparationOverride = 5, + HorizontalAlignment = Control.HAlignment.Center }; LC.SetAnchorAndMarginPreset(centerBottomContainer, LC.LayoutPreset.CenterBottom); LC.SetGrowHorizontal(centerBottomContainer, LC.GrowDirection.Both); @@ -305,24 +290,57 @@ namespace Content.Client.UserInterface HandsContainer = new Control { VerticalAlignment = Control.VAlignment.Bottom, + HorizontalAlignment = Control.HAlignment.Center }; - RightInventoryQuickButtonContainer = new Control + BottomRightInventoryQuickButtonContainer = new HBoxContainer() { VerticalAlignment = Control.VAlignment.Bottom, + HorizontalAlignment = Control.HAlignment.Right }; - LeftInventoryQuickButtonContainer = new Control + BottomLeftInventoryQuickButtonContainer = new HBoxContainer() { VerticalAlignment = Control.VAlignment.Bottom, + HorizontalAlignment = Control.HAlignment.Left }; - centerBottomContainer.AddChild(LeftInventoryQuickButtonContainer); - centerBottomContainer.AddChild(HandsContainer); - centerBottomContainer.AddChild(RightInventoryQuickButtonContainer); + TopInventoryQuickButtonContainer = new HBoxContainer() + { + Visible = false, + VerticalAlignment = Control.VAlignment.Bottom, + HorizontalAlignment = Control.HAlignment.Center + }; + var bottomRow = new HBoxContainer() + { + HorizontalAlignment = Control.HAlignment.Center + + }; + bottomRow.AddChild(new Control {MinSize = (69, 0)}); //Padding (nice) + bottomRow.AddChild(BottomLeftInventoryQuickButtonContainer); + bottomRow.AddChild(HandsContainer); + bottomRow.AddChild(BottomRightInventoryQuickButtonContainer); + bottomRow.AddChild(new Control {MinSize = (1, 0)}); //Padding + + + centerBottomContainer.AddChild(TopInventoryQuickButtonContainer); + centerBottomContainer.AddChild(bottomRow); SuspicionContainer = new Control { HorizontalAlignment = Control.HAlignment.Center }; + var rightBottomContainer = new HBoxContainer + { + SeparationOverride = 5 + }; + LC.SetAnchorAndMarginPreset(rightBottomContainer, LC.LayoutPreset.BottomRight); + LC.SetGrowHorizontal(rightBottomContainer, LC.GrowDirection.Begin); + LC.SetGrowVertical(rightBottomContainer, LC.GrowDirection.Begin); + LC.SetMarginBottom(rightBottomContainer, -10f); + LC.SetMarginRight(rightBottomContainer, -10f); + RootControl.AddChild(rightBottomContainer); + + rightBottomContainer.AddChild(_combatPanelContainer); + RootControl.AddChild(SuspicionContainer); LC.SetAnchorAndMarginPreset(SuspicionContainer, LC.LayoutPreset.BottomLeft, @@ -398,7 +416,11 @@ namespace Content.Client.UserInterface public bool InventoryButtonDown { get => _buttonInventoryMenu.Pressed; - set => _buttonInventoryMenu.Pressed = value; + set + { + TopInventoryQuickButtonContainer.Visible = value; + _buttonInventoryMenu.Pressed = value; + } } public bool InventoryButtonVisible @@ -407,8 +429,6 @@ namespace Content.Client.UserInterface set => _buttonInventoryMenu.Visible = value; } - public Action? InventoryButtonToggled { get; set; } - public bool CraftingButtonDown { get => _buttonCraftingMenu.Pressed; diff --git a/Content.Client/UserInterface/HandsGui.cs b/Content.Client/UserInterface/HandsGui.cs index b90ff28dfa..8d35536137 100644 --- a/Content.Client/UserInterface/HandsGui.cs +++ b/Content.Client/UserInterface/HandsGui.cs @@ -26,16 +26,12 @@ namespace Content.Client.UserInterface private readonly Texture _middleHandTexture; private readonly Texture _rightHandTexture; - private readonly ItemStatusPanel _leftPanel; private readonly ItemStatusPanel _topPanel; - private readonly ItemStatusPanel _rightPanel; private readonly HBoxContainer _guiContainer; private readonly VBoxContainer _handsColumn; private readonly HBoxContainer _handsContainer; - private int _lastHands; - public HandsGui() { IoCManager.InjectDependencies(this); @@ -43,18 +39,17 @@ namespace Content.Client.UserInterface AddChild(_guiContainer = new HBoxContainer { SeparationOverride = 0, + HorizontalAlignment = HAlignment.Center, Children = { - (_rightPanel = ItemStatusPanel.FromSide(HandLocation.Right)), (_handsColumn = new VBoxContainer { Children = { (_topPanel = ItemStatusPanel.FromSide(HandLocation.Middle)), - (_handsContainer = new HBoxContainer()) + (_handsContainer = new HBoxContainer{HorizontalAlignment = HAlignment.Center}) } }), - (_leftPanel = ItemStatusPanel.FromSide(HandLocation.Left)) } }); _leftHandTexture = _resourceCache.GetTexture("/Textures/Interface/Inventory/hand_l.png"); @@ -62,17 +57,6 @@ namespace Content.Client.UserInterface _rightHandTexture = _resourceCache.GetTexture("/Textures/Interface/Inventory/hand_r.png"); } - private ItemStatusPanel GetItemPanel(Hand hand) - { - return hand.Location switch - { - HandLocation.Left => _rightPanel, - HandLocation.Middle => _topPanel, - HandLocation.Right => _leftPanel, - _ => throw new IndexOutOfRangeException() - }; - } - private Texture HandTexture(HandLocation location) { switch (location) @@ -167,8 +151,6 @@ namespace Content.Client.UserInterface hand.Button!.SetActiveHand(component.ActiveIndex == hand.Name); } - _leftPanel.SetPositionFirst(); - _rightPanel.SetPositionLast(); } private void HandKeyBindDown(GUIBoundKeyEventArgs args, string slotName) @@ -240,90 +222,7 @@ namespace Content.Client.UserInterface _itemSlotManager.UpdateCooldown(hand.Button, hand.Entity); } - switch (component.Hands.Count) - { - case var n when n == 0 && _lastHands != 0: - _guiContainer.Visible = false; - - _topPanel.Update(null); - _leftPanel.Update(null); - _rightPanel.Update(null); - - break; - case 1: - if (_lastHands != 1) - { - _guiContainer.Visible = true; - - _topPanel.Update(null); - _topPanel.Visible = false; - - _leftPanel.Update(null); - _leftPanel.Visible = false; - - _rightPanel.Visible = true; - - if (!_guiContainer.Children.Contains(_rightPanel)) - { - _rightPanel.AddChild(_rightPanel); - _rightPanel.SetPositionFirst(); - } - } - - _rightPanel.Update(component.Hands[0].Entity); - - break; - case 2: - if (_lastHands != 2) - { - _guiContainer.Visible = true; - _topPanel.Update(null); - _topPanel.Visible = false; - - _leftPanel.Visible = true; - _rightPanel.Visible = true; - - if (_handsColumn.Children.Contains(_topPanel)) - { - _handsColumn.RemoveChild(_topPanel); - } - } - - _leftPanel.Update(component.Hands[0].Entity); - _rightPanel.Update(component.Hands[1].Entity); - - // Order is left, right - foreach (var hand in component.Hands) - { - var tooltip = GetItemPanel(hand); - tooltip.Update(hand.Entity); - } - - break; - case var n when n > 2: - if (_lastHands <= 2) - { - _guiContainer.Visible = true; - - _topPanel.Visible = true; - _leftPanel.Visible = false; - _rightPanel.Visible = false; - - if (!_handsColumn.Children.Contains(_topPanel)) - { - _handsColumn.AddChild(_topPanel); - _topPanel.SetPositionFirst(); - } - } - - _topPanel.Update(component.ActiveHand); - _leftPanel.Update(null); - _rightPanel.Update(null); - - break; - } - - _lastHands = component.Hands.Count; + _topPanel.Update(component.GetEntity(component.ActiveIndex)); } protected override void FrameUpdate(FrameEventArgs args) diff --git a/Content.Client/UserInterface/OptionsMenu.KeyRebind.cs b/Content.Client/UserInterface/OptionsMenu.KeyRebind.cs index 5bd58a2f32..8cb3e82e9b 100644 --- a/Content.Client/UserInterface/OptionsMenu.KeyRebind.cs +++ b/Content.Client/UserInterface/OptionsMenu.KeyRebind.cs @@ -129,7 +129,6 @@ namespace Content.Client.UserInterface AddButton(ContentKeyFunctions.Drop); AddButton(ContentKeyFunctions.ExamineEntity); AddButton(ContentKeyFunctions.SwapHands); - AddButton(ContentKeyFunctions.ToggleCombatMode); AddHeader("ui-options-header-interaction-adv"); AddButton(ContentKeyFunctions.SmartEquipBackpack); diff --git a/Content.Server/Actions/CombatMode.cs b/Content.Server/Actions/CombatMode.cs new file mode 100644 index 0000000000..4c3d5fca24 --- /dev/null +++ b/Content.Server/Actions/CombatMode.cs @@ -0,0 +1,28 @@ +#nullable enable +using Content.Server.GameObjects.Components.Mobs; +using Content.Shared.Actions; +using Content.Shared.Interfaces; +using JetBrains.Annotations; +using Robust.Shared.Localization; +using Robust.Shared.Serialization.Manager.Attributes; + +namespace Content.Server.Actions +{ + [UsedImplicitly] + [DataDefinition] + public class CombatMode : IToggleAction + { + public bool DoToggleAction(ToggleActionEventArgs args) + { + if (!args.Performer.TryGetComponent(out CombatModeComponent? combatMode)) + { + return false; + } + + args.Performer.PopupMessage(args.ToggledOn ? Loc.GetString("hud-combat-enabled") : Loc.GetString("hud-combat-disabled")); + combatMode.IsInCombatMode = args.ToggledOn; + + return true; + } + } +} diff --git a/Content.Shared/Actions/ActionType.cs b/Content.Shared/Actions/ActionType.cs index 78fb858c8d..dec3ae5494 100644 --- a/Content.Shared/Actions/ActionType.cs +++ b/Content.Shared/Actions/ActionType.cs @@ -7,8 +7,9 @@ namespace Content.Shared.Actions public enum ActionType : byte { Error, - HumanScream, + CombatMode, Disarm, + HumanScream, GhostBoo, DebugInstant, DebugToggle, diff --git a/Content.Shared/Input/ContentKeyFunctions.cs b/Content.Shared/Input/ContentKeyFunctions.cs index c5ab6bd091..73dbd1356e 100644 --- a/Content.Shared/Input/ContentKeyFunctions.cs +++ b/Content.Shared/Input/ContentKeyFunctions.cs @@ -26,7 +26,6 @@ namespace Content.Shared.Input public static readonly BoundKeyFunction TryPullObject = "TryPullObject"; public static readonly BoundKeyFunction MovePulledObject = "MovePulledObject"; public static readonly BoundKeyFunction ReleasePulledObject = "ReleasePulledObject"; - public static readonly BoundKeyFunction ToggleCombatMode = "ToggleCombatMode"; public static readonly BoundKeyFunction MouseMiddle = "MouseMiddle"; public static readonly BoundKeyFunction OpenEntitySpawnWindow = "OpenEntitySpawnWindow"; public static readonly BoundKeyFunction OpenSandboxWindow = "OpenSandboxWindow"; diff --git a/Resources/Locale/en-US/ui/hud.ftl b/Resources/Locale/en-US/ui/hud.ftl new file mode 100644 index 0000000000..bfacb5623d --- /dev/null +++ b/Resources/Locale/en-US/ui/hud.ftl @@ -0,0 +1,5 @@ +### HUD stuff + +## Combat mode +hud-combat-enabled = Combat mode enabled! +hud-combat-disabled = Combat mode disabled. diff --git a/Resources/Locale/en-US/ui/options.ftl b/Resources/Locale/en-US/ui/options.ftl index c2490c0320..f997e9e431 100644 --- a/Resources/Locale/en-US/ui/options.ftl +++ b/Resources/Locale/en-US/ui/options.ftl @@ -63,7 +63,6 @@ ui-options-function-activate-item-in-world = Activate item in world ui-options-function-drop = Drop item ui-options-function-examine-entity = Examine ui-options-function-swap-hands = Swap hands -ui-options-function-toggle-combat-mode = Toggle combat mode ui-options-function-smart-equip-backpack = Smart-equip to backpack ui-options-function-smart-equip-belt = Smart-equip to belt diff --git a/Resources/Prototypes/Actions/actions.yml b/Resources/Prototypes/Actions/actions.yml index 09ad922719..1442f13b9a 100644 --- a/Resources/Prototypes/Actions/actions.yml +++ b/Resources/Prototypes/Actions/actions.yml @@ -1,4 +1,25 @@ - type: action + actionType: CombatMode + icon: Interface/Actions/harm.png + name: "[color=red]Combat Mode[/color]" + description: "Enter combat mode." + filters: + - human + behaviorType: Toggle + behavior: !type:CombatMode + +- type: action + actionType: Disarm + icon: Interface/Actions/disarm.png + name: "[color=red]Disarm[/color]" + description: "Attempt to [color=red]disarm[/color] someone." + filters: + - human + behaviorType: TargetEntity + repeat: true + behavior: !type:DisarmAction { } + +- type: action actionType: HumanScream icon: Interface/Actions/scream.png name: "Scream" @@ -22,17 +43,6 @@ - /Audio/Voice/Human/femalescream_5.ogg wilhelm: /Audio/Voice/Human/wilhelm_scream.ogg -- type: action - actionType: Disarm - icon: Interface/Actions/disarm.png - name: "[color=red]Disarm[/color]" - description: "Attempt to [color=red]disarm[/color] someone." - filters: - - human - behaviorType: TargetEntity - repeat: true - behavior: !type:DisarmAction { } - - type: action actionType: GhostBoo icon: Interface/Actions/scream.png diff --git a/Resources/Prototypes/Entities/Mobs/Player/human.yml b/Resources/Prototypes/Entities/Mobs/Player/human.yml index 1911dae349..7755236fb0 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/human.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/human.yml @@ -14,8 +14,9 @@ - type: Alerts - type: Actions innateActions: - - HumanScream + - CombatMode - Disarm + - HumanScream - type: Eye zoom: 0.5, 0.5 - type: CameraRecoil diff --git a/Resources/Textures/Interface/Actions/disarm.png b/Resources/Textures/Interface/Actions/disarm.png index f1efa1df68..ddedb404ee 100644 Binary files a/Resources/Textures/Interface/Actions/disarm.png and b/Resources/Textures/Interface/Actions/disarm.png differ diff --git a/Resources/Textures/Interface/Actions/harm.png b/Resources/Textures/Interface/Actions/harm.png new file mode 100644 index 0000000000..cde8a0387c Binary files /dev/null and b/Resources/Textures/Interface/Actions/harm.png differ diff --git a/Resources/Textures/Interface/Actions/meta.json b/Resources/Textures/Interface/Actions/meta.json index 33e10333b1..ad41346ff5 100644 --- a/Resources/Textures/Interface/Actions/meta.json +++ b/Resources/Textures/Interface/Actions/meta.json @@ -5,7 +5,7 @@ "y": 32 }, "license": "CC-BY-SA-3.0", - "copyright": "Taken from https://github.com/tgstation/tgstation/commit/3d049e69fe71a0be2133005e65ea469135d648c8", + "copyright": "Taken from https://github.com/tgstation/tgstation/commit/3d049e69fe71a0be2133005e65ea469135d648c8. Harm and disarm heavily modified.", "states": [ { "name": "internal0" @@ -18,6 +18,9 @@ }, { "name": "disarm" - } + }, + { + "name": "harm" + } ] } diff --git a/Resources/Textures/Interface/Inventory/back.png b/Resources/Textures/Interface/Inventory/back.png index 07893ac3b3..dc94d77990 100644 Binary files a/Resources/Textures/Interface/Inventory/back.png and b/Resources/Textures/Interface/Inventory/back.png differ diff --git a/Resources/Textures/Interface/Inventory/belt.png b/Resources/Textures/Interface/Inventory/belt.png index 43b7816b64..7998bc964e 100644 Binary files a/Resources/Textures/Interface/Inventory/belt.png and b/Resources/Textures/Interface/Inventory/belt.png differ diff --git a/Resources/Textures/Interface/Inventory/block.png b/Resources/Textures/Interface/Inventory/block.png new file mode 100644 index 0000000000..e5d65d49c4 Binary files /dev/null and b/Resources/Textures/Interface/Inventory/block.png differ diff --git a/Resources/Textures/Interface/Inventory/ears.png b/Resources/Textures/Interface/Inventory/ears.png index f00067d06b..c202346aeb 100644 Binary files a/Resources/Textures/Interface/Inventory/ears.png and b/Resources/Textures/Interface/Inventory/ears.png differ diff --git a/Resources/Textures/Interface/Inventory/glasses.png b/Resources/Textures/Interface/Inventory/glasses.png index 936e57e454..30540d14f7 100644 Binary files a/Resources/Textures/Interface/Inventory/glasses.png and b/Resources/Textures/Interface/Inventory/glasses.png differ diff --git a/Resources/Textures/Interface/Inventory/gloves.png b/Resources/Textures/Interface/Inventory/gloves.png index c25c9db374..6878ddab40 100644 Binary files a/Resources/Textures/Interface/Inventory/gloves.png and b/Resources/Textures/Interface/Inventory/gloves.png differ diff --git a/Resources/Textures/Interface/Inventory/hand_l.png b/Resources/Textures/Interface/Inventory/hand_l.png index c760ae8ee8..3ee9d5702e 100644 Binary files a/Resources/Textures/Interface/Inventory/hand_l.png and b/Resources/Textures/Interface/Inventory/hand_l.png differ diff --git a/Resources/Textures/Interface/Inventory/hand_l_active.png b/Resources/Textures/Interface/Inventory/hand_l_active.png new file mode 100644 index 0000000000..b0f9131c05 Binary files /dev/null and b/Resources/Textures/Interface/Inventory/hand_l_active.png differ diff --git a/Resources/Textures/Interface/Inventory/hand_l_no_letter.png b/Resources/Textures/Interface/Inventory/hand_l_no_letter.png deleted file mode 100644 index fbf564c9d9..0000000000 Binary files a/Resources/Textures/Interface/Inventory/hand_l_no_letter.png and /dev/null differ diff --git a/Resources/Textures/Interface/Inventory/hand_middle.png b/Resources/Textures/Interface/Inventory/hand_middle.png deleted file mode 100644 index 41284017af..0000000000 Binary files a/Resources/Textures/Interface/Inventory/hand_middle.png and /dev/null differ diff --git a/Resources/Textures/Interface/Inventory/hand_r.png b/Resources/Textures/Interface/Inventory/hand_r.png index b338544131..9f2c68aba2 100644 Binary files a/Resources/Textures/Interface/Inventory/hand_r.png and b/Resources/Textures/Interface/Inventory/hand_r.png differ diff --git a/Resources/Textures/Interface/Inventory/hand_r_active.png b/Resources/Textures/Interface/Inventory/hand_r_active.png new file mode 100644 index 0000000000..fb9eeff5c5 Binary files /dev/null and b/Resources/Textures/Interface/Inventory/hand_r_active.png differ diff --git a/Resources/Textures/Interface/Inventory/hand_r_no_letter.png b/Resources/Textures/Interface/Inventory/hand_r_no_letter.png deleted file mode 100644 index 82412561fb..0000000000 Binary files a/Resources/Textures/Interface/Inventory/hand_r_no_letter.png and /dev/null differ diff --git a/Resources/Textures/Interface/Inventory/head.png b/Resources/Textures/Interface/Inventory/head.png index 21c70bbe38..f087c05b3c 100644 Binary files a/Resources/Textures/Interface/Inventory/head.png and b/Resources/Textures/Interface/Inventory/head.png differ diff --git a/Resources/Textures/Interface/Inventory/id.png b/Resources/Textures/Interface/Inventory/id.png index fef736e5ca..1c57380cae 100644 Binary files a/Resources/Textures/Interface/Inventory/id.png and b/Resources/Textures/Interface/Inventory/id.png differ diff --git a/Resources/Textures/Interface/Inventory/inventory.png b/Resources/Textures/Interface/Inventory/inventory.png new file mode 100644 index 0000000000..2bad7533ff Binary files /dev/null and b/Resources/Textures/Interface/Inventory/inventory.png differ diff --git a/Resources/Textures/Interface/Inventory/mask.png b/Resources/Textures/Interface/Inventory/mask.png index d061aea399..f72070151e 100644 Binary files a/Resources/Textures/Interface/Inventory/mask.png and b/Resources/Textures/Interface/Inventory/mask.png differ diff --git a/Resources/Textures/Interface/Inventory/meta.json b/Resources/Textures/Interface/Inventory/meta.json new file mode 100644 index 0000000000..5cc398dd92 --- /dev/null +++ b/Resources/Textures/Interface/Inventory/meta.json @@ -0,0 +1,68 @@ +{ + "version": 1, + "size": { + "x": 32, + "y": 32 + }, + "license": "CC-BY-NC-SA-3.0", + "copyright": "Heavily derived from https://github.com/goonstation/goonstation at commit e77d85d9c1d93aa32da7702737ceeac2b56738ac.", + "states": [ + { + "name": "back", + }, + { + "name": "belt" + }, + { + "name": "block" + }, + { + "name": "ears" + }, + { + "name": "glasses" + }, + { + "name": "gloves" + }, + { + "name": "hand_l" + }, + { + "name": "hand_l_active" + }, + { + "name": "hand_r" + }, + { + "name": "hand_r_active" + }, + { + "name": "head" + }, + { + "name": "id" + }, + { + "name": "invtoggle" + }, + { + "name": "mask" + }, + { + "name": "neck" + }, + { + "name": "pocket" + }, + { + "name": "shoes" + }, + { + "name": "suit" + }, + { + "name": "uniform" + } + ] +} diff --git a/Resources/Textures/Interface/Inventory/neck.png b/Resources/Textures/Interface/Inventory/neck.png index d744499516..0ab974bec7 100644 Binary files a/Resources/Textures/Interface/Inventory/neck.png and b/Resources/Textures/Interface/Inventory/neck.png differ diff --git a/Resources/Textures/Interface/Inventory/pocket.png b/Resources/Textures/Interface/Inventory/pocket.png index dd81f0e144..3dc3e95e6a 100644 Binary files a/Resources/Textures/Interface/Inventory/pocket.png and b/Resources/Textures/Interface/Inventory/pocket.png differ diff --git a/Resources/Textures/Interface/Inventory/sheet.png b/Resources/Textures/Interface/Inventory/sheet.png new file mode 100644 index 0000000000..34ac8861c3 Binary files /dev/null and b/Resources/Textures/Interface/Inventory/sheet.png differ diff --git a/Resources/Textures/Interface/Inventory/shoes.png b/Resources/Textures/Interface/Inventory/shoes.png index f0cda35fe7..421580f1c9 100644 Binary files a/Resources/Textures/Interface/Inventory/shoes.png and b/Resources/Textures/Interface/Inventory/shoes.png differ diff --git a/Resources/Textures/Interface/Inventory/suit.png b/Resources/Textures/Interface/Inventory/suit.png index df79bc33dd..44a5c95e55 100644 Binary files a/Resources/Textures/Interface/Inventory/suit.png and b/Resources/Textures/Interface/Inventory/suit.png differ diff --git a/Resources/Textures/Interface/Inventory/suit_storage.png b/Resources/Textures/Interface/Inventory/suit_storage.png index 6ffa007a54..206b034443 100644 Binary files a/Resources/Textures/Interface/Inventory/suit_storage.png and b/Resources/Textures/Interface/Inventory/suit_storage.png differ diff --git a/Resources/Textures/Interface/Inventory/uniform.png b/Resources/Textures/Interface/Inventory/uniform.png index bb7e4ec18a..d98ef541ab 100644 Binary files a/Resources/Textures/Interface/Inventory/uniform.png and b/Resources/Textures/Interface/Inventory/uniform.png differ diff --git a/Resources/keybinds.yml b/Resources/keybinds.yml index e58876b05f..962c2eb931 100644 --- a/Resources/keybinds.yml +++ b/Resources/keybinds.yml @@ -130,9 +130,6 @@ binds: type: State key: MouseRight canFocus: true -- function: ToggleCombatMode - type: State - key: R - function: OpenCraftingMenu type: State key: G