From d75fa20337da86493726dfa53540dcefb5bdbdd4 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 16 Jun 2020 12:22:09 -0400 Subject: [PATCH] v0.8.1: added a keybind for resting --- .../main/assets/messages/windows/windows.properties | 1 + .../shatteredpixeldungeon/SPDAction.java | 2 ++ .../shatteredpixeldungeon/ui/Toolbar.java | 13 +++++++++++++ 3 files changed, 16 insertions(+) diff --git a/core/src/main/assets/messages/windows/windows.properties b/core/src/main/assets/messages/windows/windows.properties index c659ccae1..51cc4888e 100644 --- a/core/src/main/assets/messages/windows/windows.properties +++ b/core/src/main/assets/messages/windows/windows.properties @@ -72,6 +72,7 @@ windows.wndkeybindings.hero_info=Hero Info windows.wndkeybindings.journal=Journal windows.wndkeybindings.wait=Wait windows.wndkeybindings.search=Search +windows.wndkeybindings.rest=Rest windows.wndkeybindings.inventory=Inventory windows.wndkeybindings.quickslot_1=Quickslot 1 windows.wndkeybindings.quickslot_2=Quickslot 2 diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDAction.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDAction.java index 190355f36..f418834cc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDAction.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDAction.java @@ -46,6 +46,7 @@ public class SPDAction extends GameAction { public static final GameAction WAIT = new SPDAction("wait"); public static final GameAction SEARCH = new SPDAction("search"); + public static final GameAction REST = new SPDAction("rest"); public static final GameAction INVENTORY = new SPDAction("inventory"); public static final GameAction QUICKSLOT_1 = new SPDAction("quickslot_1"); @@ -81,6 +82,7 @@ public class SPDAction extends GameAction { defaultBindings.put( Input.Keys.SPACE, SPDAction.WAIT ); defaultBindings.put( Input.Keys.S, SPDAction.SEARCH ); + defaultBindings.put( Input.Keys.Z, SPDAction.REST ); defaultBindings.put( Input.Keys.I, SPDAction.INVENTORY ); defaultBindings.put( Input.Keys.Q, SPDAction.QUICKSLOT_1 ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java index 1216985f2..fcf7aebac 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java @@ -99,6 +99,19 @@ public class Toolbar extends Component { return true; } }); + + add(new Button(){ + @Override + protected void onClick() { + examining = false; + Dungeon.hero.rest(true); + } + + @Override + public GameAction keyAction() { + return SPDAction.REST; + } + }); add(btnSearch = new Tool(44, 0, 20, 26) { @Override