mirror of
https://github.com/evennia/evennia.git
synced 2026-03-28 18:47:16 +01:00
- Made it so user #1 is also affected by the on_player_creation() function. - Added an event folder for custom events, including a working example - Expanded the example commands and parents to include the changes to how they should be initialized. - Added an optional ansi scheme (not active by default)
31 lines
936 B
Python
31 lines
936 B
Python
"""
|
|
This file contains the event scheduler system.
|
|
|
|
ADDING AN EVENT:
|
|
* Create an event sub-class from the IntervalEvent class in events.py.
|
|
* Call src.scheduler.add_event() with your IntervalEvent subclass as the arg.
|
|
* Make sure that the module where your add_event() call resides is either
|
|
imported, or that add_event() is called by a command or some kind of action.
|
|
* Profit.
|
|
"""
|
|
|
|
# List of IntervalEvent sub-classed objects.
|
|
schedule = []
|
|
|
|
def add_event(event):
|
|
"""
|
|
Adds an event instance to the scheduled event list. Call this any time you
|
|
need to add a custom event to the global scheduler.
|
|
|
|
Args:
|
|
* event: (IntervalEvent) The event to add to the scheduler.
|
|
"""
|
|
|
|
#don't add multiple instances of the same event
|
|
if event in schedule:
|
|
return
|
|
#i = schedule.index(event)
|
|
#schedule[i] = event
|
|
else:
|
|
schedule.append(event)
|
|
event.start_event_loop()
|