Improves the HUD (#3655)
* All good except the combat doll * Makes the HUD inventory less terrible * Cleanup, nuke the Combat Mode button * Harm icon * Switch the icon * Basic goon hud * Toggleable * Nuke the popup, properly centers it * Fix clicking the button * Nuke some old code * missed a comment * Remove defaults * Localization * Nuke some old yaml * New sprites Co-authored-by: ike709 <sparebytes@protonmail.com>
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -58,7 +58,6 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
return;
|
||||
}
|
||||
|
||||
_gameHud.CombatModeActive = IsInCombatMode;
|
||||
_gameHud.TargetingZone = ActiveZone;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<CombatModeSystem>();
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<bool>? 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<bool>? OnCombatModeChanged { get; set; }
|
||||
Action<TargetingZone>? 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<bool>? OnCombatModeChanged { get; set; }
|
||||
public Action<TargetingZone>? 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<bool>? InventoryButtonToggled { get; set; }
|
||||
|
||||
public bool CraftingButtonDown
|
||||
{
|
||||
get => _buttonCraftingMenu.Pressed;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
28
Content.Server/Actions/CombatMode.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,9 @@ namespace Content.Shared.Actions
|
||||
public enum ActionType : byte
|
||||
{
|
||||
Error,
|
||||
HumanScream,
|
||||
CombatMode,
|
||||
Disarm,
|
||||
HumanScream,
|
||||
GhostBoo,
|
||||
DebugInstant,
|
||||
DebugToggle,
|
||||
|
||||
@@ -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";
|
||||
|
||||
5
Resources/Locale/en-US/ui/hud.ftl
Normal file
@@ -0,0 +1,5 @@
|
||||
### HUD stuff
|
||||
|
||||
## Combat mode
|
||||
hud-combat-enabled = Combat mode enabled!
|
||||
hud-combat-disabled = Combat mode disabled.
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
- type: Alerts
|
||||
- type: Actions
|
||||
innateActions:
|
||||
- HumanScream
|
||||
- CombatMode
|
||||
- Disarm
|
||||
- HumanScream
|
||||
- type: Eye
|
||||
zoom: 0.5, 0.5
|
||||
- type: CameraRecoil
|
||||
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 696 B |
BIN
Resources/Textures/Interface/Actions/harm.png
Normal file
|
After Width: | Height: | Size: 633 B |
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 706 B After Width: | Height: | Size: 425 B |
|
Before Width: | Height: | Size: 636 B After Width: | Height: | Size: 395 B |
BIN
Resources/Textures/Interface/Inventory/block.png
Normal file
|
After Width: | Height: | Size: 231 B |
|
Before Width: | Height: | Size: 633 B After Width: | Height: | Size: 419 B |
|
Before Width: | Height: | Size: 656 B After Width: | Height: | Size: 321 B |
|
Before Width: | Height: | Size: 849 B After Width: | Height: | Size: 441 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 368 B |
BIN
Resources/Textures/Interface/Inventory/hand_l_active.png
Normal file
|
After Width: | Height: | Size: 418 B |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 406 B |
BIN
Resources/Textures/Interface/Inventory/hand_r_active.png
Normal file
|
After Width: | Height: | Size: 474 B |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 887 B After Width: | Height: | Size: 355 B |
|
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 364 B |
BIN
Resources/Textures/Interface/Inventory/inventory.png
Normal file
|
After Width: | Height: | Size: 485 B |
|
Before Width: | Height: | Size: 722 B After Width: | Height: | Size: 399 B |
68
Resources/Textures/Interface/Inventory/meta.json
Normal file
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 846 B After Width: | Height: | Size: 426 B |
|
Before Width: | Height: | Size: 585 B After Width: | Height: | Size: 370 B |
BIN
Resources/Textures/Interface/Inventory/sheet.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 634 B After Width: | Height: | Size: 339 B |
|
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 375 B |
|
Before Width: | Height: | Size: 991 B After Width: | Height: | Size: 480 B |
|
Before Width: | Height: | Size: 728 B After Width: | Height: | Size: 374 B |
@@ -130,9 +130,6 @@ binds:
|
||||
type: State
|
||||
key: MouseRight
|
||||
canFocus: true
|
||||
- function: ToggleCombatMode
|
||||
type: State
|
||||
key: R
|
||||
- function: OpenCraftingMenu
|
||||
type: State
|
||||
key: G
|
||||
|
||||