Added the apropos command for broader help searching (uses icontains).

The suggestions: footer used in help gave too narrow results, now using apropos-style search instead.
Bug fix of state-help command to make it accept switches.
Added several new example commands and cleaned up old ones to be more user-friendly.
Added protection in @delevent to make it harder to delete system events.
Some small bug fixes and other cleanup.
This commit is contained in:
Griatch 2009-12-20 12:39:08 +00:00
parent c7cbc4854e
commit 81bec61d7d
12 changed files with 295 additions and 138 deletions

View file

@ -441,6 +441,12 @@ class ObjectManager(models.Manager):
new_object.owner = None
new_object.zone = None
else:
if owner == None:
# if owner is None for a non-player object we are probably
# creating an object from a script. In this case we set
# the owner to be the superuser.
owner = self.get_object_from_dbref("#1")
new_object.owner = owner
if new_object.get_owner().get_zone():
new_object.zone = new_object.get_owner().get_zone()

View file

@ -62,7 +62,7 @@ class Attribute(models.Model):
"""
attr_value = self.attr_value
if self.attr_ispickled:
attr_value = pickle.loads(str(attr_value))
attr_value = pickle.loads(str(attr_value))
return attr_value
def set_value(self, new_value):
@ -82,7 +82,7 @@ class Attribute(models.Model):
self.attr_value = new_value
self.attr_ispickled = ispickled
self.save()
def get_object(self):
"""
Returns the object that the attribute resides on.
@ -315,7 +315,7 @@ class Object(models.Model):
no matter what)
"""
# The Command object has all of the methods for parsing and preparing
# for searching and execution. Send it to the handler once populated.
# for searching and execution. Send it to the handler once populated.
cmdhandler.handle(cmdhandler.Command(self, command_str,
session=session),
ignore_state=ignore_state)
@ -1267,14 +1267,15 @@ class Object(models.Model):
# we never enter other states if we are already in
# the interactive batch processor.
nostate = nostate or self.get_state() == "_interactive batch processor"
nostate = nostate or \
self.get_state() == "_interactive batch processor"
if nostate:
return False
# switch the state
self.cache.state = state_name
return True
def clear_state(self):
"""
Set to no state (return to normal operation)
@ -1284,7 +1285,7 @@ class Object(models.Model):
(batch processor clears the state directly instead)
"""
if not self.state == "_interactive batch processor":
self.state = None
self.cache.state = None
def purge_object(self):
"Completely clears all aspects of the object."