Fixed a bug in @dig for handling if no arguments where supplied.

This commit is contained in:
Griatch 2009-05-03 17:10:10 +00:00
parent 05554e290a
commit 9bf3e48def
2 changed files with 31 additions and 19 deletions

View file

@ -286,10 +286,7 @@ def cmd_examine(command):
s += str("Owner: %s " % target_obj.get_owner()) + newl
s += str("Zone: %s" % target_obj.get_zone()) + 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.
con_players = []
con_things = []
@ -303,7 +300,21 @@ def cmd_examine(command):
con_exits.append(obj)
elif obj.is_thing():
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.
if con_players or con_things:
s += str("%sContents:%s" % (ANSITable.ansi["hilite"],
@ -319,17 +330,9 @@ def cmd_examine(command):
ANSITable.ansi["normal"])) + newl
for exit in con_exits:
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)
GLOBAL_CMD_TABLE.add_command("examine", cmd_examine)

View file

@ -649,10 +649,15 @@ GLOBAL_CMD_TABLE.add_command("@unlink", cmd_unlink,
def cmd_dig(command):
"""
Creates a new room object.
Creates a new room object and optionally connects it to
where you are.
Usage:
@dig[/switches] roomname [:parent] [=exitthere,exithere]
switches:
teleport - move yourself to the new room
@dig[/teleport] roomname [:parent] [=exitthere,exithere]
"""
source_object = command.source_object
@ -662,6 +667,10 @@ def cmd_dig(command):
parent = ''
exits = []
if not args:
source_object.emit_to("Usage[/teleport]: @dig roomname [:parent] [=exitthere,exithere]")
return
#handle arguments
if ':' in args:
roomname, args = args.split(':',1)