X-Git-Url: https://plomlompom.com/repos/?p=plomrogue2-experiments;a=blobdiff_plain;f=new2%2Fplomrogue%2Fio.py;h=9f34b180f851793b04ce02e32c52b46ea9c68481;hp=2283a986d10717511778b1d79aa5dca4b4919557;hb=f7f11798a90187ab83d038f737368317a99e15b0;hpb=beebfdb7dac8e7630643c44e9ae8d3c79d5d39d8 diff --git a/new2/plomrogue/io.py b/new2/plomrogue/io.py index 2283a98..9f34b18 100644 --- a/new2/plomrogue/io.py +++ b/new2/plomrogue/io.py @@ -45,8 +45,13 @@ class GameIO(): print('Killing server') self.server.server_close() - def handle_input(self, input_, connection_id=None): - """Process input_ to command grammar, call command handler if found.""" + def handle_input(self, input_, connection_id=None, god_mode=False): + """Process input_ to command grammar, call command handler if found. + + Command handlers that have no connectin_i argument in their + signature will only be called if god_mode is set. + + """ from inspect import signature from plomrogue.errors import GameError, ArgError from plomrogue.misc import quote @@ -64,7 +69,7 @@ class GameIO(): else: if 'connection_id' in list(signature(command).parameters): command(*args, connection_id=connection_id) - else: + elif god_mode: command(*args) #if store and not hasattr(command, 'dont_save'): # with open(self.game_file_name, 'a') as f: