Minor typo-fixes as well as making some variable names more intuitive.

This commit is contained in:
Griatch 2009-05-01 15:56:19 +00:00
parent 0efe2c3095
commit cafbdf720e
2 changed files with 17 additions and 8 deletions

View file

@ -48,7 +48,10 @@ def cmd_entermenu(command):
#get the player object calling the command #get the player object calling the command
source_object = command.source_object source_object = command.source_object
#this is important: we use the set_state() command #this is important: we use the set_state() command
#to shift the player into a state named 'menu'. #to shift the player into a state named 'menu'. Other useful
#access functions on source_object are get_state()
# and clear_state(), the latter returns the player to
# the normal mode of gameplay.
source_object.set_state(STATENAME) source_object.set_state(STATENAME)
#display the menu. #display the menu.
print_menu(source_object) print_menu(source_object)
@ -59,13 +62,15 @@ def cmd_entermenu(command):
# can be read as help entries when in the menu. # can be read as help entries when in the menu.
# #
def menu_cmd_option1(command): def menu_cmd_option1(command):
"""option1 """
option1
This selects the first option. This selects the first option.
""" """
source_object = command.source_object source_object = command.source_object
print_menu(source_object, 1) print_menu(source_object, 1)
def menu_cmd_option2(command): def menu_cmd_option2(command):
"""option2 """
option2
This selects the second option. Duh. This selects the second option. Duh.
<<TOPIC:About>> <<TOPIC:About>>
@ -74,7 +79,8 @@ def menu_cmd_option2(command):
source_object = command.source_object source_object = command.source_object
print_menu(source_object, 2) print_menu(source_object, 2)
def menu_cmd_clear(command): def menu_cmd_clear(command):
"""clear """
clear
Clears the options. Clears the options.
""" """
source_object = command.source_object source_object = command.source_object

View file

@ -985,18 +985,21 @@ class Object(models.Model):
otype = int(self.type) otype = int(self.type)
return defines_global.OBJECT_TYPES[otype][1][0] return defines_global.OBJECT_TYPES[otype][1][0]
#state access functions
def get_state(self): def get_state(self):
return self.state return self.state
def set_state(self, cmd_table=None): def set_state(self, state_name=None):
""" """
Set the state by defining which cmd_table is currently used. Only allow setting a state on a player object, otherwise
fail silently.
""" """
if self.is_player(): if self.is_player():
self.state = cmd_table self.state = state_name
def clear_state(self): def clear_state(self):
"Set to no state (return to normal operation)"
self.state = None self.state = None