Files
wwdpublic/Content.Client/UserInterface/Systems/Actions/Widgets/ActionsBar.xaml.cs
DEATHB4DEFEAT 6040482afd Revert Bad "SS13" Action Bar (#1333)
# Description

https://github.com/Simple-Station/Parkstation-Friendly-Chainsaw/issues/2
https://github.com/space-wizards/space-station-14/pull/21352

---

<details><summary><h1>Media</h1></summary>
<p>

<!--
https://github.com/user-attachments/assets/701512ce-1bf2-4020-a2eb-ba1e35b18669
-->

https://github.com/user-attachments/assets/d01f01b9-dae7-4d05-91db-ac6e3de30e9f

</p>
</details>

---

# Changelog

🆑
- tweak: Added back support for the action bar to have "loadouts" or
quick layouts of actions (man, how many things are called loadouts?)

(cherry picked from commit 6cd17d7957b34cc45bf1bf0f9d338b5bfd87297d)
2025-01-13 22:36:14 +03:00

35 lines
1.0 KiB
C#

using Content.Client.UserInterface.Systems.Actions.Controls;
using Content.Shared.Input;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
namespace Content.Client.UserInterface.Systems.Actions.Widgets;
[GenerateTypedNameReferences]
public sealed partial class ActionsBar : UIWidget
{
[Dependency] private readonly IEntityManager _entity = default!;
public ActionsBar()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
var keys = ContentKeyFunctions.GetHotbarBoundKeys();
for (var index = 1; index < keys.Length; index++)
ActionsContainer.Children.Add(MakeButton(index));
ActionsContainer.Children.Add(MakeButton(0));
ActionButton MakeButton(int index)
{
var boundKey = keys[index];
var button = new ActionButton(_entity);
button.KeyBind = boundKey;
button.Label.Text = index.ToString();
return button;
}
}
}