forked from boskee/Minecraft
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmod.py
More file actions
29 lines (21 loc) · 619 Bytes
/
mod.py
File metadata and controls
29 lines (21 loc) · 619 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Imports, sorted alphabetically.
# Python packages
import importlib
import os
import sys
# Third-party packages
# Modules from this project
import globals as G
from debug import log_info
__all__ = ('load_modules')
def load_modules(server=False):
mod_dir = os.path.join(G.game_dir, 'mods')
if not os.path.isdir(mod_dir):
if os.path.exists(mod_dir):
os.remove(mod_dir)
os.makedirs(mod_dir)
sys.path.append(mod_dir)
log_info('Mod loader has identified %d mods to load' % (len(os.listdir(mod_dir))))
for name in os.listdir(mod_dir):
module = importlib.import_module(name)
module.initialize(server)