Fixed a bug in @dig for handling if no arguments where supplied.
This commit is contained in:
parent
05554e290a
commit
9bf3e48def
2 changed files with 31 additions and 19 deletions
|
|
@ -287,9 +287,6 @@ def cmd_examine(command):
|
||||||
s += str("Zone: %s" % target_obj.get_zone()) + newl
|
s += str("Zone: %s" % target_obj.get_zone()) + newl
|
||||||
s += str("Parent: %s " % target_obj.get_script_parent()) + newl
|
s += str("Parent: %s " % target_obj.get_script_parent()) + newl
|
||||||
|
|
||||||
for attribute in target_obj.get_all_attributes():
|
|
||||||
s += str(attribute.get_attrline()) + newl
|
|
||||||
|
|
||||||
# Contents container lists for sorting by type.
|
# Contents container lists for sorting by type.
|
||||||
con_players = []
|
con_players = []
|
||||||
con_things = []
|
con_things = []
|
||||||
|
|
@ -304,6 +301,20 @@ def cmd_examine(command):
|
||||||
elif obj.is_thing():
|
elif obj.is_thing():
|
||||||
con_things.append(obj)
|
con_things.append(obj)
|
||||||
|
|
||||||
|
# Render the object's home or destination (for exits).
|
||||||
|
if not target_obj.is_room():
|
||||||
|
if target_obj.is_exit():
|
||||||
|
# The Home attribute on an exit is really its destination.
|
||||||
|
s += str("Destination: %s" % target_obj.get_home()) + newl
|
||||||
|
else:
|
||||||
|
# For everything else, home is home.
|
||||||
|
s += str("Home: %s" % target_obj.get_home()) + newl
|
||||||
|
# This obviously isn't valid for rooms.
|
||||||
|
s += str("Location: %s" % target_obj.get_location()) + newl
|
||||||
|
|
||||||
|
for attribute in target_obj.get_all_attributes():
|
||||||
|
s += str(attribute.get_attrline()) + newl
|
||||||
|
|
||||||
# Render Contents display.
|
# Render Contents display.
|
||||||
if con_players or con_things:
|
if con_players or con_things:
|
||||||
s += str("%sContents:%s" % (ANSITable.ansi["hilite"],
|
s += str("%sContents:%s" % (ANSITable.ansi["hilite"],
|
||||||
|
|
@ -320,16 +331,8 @@ def cmd_examine(command):
|
||||||
for exit in con_exits:
|
for exit in con_exits:
|
||||||
s += str(' %s' % exit.get_name(fullname=True)) + newl
|
s += str(' %s' % exit.get_name(fullname=True)) + newl
|
||||||
|
|
||||||
# Render the object's home or destination (for exits).
|
|
||||||
if not target_obj.is_room():
|
|
||||||
if target_obj.is_exit():
|
|
||||||
# The Home attribute on an exit is really its destination.
|
|
||||||
s += str("Destination: %s" % target_obj.get_home()) + newl
|
|
||||||
else:
|
|
||||||
# For everything else, home is home.
|
|
||||||
s += str("Home: %s" % target_obj.get_home()) + newl
|
|
||||||
# This obviously isn't valid for rooms.
|
|
||||||
s += str("Location: %s" % target_obj.get_location()) + newl
|
|
||||||
source_object.emit_to(s)
|
source_object.emit_to(s)
|
||||||
|
|
||||||
GLOBAL_CMD_TABLE.add_command("examine", cmd_examine)
|
GLOBAL_CMD_TABLE.add_command("examine", cmd_examine)
|
||||||
|
|
|
||||||
|
|
@ -649,9 +649,14 @@ GLOBAL_CMD_TABLE.add_command("@unlink", cmd_unlink,
|
||||||
|
|
||||||
def cmd_dig(command):
|
def cmd_dig(command):
|
||||||
"""
|
"""
|
||||||
Creates a new room object.
|
Creates a new room object and optionally connects it to
|
||||||
|
where you are.
|
||||||
|
|
||||||
@dig[/teleport] roomname [:parent] [=exitthere,exithere]
|
Usage:
|
||||||
|
@dig[/switches] roomname [:parent] [=exitthere,exithere]
|
||||||
|
|
||||||
|
switches:
|
||||||
|
teleport - move yourself to the new room
|
||||||
|
|
||||||
"""
|
"""
|
||||||
source_object = command.source_object
|
source_object = command.source_object
|
||||||
|
|
@ -662,6 +667,10 @@ def cmd_dig(command):
|
||||||
parent = ''
|
parent = ''
|
||||||
exits = []
|
exits = []
|
||||||
|
|
||||||
|
if not args:
|
||||||
|
source_object.emit_to("Usage[/teleport]: @dig roomname [:parent] [=exitthere,exithere]")
|
||||||
|
return
|
||||||
|
|
||||||
#handle arguments
|
#handle arguments
|
||||||
if ':' in args:
|
if ':' in args:
|
||||||
roomname, args = args.split(':',1)
|
roomname, args = args.split(':',1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue