Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public static void SetupContexts(IInputContextContainer contexts)
human.AddFunction(ContentKeyFunctions.SmartEquipBackpack);
human.AddFunction(ContentKeyFunctions.SmartEquipBelt);
human.AddFunction(ContentKeyFunctions.SmartEquipWallet); // Frontier
human.AddFunction(ContentKeyFunctions.SmartEquipSuitStorage); // Hardlight
human.AddFunction(ContentKeyFunctions.OpenBackpack);
human.AddFunction(ContentKeyFunctions.OpenBelt);
human.AddFunction(ContentKeyFunctions.ToggleStanding); // EE
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ void AddCheckBox(string checkBoxName, bool currentState, Action<BaseButton.Butto
AddButton(ContentKeyFunctions.SmartEquipBackpack);
AddButton(ContentKeyFunctions.SmartEquipBelt);
AddButton(ContentKeyFunctions.SmartEquipWallet); // Frontier
AddButton(ContentKeyFunctions.SmartEquipSuitStorage); // Hardlight
AddButton(ContentKeyFunctions.OpenBackpack);
AddButton(ContentKeyFunctions.OpenBelt);
AddButton(ContentKeyFunctions.OpenWallet); // Frontier
Expand Down
1 change: 1 addition & 0 deletions Content.Shared/Input/ContentKeyFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static class ContentKeyFunctions
public static readonly BoundKeyFunction SmartEquipBackpack = "SmartEquipBackpack";
public static readonly BoundKeyFunction SmartEquipBelt = "SmartEquipBelt";
public static readonly BoundKeyFunction SmartEquipWallet = "SmartEquipWallet"; // Frontier
public static readonly BoundKeyFunction SmartEquipSuitStorage = "SmartEquipSuitStorage"; // Hardlight
public static readonly BoundKeyFunction OpenBackpack = "OpenBackpack";
public static readonly BoundKeyFunction OpenBelt = "OpenBelt";
public static readonly BoundKeyFunction OpenWallet = "OpenWallet"; // Frontier
Expand Down
66 changes: 66 additions & 0 deletions Content.Shared/Interaction/SmartEquipSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public override void Initialize()
.Bind(ContentKeyFunctions.SmartEquipBackpack, InputCmdHandler.FromDelegate(HandleSmartEquipBackpack, handle: false, outsidePrediction: false))
.Bind(ContentKeyFunctions.SmartEquipBelt, InputCmdHandler.FromDelegate(HandleSmartEquipBelt, handle: false, outsidePrediction: false))
.Bind(ContentKeyFunctions.SmartEquipWallet, InputCmdHandler.FromDelegate(HandleSmartEquipWallet, handle: false, outsidePrediction: false)) // Frontier
.Bind(ContentKeyFunctions.SmartEquipSuitStorage, InputCmdHandler.FromDelegate(HandleSmartEquipSuitStorage, handle: false, outsidePrediction: false)) // Hardlight
.Register<SmartEquipSystem>();
}

Expand All @@ -61,6 +62,71 @@ private void HandleSmartEquipWallet(ICommonSession? session)
HandleSmartEquip(session, "wallet");
}
// End Frontier: smart-equip to wallet

// Hardlight: smart-equip to suit storage
// Uses direct equip/unequip only — skipping storage and item-slot cases so guns don't eject their magazine.
private void HandleSmartEquipSuitStorage(ICommonSession? session)
{
if (session is not { } playerSession)
return;

if (playerSession.AttachedEntity is not { Valid: true } uid || !Exists(uid))
return;

if (!TryComp<HandsComponent>(uid, out var hands) || hands.ActiveHand == null)
return;

var handItem = hands.ActiveHand.HeldEntity;

if (!_actionBlocker.CanInteract(uid, handItem))
return;

if (!TryComp<InventoryComponent>(uid, out var inventory) || !_inventory.HasSlot(uid, "suitstorage", inventory))
{
_popup.PopupClient(Loc.GetString("smart-equip-missing-equipment-slot", ("slotName", "suitstorage")), uid, uid);
return;
}

if (handItem != null && !_hands.CanDropHeld(uid, hands.ActiveHand))
{
_popup.PopupClient(Loc.GetString("smart-equip-cant-drop"), uid, uid);
return;
}

_inventory.TryGetSlotEntity(uid, "suitstorage", out var slotEntity);

if (slotEntity is not { } slotItem)
{
if (handItem == null)
{
_popup.PopupClient(Loc.GetString("smart-equip-empty-equipment-slot", ("slotName", "suitstorage")), uid, uid);
return;
}

if (!_inventory.CanEquip(uid, handItem.Value, "suitstorage", out var reason))
{
_popup.PopupClient(Loc.GetString(reason), uid, uid);
return;
}

_hands.TryDrop(uid, hands.ActiveHand, handsComp: hands);
_inventory.TryEquip(uid, handItem.Value, "suitstorage", predicted: true, checkDoafter: true);
return;
}

if (handItem != null)
return;

if (!_inventory.CanUnequip(uid, "suitstorage", out var inventoryReason))
{
_popup.PopupClient(Loc.GetString(inventoryReason), uid, uid);
return;
}

_inventory.TryUnequip(uid, "suitstorage", inventory: inventory, predicted: true, checkDoafter: true);
_hands.TryPickup(uid, slotItem, handsComp: hands);
}
// End Hardlight: smart-equip to suit storage
private void HandleSmartEquip(ICommonSession? session, string equipmentSlot)
{
if (session is not { } playerSession)
Expand Down
4 changes: 4 additions & 0 deletions Resources/keybinds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@ binds:
type: State
key: B
mod1: Shift
- function: SmartEquipSuitStorage
type: State
key: F
mod1: Shift
- function: SmartEquipBelt
type: State
key: E
Expand Down
Loading