From aa5b7c9d753f6f140d7f55d0089e6e19028031b7 Mon Sep 17 00:00:00 2001 From: troido Date: Sat, 14 Apr 2018 18:13:19 +0200 Subject: Stopped using hy for keybindings keybindings are now a JSON format. Somehow hy errored for me, and the cleanest solution seemed not to use hy at all Thinking about it, the client was basically loading a new interpreter to optimize something that didn't need optimizing. It didn't make it more readable/writable either, and it always was a lot of hassle. --- asciifarm/keybindings/keybindings.hy | 57 ---------------------------------- asciifarm/keybindings/keybindings.json | 46 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 57 deletions(-) delete mode 100644 asciifarm/keybindings/keybindings.hy create mode 100644 asciifarm/keybindings/keybindings.json (limited to 'asciifarm/keybindings') diff --git a/asciifarm/keybindings/keybindings.hy b/asciifarm/keybindings/keybindings.hy deleted file mode 100644 index 2919d1d..0000000 --- a/asciifarm/keybindings/keybindings.hy +++ /dev/null @@ -1,57 +0,0 @@ -{ -w (inp ["move" "north"]) -s (inp ["move" "south"]) -d (inp ["move" "east"]) -a (inp ["move" "west"]) -KEY_UP (inp ["move" "north"]) -KEY_DOWN (inp ["move" "south"]) -KEY_RIGHT (inp ["move" "east"]) -KEY_LEFT (inp ["move" "west"]) -k (inp ["move" "north"]) -j (inp ["move" "south"]) -l (inp ["move" "east"]) -h (inp ["move" "west"]) -e (inp ["take" (.getSelected (self.display.getWidget "ground"))]) -q (inp ["drop" (.getSelected (self.display.getWidget "inventory"))]) -E (inp ["use" (.getSelected (self.display.getWidget "inventory"))]) -R (inp ["interact"]) -r (do [ - (inp ["interact"]) - (inp ["interact" "north"]) - (inp ["interact" "south"]) - (inp ["interact" "east"]) - (inp ["interact" "west"])]) -c (.select (self.display.getWidget "inventory") 1 True True) -x (.select (self.display.getWidget "ground") 1 True True) -v (.select (self.display.getWidget "equipment") 1 True True) -z (inp ["unequip" (.getSelected (self.display.getWidget "equipment"))]) -f (do [ - (inp ["attack"]) - (inp ["attack" "north"]) - (inp ["attack" "south"]) - (inp ["attack" "east"]) - (inp ["attack" "west"])]) -F (inp ["attack"]) -W (inp ["attack" "north"]) -S (inp ["attack" "south"]) -D (inp ["attack" "east"]) -A (inp ["attack" "west"]) -t (self.parseMessage (self.display.getString)) -NEWLINE (self.parseMessage (self.display.getString)) -KEY_PPAGE (self.display.scrollBack 1) -KEY_NPAGE (self.display.scrollBack -1) -help "\ -Controls: - wasd or arrows: - Move around - e: Grab - q: Drop - E: Use/Equip - r: Interact - f: Attack - t: Chat - z: Unequip - xcv: scroll - ctrl-c: close client" -;; init ((. (self.display.getWidget "inventory") setTitle) "Inventory (c)") -} diff --git a/asciifarm/keybindings/keybindings.json b/asciifarm/keybindings/keybindings.json new file mode 100644 index 0000000..20759bd --- /dev/null +++ b/asciifarm/keybindings/keybindings.json @@ -0,0 +1,46 @@ +{ +"actions": { +"w": ["move", "north"], +"s": ["move", "south"], +"d": ["move", "east"], +"a": ["move", "west"], +"KEY_UP": ["move", "north"], +"KEY_DOWN": ["move", "south"], +"KEY_RIGHT": ["move", "east"], +"KEY_LEFT": ["move", "west"], +"k": ["move", "north"], +"j": ["move", "south"], +"l": ["move", "east"], +"h": ["move", "west"], +"e": ["inputwithselected", "take", "ground"], +"q": ["inputwithselected", "drop", "inventory"], +"E": ["inputwithselected", "use", "inventory"], +"z": ["inputwithselected", "unequip", "equipment"], +"R": ["input", ["interact"]], +"r": ["do", [ + ["input", ["interact"]], + ["input", ["interact", "north"]], + ["input", ["interact", "south"]], + ["input", ["interact", "east"]], + ["input", ["interact", "west"]]]], +"c": ["select", "inventory", 1, true, true], +"x": ["select", "ground", 1, true, true], +"v": ["select", "equipment", 1, true, true], +"f": ["do", [ + ["input", ["attack"]], + ["input", ["attack", "north"]], + ["input", ["attack", "south"]], + ["input", ["attack", "east"]], + ["input", ["attack", "west"]]]], +"F": ["input", ["attack"]], +"W": ["input", ["attack", "north"]], +"S": ["input", ["attack", "south"]], +"D": ["input", ["attack", "east"]], +"A": ["input", ["attack", "west"]], +"t": ["runinput"], +"NEWLINE": ["runinput"], +"KEY_PPAGE": "(self.display.scrollBack 1]", +"KEY_NPAGE": "(self.display.scrollBack -1]" +}, +"help": "Controls:\n wasd or arrows:\n Move around\n e: Grab\n q: Drop\n E: Use/Equip\n r: Interact\n f: Attack\n t: Chat\n z: Unequip\n xcv: scroll\n ctrl-c: close client" +} -- cgit