mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Fixed some hooks to match wiki docs.
This commit is contained in:
parent
923b9ac2ec
commit
6a13d07c55
3 changed files with 18 additions and 4 deletions
|
|
@ -71,10 +71,24 @@ class Object(BaseObject):
|
|||
at_object_receive(obj, source_location) - called when this object receives another object
|
||||
(e.g. a room being entered, an object moved into inventory)
|
||||
|
||||
|
||||
|
||||
|
||||
return_appearance(looker) - by default, this is used by the 'look' command to
|
||||
request this object to describe itself. Looker
|
||||
is the object requesting to get the information.
|
||||
at_desc(looker=None) - by default called whenever the appearance is requested.
|
||||
|
||||
at_msg_receive(self, msg, from_obj=None, data=None) - called whenever someone sends a message to this object.
|
||||
message aborted if hook returns False.
|
||||
at_msg_send(self, msg, to_obj=None, data=None) - called when this objects sends a message. This can only be
|
||||
called if from_obj is specified in the call to msg().
|
||||
at_object_delete() - calleed when this object is to be deleted. If returns False, deletion is aborted.
|
||||
|
||||
at_get(getter) - called after object has been picked up. Does not stop pickup.
|
||||
at_drop(dropper) - called when this object has been dropped.
|
||||
at_say(speaker, message) - by default, called if an object inside this object speaks
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ class Object(TypeClass):
|
|||
string += ", ".join(things)
|
||||
return string
|
||||
|
||||
def at_msg_receive(self, msg, from_obj=None):
|
||||
def at_msg_receive(self, msg, from_obj=None, data=None):
|
||||
"""
|
||||
This hook is called whenever someone
|
||||
sends a message to this object.
|
||||
|
|
@ -249,7 +249,7 @@ class Object(TypeClass):
|
|||
"""
|
||||
return True
|
||||
|
||||
def at_msg_send(self, msg, to_obj):
|
||||
def at_msg_send(self, msg, to_obj=None, data=None):
|
||||
"""
|
||||
This is a hook that is called when /this/ object
|
||||
sends a message to another object with obj.msg()
|
||||
|
|
|
|||
|
|
@ -258,11 +258,11 @@ class PlayerDB(TypedObject):
|
|||
"""
|
||||
if from_obj:
|
||||
try:
|
||||
from_obj.at_msg_send(outgoing_string, self)
|
||||
from_obj.at_msg_send(outgoing_string, to_obj=self, data=data)
|
||||
except Exception:
|
||||
pass
|
||||
if self.character:
|
||||
if self.character.at_msg_receive(outgoing_string, from_obj):
|
||||
if self.character.at_msg_receive(outgoing_string, from_obj=from_obj, data=data):
|
||||
for session in object.__getattribute__(self, 'sessions'):
|
||||
session.msg(outgoing_string, data)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue