summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2019-10-11 18:12:30 +0200
committertroido <troido@protonmail.com>2019-10-11 18:12:30 +0200
commit5231db6eed301ce86cd5026d1eeb32b4156835c3 (patch)
treee6d5f66c2523a9e3fecebf2349925c65dc818d94
parent4291b62cd7c2dd58932c4bb3efde293dbd7fe309 (diff)
controls are now separate objects
-rw-r--r--asciifarm/client/commandhandler.py13
-rw-r--r--asciifarm/client/gameclient.py2
-rw-r--r--asciifarm/keybindings/azerty.json6
-rw-r--r--asciifarm/keybindings/default.json18
4 files changed, 17 insertions, 22 deletions
diff --git a/asciifarm/client/commandhandler.py b/asciifarm/client/commandhandler.py
index 0c3027f..1677d7b 100644
--- a/asciifarm/client/commandhandler.py
+++ b/asciifarm/client/commandhandler.py
@@ -29,7 +29,7 @@ class CommandHandler:
"selectitem": self.selectItem,
"inputwithselected": self.actWithSelected,
"use": self.useSelected,
- "unuse": self.unUseSelected,
+ "drop": self.dropSelected,
"take": self.takeSelected,
"eval": self.eval,
"exec": self.exec,
@@ -103,20 +103,15 @@ class CommandHandler:
menu = self.client.display.getSelectedMenu()
selected = self.client.display.getSelectedItem(menu)
if menu in ("inventory", "equipment"):
- action = "use"
+ self.input(["use", menu, selected])
elif menu == "ground":
- action = "interact",
- else:
- return
- self.input([action, selected])
+ self.input(["interact", selected])
- def unUseSelected(self):
+ def dropSelected(self):
menu = self.client.display.getSelectedMenu()
selected = self.client.display.getSelectedItem(menu)
if menu == "inventory":
action = "drop"
- elif menu == "equipment":
- action = "unequip"
else:
return
self.input([action, selected])
diff --git a/asciifarm/client/gameclient.py b/asciifarm/client/gameclient.py
index facb54e..4013505 100644
--- a/asciifarm/client/gameclient.py
+++ b/asciifarm/client/gameclient.py
@@ -88,7 +88,7 @@ class Client:
if error == "invalidname":
self.close("Invalid name error: "+ str(message.description))
return
- self.log(message.errtype + ": " + message.description)
+ self.log(message.errType + ": " + message.description)
elif isinstance(message, messages.MessageMessage):
self.log(message.text, message.type)
elif isinstance(message, messages.WorldMessage):
diff --git a/asciifarm/keybindings/azerty.json b/asciifarm/keybindings/azerty.json
index ee04ec5..fe27280 100644
--- a/asciifarm/keybindings/azerty.json
+++ b/asciifarm/keybindings/azerty.json
@@ -7,8 +7,8 @@
"q": ["move", "west"],
"a": ["unuse"],
"A": ["take"],
- "Z": ["input", ["attack", "north"]],
- "Q": ["input", ["attack", "west"]]
+ "Z": ["input", ["attack", ["north"]]],
+ "Q": ["input", ["attack", ["west"]]]
},
- "help": "Controls:\n aqsd or arrows:\n Move around\n e: Grab\n q: Drop/unequip\n selected\n r: Interact\n f: Attack\n t: Chat\n E: Use selected\n A: Take selected\n xc: select item\n vb: select menu\n ctrl-c: close client"
+ "help": "Controls:\n aqsd or arrows: Move around\n e: Grab\n q: Drop selected\n r: Interact\n f: Attack\n t: Chat\n E: Use selected\n A: Take selected\n xc: select item\n vb: select menu\n ctrl-c: close client"
}
diff --git a/asciifarm/keybindings/default.json b/asciifarm/keybindings/default.json
index 3fe413f..faf1b40 100644
--- a/asciifarm/keybindings/default.json
+++ b/asciifarm/keybindings/default.json
@@ -12,11 +12,11 @@
"j": ["move", "south"],
"l": ["move", "east"],
"h": ["move", "west"],
-"e": ["input", ["take"]],
-"q": ["unuse"],
+"e": ["input", ["take", null]],
+"q": ["drop"],
"Q": ["take"],
"E": ["use"],
-"R": ["input", ["interact"]],
+"R": ["input", ["interact", [null]]],
"r": ["input", ["interact", [null, "north", "south", "east", "west"]]],
"x": ["selectitem", -1, true, true],
"c": ["selectitem", 1, true, true],
@@ -27,16 +27,16 @@
"/": ["selectwidget", -1, true, true],
"*": ["selectwidget", 1, true, true],
"f": ["input", ["attack", [null, "north", "south", "east", "west"]]],
-"F": ["input", ["attack"]],
-"W": ["input", ["attack", "north"]],
-"S": ["input", ["attack", "south"]],
-"D": ["input", ["attack", "east"]],
-"A": ["input", ["attack", "west"]],
+"F": ["input", ["attack", [null]]],
+"W": ["input", ["attack", ["north"]]],
+"S": ["input", ["attack", ["south"]]],
+"D": ["input", ["attack", ["east"]]],
+"A": ["input", ["attack", ["west"]]],
"t": ["runinput"],
"enter": ["runinput"],
"pageup": ["scrollchat", 1],
"pagedown": ["scrollchat", -1],
"/": ["runinput", "/"]
},
-"help": " Controls:\nwasd or arrows: Move around\ne: Grab\nq: Drop/unequip selected\nr: Interact\nf: Attack\nt: Chat\nE: Use selected\nxc: select item\nvb: select menu\nctrl-c: close client\nPgUp/PgDn: scroll chat"
+"help": " Controls:\nwasd or arrows: Move around\ne: Grab\nq: Drop selected\nr: Interact\nf: Attack\nt: Chat\nE: Use selected\nxc: select item\nvb: select menu\nctrl-c: close client\nPgUp/PgDn: scroll chat"
}