X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/balance?a=blobdiff_plain;f=plomrogue%2Fcommands.py;h=fc087fbe7434a4cc6966b773f123da07425909d4;hb=e91c0688ee0d273d7f106e837e1ad52009d79350;hp=6532b72bbe027ebb65d0805025140a49da8145d4;hpb=9316d59ddce7a7b8ee70d2b4e111330f1a691e37;p=plomrogue2 diff --git a/plomrogue/commands.py b/plomrogue/commands.py index 6532b72..fc087fb 100644 --- a/plomrogue/commands.py +++ b/plomrogue/commands.py @@ -44,7 +44,7 @@ def cmd_ALL(game, msg, connection_id): if not speaker: raise GameError('need to be logged in for this') largest_audible_distance = 20 - dijkstra_map = DijkstraMap(game.maps, speaker.position, + dijkstra_map = DijkstraMap(game.things, game.maps, speaker.position, largest_audible_distance, game.get_map) for c_id in game.sessions: listener = game.get_player(c_id) @@ -79,7 +79,7 @@ def cmd_LOGIN(game, nick, connection_id): t = game.thing_types['Player'](game) t.position = game.spawn_point game.things += [t] # TODO refactor into Thing.__init__? - t.player_char = game.get_next_player_char() + t.thing_char = game.get_next_player_char() game.sessions[connection_id] = { 'thing_id': t.id_, 'status': 'player' @@ -310,3 +310,14 @@ def cmd_GOD_THING_PROTECTION(game, thing_id, protection_char): raise GameError('thing of ID %s not found' % thing_id) t.protection = protection_char cmd_GOD_THING_PROTECTION.argtypes = 'int:pos char' + +def cmd_THING_DOOR_CLOSED(game, thing_id): + t = game.get_thing(thing_id) + if not t: + raise GameError('thing of ID %s not found' % thing_id) + if not t.type_ == 'Door': + raise GameError('thing of ID %s not door' % thing_id) + t.blocking = True + t.portable = False + t.thing_char = '#' +cmd_THING_DOOR_CLOSED.argtypes = 'int:pos'