1 |
# global_event.py - this script handles all global events, except the plugin init (check plugin_init.py for that). |
2 |
# |
3 |
# This script merely looks and launches scripts in a specific subdirectory of /python/events/ |
4 |
# Only .py files are considered, you can simply rename a file to disable. |
5 |
# |
6 |
# This should simplify the separation of different Python things. |
7 |
|
8 |
import Crossfire |
9 |
import os |
10 |
|
11 |
path = os.path.join(Crossfire.DataDirectory(), Crossfire.MapDirectory(), 'python/events', Crossfire.ScriptParameters()) |
12 |
|
13 |
if os.path.exists(path): |
14 |
scripts = os.listdir(path) |
15 |
|
16 |
for script in scripts: |
17 |
if (script.endswith('.py')): |
18 |
execfile(os.path.join(path, script)) |