+
+def cmd_MAP_CONTROL_LINE(game, big_yx, y, line):
+ map_control = game.get_map(big_yx, 'control')
+ map_control.set_line(y, line)
+cmd_MAP_CONTROL_LINE.argtypes = 'yx_tuple int:nonneg string'
+
+def cmd_MAP_CONTROL_PW(game, tile_class, password):
+ game.map_control_passwords[tile_class] = password
+cmd_MAP_CONTROL_PW.argtypes = 'char string'
+
+def cmd_THING(game, big_yx, little_yx, thing_type, thing_id):
+ if thing_type not in game.thing_types:
+ raise GameError('illegal thing type %s' % thing_type)
+ _ = game.get_map(big_yx)
+ t_old = None
+ if thing_id > 0:
+ t_old = game.get_thing(thing_id)
+ t_new = game.thing_types[thing_type](game, id_=thing_id, position=(big_yx,
+ little_yx))
+ if t_old:
+ game.things[game.things.index(t_old)] = t_new
+ else:
+ game.things += [t_new]
+ game.changed = True
+cmd_THING.argtypes = 'yx_tuple yx_tuple:nonneg string:thing_type int:nonneg'
+
+def cmd_THING_NAME(game, thing_id, name, pw, connection_id):
+ # TODO check if thing in FOV
+ t = game.get_thing(thing_id)
+ if not t:
+ raise GameError('thing of ID %s not found' % thing_id)
+ if not game.can_do_thing_with_pw(t, pw):
+ raise GameError('wrong password for tile')
+ t.name = name
+ game.changed = True
+cmd_THING_NAME.argtypes = 'int:pos string string'
+
+def cmd_GOD_THING_NAME(game, thing_id, name):
+ t = game.get_thing(thing_id)
+ if not t:
+ raise GameError('thing of ID %s not found' % thing_id)
+ t.name = name
+cmd_GOD_THING_NAME.argtypes = 'int:pos string'
+
+def cmd_GOD_THING_PROTECTION(game, thing_id, protection_char):
+ t = game.get_thing(thing_id)
+ if not t:
+ 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'