Ignore:
Timestamp:
10/01/09 07:13:39 (10 years ago)
Author:
eliedebrauwer
Message:

Ticket #103: Patch by Elie De Brauwer, Added possibility to make the player character run, this can be toggled with the run console command, comment[s:trac, t:103]

File:
1 edited

Legend:

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

    r281 r295  
    2525 
    2626        self.commands = [ 
    27             {"cmd":"exit"  ,"callback":self.handleQuit  ,"help":"Terminate application"}, 
    28             {"cmd":"grid"  ,"callback":self.handleGrid  ,"help":"Toggle grid display  "}, 
    29             {"cmd":"help"  ,"callback":self.handleHelp  ,"help":"Show this help string"}, 
    30             {"cmd":"load"  ,"callback":self.handleLoad  ,"help":"load directory file  "}, 
    31             {"cmd":"python","callback":self.handlePython,"help":"Run some python code "}, 
    32             {"cmd":"quit"  ,"callback":self.handleQuit  ,"help":"Terminate application"}, 
    33             {"cmd":"save"  ,"callback":self.handleSave  ,"help":"save directory file  "}, 
     27            {"cmd":"exit"  ,"callback":self.handleQuit  ,"help":"Terminate application "}, 
     28            {"cmd":"grid"  ,"callback":self.handleGrid  ,"help":"Toggle grid display   "}, 
     29            {"cmd":"run"   ,"callback":self.handleRun   ,"help":"Toggle player run/walk"}, 
     30            {"cmd":"help"  ,"callback":self.handleHelp  ,"help":"Show this help string "}, 
     31            {"cmd":"load"  ,"callback":self.handleLoad  ,"help":"load directory file   "}, 
     32            {"cmd":"python","callback":self.handlePython,"help":"Run some python code  "}, 
     33            {"cmd":"quit"  ,"callback":self.handleQuit  ,"help":"Terminate application "}, 
     34            {"cmd":"save"  ,"callback":self.handleSave  ,"help":"save directory file   "}, 
    3435        ] 
    3536        self.appListener=appListener 
     
    5455        self.appListener.world.activeMap.toggle_renderer('GridRenderer') 
    5556        return "Grid toggled" 
     57 
     58    def handleRun(self, command): 
     59        """ 
     60        Toggles run/walk mode of the PC player 
     61        @type command: string 
     62        @param command: The command to run. 
     63        @return: The response""" 
     64         
     65        if self.appListener.model.pc_run==1: 
     66            self.appListener.model.pc_run=0 
     67            return "PC is now walking" 
     68        else: 
     69            self.appListener.model.pc_run=1 
     70            return "PC is now running" 
     71             
    5672 
    5773    def handleHelp(self, command): 
     
    134150        return result  
    135151 
     152 
    136153    def handleConsoleCommand(self, command): 
    137154        """ 
Note: See TracChangeset for help on using the changeset viewer.