summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--asciifarmclient/connection.py4
-rw-r--r--asciifarmclient/gameclient.py2
-rw-r--r--asciifarmclient/inputhandler.py2
-rw-r--r--asciifarmclient/parseargs.py10
-rw-r--r--keybindings/default.json2
6 files changed, 14 insertions, 8 deletions
diff --git a/README.md b/README.md
index 4516f54..8c9dff2 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ Players can fight enemies and plant crops to gather resources.
_a better installation with pip will be added in the future_
-The asciifarm client requires [ratuil](https://github.com/jmdejong/ratuil) to run.
+The asciifarm client requires [ratuil](https://github.com/jmdejong/ratuil) version 0.3.0 (at least) to run.
To install ratuil run:
python3 -m pip install --user ratuil
diff --git a/asciifarmclient/connection.py b/asciifarmclient/connection.py
index 707a02e..e4f5c17 100644
--- a/asciifarmclient/connection.py
+++ b/asciifarmclient/connection.py
@@ -10,8 +10,10 @@ class Connection:
def __init__(self, socketType):
if socketType == "abstract" or socketType == "unix":
sockType = socket.AF_UNIX
- elif socketType == "inet":
+ elif socketType == "inet" or socketType == "inet4":
sockType = socket.AF_INET
+ elif socketType == "inet6":
+ sockType = socket.AF_INET6
else:
raise ValueError("Invalid socket type: %r" % (socketType,))
self.sock = socket.socket(sockType, socket.SOCK_STREAM)
diff --git a/asciifarmclient/gameclient.py b/asciifarmclient/gameclient.py
index 9d7bca6..92be2d4 100644
--- a/asciifarmclient/gameclient.py
+++ b/asciifarmclient/gameclient.py
@@ -60,7 +60,7 @@ class Client:
def getInput(self):
while True:
- key = ratuil.inputs.get_key()
+ key = self.display.screen.get_key()
self.queue.put(("input", key))
def close(self, msg=None):
diff --git a/asciifarmclient/inputhandler.py b/asciifarmclient/inputhandler.py
index 0dd356f..781f292 100644
--- a/asciifarmclient/inputhandler.py
+++ b/asciifarmclient/inputhandler.py
@@ -84,7 +84,7 @@ class InputHandler:
self.cursor = 0
self.typing = False
self.processString(message)
- elif key == "^I": # tab
+ elif key == inp.TAB:
# return to game but keep entered string
self.typing = False
elif key.isprintable() and len(key) == 1:
diff --git a/asciifarmclient/parseargs.py b/asciifarmclient/parseargs.py
index 47fcfeb..00789d5 100644
--- a/asciifarmclient/parseargs.py
+++ b/asciifarmclient/parseargs.py
@@ -14,6 +14,8 @@ defaultAdresses = {
"abstract": "rustifarm",
"unix": "asciifarm.socket",
"inet": "localhost:9021",
+ "inet4": "localhost:9021",
+ "inet6": "localhost:9021"
}
def parse_args(argv):
@@ -26,7 +28,7 @@ def parse_args(argv):
~troido""", formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('-n', '--name', help='Your player name (must be unique!). Defaults to username on inet sockets and tildename on unix socket (including abstract). Apart from the tilde in a tildename all characters must be unicode letters, numbers or connection puctuation. The maximum size of a name is 256 bytes when encoded as utf8', default=None)
parser.add_argument("-a", "--address", help="The address of the socket. When the socket type is 'abstract' this is just a name. When it is 'unix' this is a filename. When it is 'inet' is should be in the format 'address:port', eg 'localhost:8080'. Defaults depends on the socket type")
- parser.add_argument("-s", "--socket", help="the socket type. 'unix' is unix domain sockets, 'abstract' is abstract unix domain sockets and 'inet' is inet sockets. ", choices=["abstract", "unix", "inet"], default=("abstract" if sys.platform == "linux" else "inet"))
+ parser.add_argument("-s", "--socket", help="the socket type. 'unix' is unix domain sockets, 'abstract' is abstract unix domain sockets and 'inet' is inet sockets. ", choices=["abstract", "unix", "inet", "inet4", "inet6"], default=("abstract" if sys.platform == "linux" else "inet"))
parser.add_argument('-k', '--keybindings', help='The file with the keybinding configuration. This file is a JSON file.', default="default")
parser.add_argument('-c', '--characters', help='The file with the character mappings for the graphics. If it is either of these names: {} it will be loaded from the charmaps directory.'.format(list(loaders.standardCharFiles.keys())), default="default")
parser.add_argument('-o', '--logfile', help='All game messages will be written to this file.', default=None)
@@ -49,9 +51,11 @@ def parse_args(argv):
address = defaultAdresses[args.socket]
if args.socket == "abstract":
address = '\0' + address
- elif args.socket == "inet":
- hostname, sep, port = address.rpartition(':')
+ elif args.socket == "inet" or args.socket == "inet6" or args.socket == "inet4":
+ hostname, _sep, port = address.rpartition(':')
address = (hostname, int(port))
+
+
colours = True
if args.colours:
diff --git a/keybindings/default.json b/keybindings/default.json
index e3a1f53..17e6a21 100644
--- a/keybindings/default.json
+++ b/keybindings/default.json
@@ -32,7 +32,7 @@
"D": ["input", ["attack", ["east"]]],
"A": ["input", ["attack", ["west"]]],
"t": ["runinput"],
-"enter": ["runinput"],
+"\n": ["runinput"],
"pageup": ["scrollchat", 1],
"pagedown": ["scrollchat", -1],
"/": ["runinput", "/"]