Ignore:
Timestamp:
12/13/09 16:23:00 (10 years ago)
Author:
eliedebrauwer
Message:

Ticket #186: Patch by eliedebrauwer. Added possibility to pause/unpause the game. Pausing can be triggered now by pressing the pause button (hey it's there for a reason, let's use it). I also added a pause command in the console and updated the help strings to reflect this. Btw, this makes use of the get|setTimeMultiplier calls which FIFE map objects offers, these can also be used to speed up/slow down the game. fixes[s:trac, t:186]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/scripts/console.py

    r416 r446  
    2424        @param appListener: ApplicationListener object providing a link with 
    2525        the engine, the world and the model""" 
    26         exit_help = "Terminate application" 
    27         grid_help = "Toggle grid display" 
    28         run_help = "Toggle player run/walk" 
    29         help_help = "Show this help string" 
    30         load_help = "load directory file" 
     26        exit_help   = "Terminate application" 
     27        grid_help   = "Toggle grid display" 
     28        run_help    = "Toggle player run/walk" 
     29        help_help   = "Show this help string" 
     30        load_help   = "Usage: load directory file" 
    3131        python_help = "Run some python code" 
    32         quit_help = "Terminate application" 
    33         save_help = "save directory file" 
     32        quit_help   = "Terminate application" 
     33        save_help   = "Usage: save directory file" 
     34        pause_help  = "Pause/Unpause the game" 
    3435 
    3536        self.commands = [ 
    3637            {"cmd":"exit"  ,"callback":self.handleQuit  ,"help": exit_help}, 
    3738            {"cmd":"grid"  ,"callback":self.handleGrid  ,"help": grid_help}, 
    38             {"cmd":"run"   ,"callback":self.handleRun   ,"help": run_help}, 
    3939            {"cmd":"help"  ,"callback":self.handleHelp  ,"help": help_help}, 
    4040            {"cmd":"load"  ,"callback":self.handleLoad  ,"help": load_help}, 
     41            {"cmd":"pause" ,"callback":self.handlePause ,"help": pause_help}, 
    4142            {"cmd":"python","callback":self.handlePython,"help": python_help}, 
     43            {"cmd":"run"   ,"callback":self.handleRun   ,"help": run_help}, 
     44            {"cmd":"save"  ,"callback":self.handleSave  ,"help": save_help}, 
    4245            {"cmd":"quit"  ,"callback":self.handleQuit  ,"help": quit_help}, 
    43             {"cmd":"save"  ,"callback":self.handleSave  ,"help": save_help}, 
    4446        ] 
    4547        self.app_listener = app_listener 
     
    5860        return "Terminating ..." 
    5961 
     62    def handlePause(self, command): 
     63        """ 
     64        Implements the pause console command 
     65        @type command: string 
     66        @param command: The command to run 
     67        @return: The resultstring""" 
     68         
     69        self.world.togglePause() 
     70        return "Game (un)paused" 
     71     
    6072    def handleGrid(self, command): 
    6173        """  
Note: See TracChangeset for help on using the changeset viewer.