Skip to content

Commit

Permalink
added Hotkeys
Browse files Browse the repository at this point in the history
  • Loading branch information
NotLe0n committed Jul 5, 2021
1 parent ad58951 commit af1708d
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/BetterChests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public class BetterChests : Mod
public override void Load()
{
instance = this;
// Hotkeys
Hotkeys.DepositAll = RegisterHotKey("Deposit All", "");
Hotkeys.LootAll = RegisterHotKey("Loot All", "");
Hotkeys.QuickStack = RegisterHotKey("Quick Stack", "");
Hotkeys.SortChest = RegisterHotKey("Sort Chest", "");
Hotkeys.SortInventory = RegisterHotKey("Sort Inventory", "");

if (!Main.dedServ)
{
Expand All @@ -42,6 +48,13 @@ public override void Unload()
ChestHoverUserInterface = null;
ChestHoverUI.chest = null;

// Hotkeys
Hotkeys.DepositAll = null;
Hotkeys.LootAll = null;
Hotkeys.QuickStack = null;
Hotkeys.SortChest = null;
Hotkeys.SortInventory = null;

base.Unload();
}

Expand Down
42 changes: 42 additions & 0 deletions src/Hotkeys.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Terraria.UI;
using Terraria.GameInput;
using Terraria.ModLoader;

namespace BetterChests.src
{
class Hotkeys : ModPlayer
{
public static ModHotKey DepositAll, LootAll, QuickStack, SortChest, SortInventory;

public override void ProcessTriggers(TriggersSet triggersSet)
{
base.ProcessTriggers(triggersSet);

if (DepositAll.JustPressed)
{
ChestUI.DepositAll();
}
if (LootAll.JustPressed)
{
ChestUI.LootAll();
}
if (QuickStack.JustPressed)
{
player.QuickStackAllChests();
ChestUI.QuickStack();
}
if (SortChest.JustPressed)
{
ItemSorting.SortChest();
}
if (SortInventory.JustPressed)
{
ItemSorting.SortInventory();
}
}
}
}

0 comments on commit af1708d

Please sign in to comment.