diff options
| author | troido <troido@protonmail.com> | 2021-01-23 16:07:08 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2021-01-23 16:07:08 +0100 |
| commit | 3420305361c550cd1d57b277184d73d8b80cd76a (patch) | |
| tree | 79e9a08d786f9b906343cb7599ebe701426fc67e /asciifarmclient | |
| parent | 6c897d8e4123899a3f9878a658fc1e9f8f7bfa51 (diff) | |
upgraded ratuil; fix special keyboard keys in curses client
Diffstat (limited to 'asciifarmclient')
| -rw-r--r-- | asciifarmclient/connection.py | 4 | ||||
| -rw-r--r-- | asciifarmclient/gameclient.py | 2 | ||||
| -rw-r--r-- | asciifarmclient/inputhandler.py | 2 | ||||
| -rw-r--r-- | asciifarmclient/parseargs.py | 10 |
4 files changed, 12 insertions, 6 deletions
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: |
