Added an at_obj_receive hook to basic player/object script parents. This allows
e.g. room parents to react when a player enters them.
This commit is contained in:
parent
d06ac3e239
commit
eb6f82fea0
5 changed files with 22 additions and 11 deletions
|
|
@ -476,17 +476,8 @@ def cmd_find(command):
|
||||||
dbref_limits=(lowlim, highlim))
|
dbref_limits=(lowlim, highlim))
|
||||||
if not results:
|
if not results:
|
||||||
return
|
return
|
||||||
source_object.emit_to("Name match: %s" % results)
|
source_object.emit_to("Found a unique name match: %s" % results)
|
||||||
|
|
||||||
## if len(results) > 0:
|
|
||||||
## source_object.emit_to("Name matches for: %s" % (searchstring,))
|
|
||||||
## s = ""
|
|
||||||
## for result in results:
|
|
||||||
## s += " %s\n\r" % (result.get_name(fullname=True),)
|
|
||||||
## s += "%d matches returned." % (len(results),)
|
|
||||||
## source_object.emit_to(s)
|
|
||||||
## else:
|
|
||||||
## source_object.emit_to("No name matches found for: %s" % (searchstring,))
|
|
||||||
GLOBAL_CMD_TABLE.add_command("@find", cmd_find,
|
GLOBAL_CMD_TABLE.add_command("@find", cmd_find,
|
||||||
priv_tuple=("objects.info",), help_category="Building",
|
priv_tuple=("objects.info",), help_category="Building",
|
||||||
auto_help_override=False)
|
auto_help_override=False)
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,12 @@ class ObjectManager(models.Manager):
|
||||||
return o_query.exclude(type__in=[defines_global.OTYPE_GARBAGE,
|
return o_query.exclude(type__in=[defines_global.OTYPE_GARBAGE,
|
||||||
defines_global.OTYPE_GOING])
|
defines_global.OTYPE_GOING])
|
||||||
|
|
||||||
|
def local_object_script_parent_search(self, script_parent, location):
|
||||||
|
o_query = self.filter(script_parent__exact=script_parent).filter(location__iexact=location)
|
||||||
|
return o_query.exclude(type__in=[defines_global.OTYPE_GARBAGE,
|
||||||
|
defines_global.OTYPE_GOING])
|
||||||
|
|
||||||
|
|
||||||
def list_search_object_namestr(self, searchlist, ostring, dbref_only=False,
|
def list_search_object_namestr(self, searchlist, ostring, dbref_only=False,
|
||||||
limit_types=False, match_type="fuzzy",
|
limit_types=False, match_type="fuzzy",
|
||||||
attribute_name=None):
|
attribute_name=None):
|
||||||
|
|
|
||||||
|
|
@ -1003,6 +1003,9 @@ class Object(models.Model):
|
||||||
# Execute eventual extra commands on this object after moving it
|
# Execute eventual extra commands on this object after moving it
|
||||||
self.scriptlink.at_after_move()
|
self.scriptlink.at_after_move()
|
||||||
|
|
||||||
|
# Perform eventual extra commands on the receiving location
|
||||||
|
target.scriptlink.at_obj_receive(self)
|
||||||
|
|
||||||
if force_look and self.is_player():
|
if force_look and self.is_player():
|
||||||
self.execute_cmd('look')
|
self.execute_cmd('look')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,12 @@ class EvenniaBasicObject(object):
|
||||||
#print "SCRIPT TEST: %s dropped %s." % (pobject, self.scripted_obj)
|
#print "SCRIPT TEST: %s dropped %s." % (pobject, self.scripted_obj)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def at_obj_receive(self, object=None):
|
||||||
|
"""
|
||||||
|
Called whenever an object is added to the contents of this object.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def return_appearance(self, pobject=None):
|
def return_appearance(self, pobject=None):
|
||||||
"""
|
"""
|
||||||
Returns a string representation of an object's appearance when LOOKed at.
|
Returns a string representation of an object's appearance when LOOKed at.
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,11 @@ class EvenniaBasicPlayer(object):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def at_obj_receive(self, object=None):
|
||||||
|
"""
|
||||||
|
Called whenever an object is added to the inventory of the player.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def at_disconnect(self):
|
def at_disconnect(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue