Migrate. Added the "view" access restriction (to make objects invisible). Also changed the input of ObjectDB.objects.object_search() to not require a caller as an argument (this makes it consistent with other search methods). All default systems should have updated to the new call, but if you have custom calls, you need to change them to fit the new syntax (this is only important if explicitly use ObjectDB.objects.object_search; if you just use caller.search you should be fine)
This commit is contained in:
parent
28fe2ad3f4
commit
27809694d7
13 changed files with 267 additions and 34 deletions
|
|
@ -115,8 +115,8 @@ def get_and_merge_cmdsets(caller):
|
|||
location = caller.location
|
||||
if location and not caller_cmdset.no_objs:
|
||||
# Gather all cmdsets stored on objects in the room and
|
||||
# also in the caller's inventory
|
||||
local_objlist = location.contents + caller.contents
|
||||
# also in the caller's inventory and the location itself
|
||||
local_objlist = location.contents + caller.contents + [location]
|
||||
local_objects_cmdsets = [obj.cmdset.current
|
||||
for obj in local_objlist
|
||||
if obj.locks.check(caller, 'call', no_superuser_bypass=True)]
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ class CmdSetHandler(object):
|
|||
self.permanent_paths.append("")
|
||||
self.update()
|
||||
|
||||
def add_default(self, cmdset, emit_to_obj=None, permanent=False):
|
||||
def add_default(self, cmdset, emit_to_obj=None, permanent=True):
|
||||
"""
|
||||
Add a new default cmdset. If an old default existed,
|
||||
it is replaced. If permanent is set, a script will be created to
|
||||
|
|
|
|||
|
|
@ -559,12 +559,19 @@ class CmdDestroy(MuxCommand):
|
|||
if obj.player and not 'override' in self.switches:
|
||||
string += "\nObject %s is controlled by an active player. Use /override to delete anyway." % objname
|
||||
continue
|
||||
had_exits = hasattr(obj, "exits") and obj.exits
|
||||
had_objs = hasattr(obj, "contents") and any(obj for obj in obj.contents
|
||||
if not (hasattr(obj, "exits") and obj not in obj.exits))
|
||||
# do the deletion
|
||||
okay = obj.delete()
|
||||
if not okay:
|
||||
string += "\nERROR: %s not deleted, probably because at_obj_delete() returned False." % objname
|
||||
else:
|
||||
string += "\n%s was deleted." % objname
|
||||
string += "\n%s was destroyed." % objname
|
||||
if had_exits:
|
||||
string += " Exits to and from %s were destroyed as well." % objname
|
||||
if had_objs:
|
||||
string += " Objects inside %s were moved to their homes." % objname
|
||||
if string:
|
||||
caller.msg(string.strip())
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ class CmdLook(MuxCommand):
|
|||
if not hasattr(looking_at_obj, 'return_appearance'):
|
||||
# this is likely due to us having a player instead
|
||||
looking_at_obj = looking_at_obj.character
|
||||
if not looking_at_obj.access(caller, "view"):
|
||||
caller.msg("Could not find '%s'." % args)
|
||||
return
|
||||
# get object's appearance
|
||||
caller.msg(looking_at_obj.return_appearance(caller))
|
||||
# the object's at_desc() method.
|
||||
|
|
|
|||
|
|
@ -197,10 +197,8 @@ class CmdScripts(MuxCommand):
|
|||
scripts = ScriptDB.objects.get_all_scripts(key=args)
|
||||
if not scripts:
|
||||
# try to find an object instead.
|
||||
objects = ObjectDB.objects.object_search(caller,
|
||||
args,
|
||||
global_search=True)
|
||||
if objects:
|
||||
objects = ObjectDB.objects.object_search(args, caller=caller, global_search=True)
|
||||
if objects:
|
||||
scripts = []
|
||||
for obj in objects:
|
||||
# get all scripts on the object(s)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue