mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Merge pull request #1377 from vlegoff/ingame_python
Allow contrib.ingame_python.scripts.EventHandler.get_events to work w…
This commit is contained in:
commit
8b63fd7564
1 changed files with 12 additions and 4 deletions
|
|
@ -10,7 +10,7 @@ import traceback
|
|||
|
||||
from django.conf import settings
|
||||
from evennia import DefaultObject, DefaultScript, ChannelDB, ScriptDB
|
||||
from evennia import logger
|
||||
from evennia import logger, ObjectDB
|
||||
from evennia.utils.ansi import raw
|
||||
from evennia.utils.create import create_channel
|
||||
from evennia.utils.dbserialize import dbserialize
|
||||
|
|
@ -101,21 +101,29 @@ class EventHandler(DefaultScript):
|
|||
Return a dictionary of events on this object.
|
||||
|
||||
Args:
|
||||
obj (Object): the connected object.
|
||||
obj (Object or typeclass): the connected object or a general typeclass.
|
||||
|
||||
Returns:
|
||||
A dictionary of the object's events.
|
||||
|
||||
Note:
|
||||
Notes:
|
||||
Events would define what the object can have as
|
||||
callbacks. Note, however, that chained callbacks will not
|
||||
appear in events and are handled separately.
|
||||
|
||||
You can also request the events of a typeclass, not a
|
||||
connected object. This is useful to get the global list
|
||||
of events for a typeclass that has no object yet.
|
||||
|
||||
"""
|
||||
events = {}
|
||||
all_events = self.ndb.events
|
||||
classes = Queue()
|
||||
classes.put(type(obj))
|
||||
if isinstance(obj, type):
|
||||
classes.put(obj)
|
||||
else:
|
||||
classes.put(type(obj))
|
||||
|
||||
invalid = []
|
||||
while not classes.empty():
|
||||
typeclass = classes.get()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue