forked from jstar88/wotmods
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a bug with dynamic platoon creation/join.
Removed unused imports. Added PluginLoader source code.
- Loading branch information
Showing
2 changed files
with
59 additions
and
13 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
files/uncompyled/wot_folder/res_mods/0.9.10/scripts/client/mods/PluginLoader.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Python 2.7 (decompiled from Python 2.7) | ||
# Embedded file name: PluginLoader.py | ||
# Compiled at: 2015-07-15 18:55:47 | ||
import os | ||
import imp | ||
import sys | ||
import importlib | ||
import traceback | ||
from plugins.Engine.ModUtils import FileUtils | ||
from debug_utils import LOG_ERROR, LOG_CURRENT_EXCEPTION, LOG_DEBUG, LOG_NOTE, LOG_WARNING | ||
PluginFolder = FileUtils.getRealPluginsPath() | ||
|
||
def getPlugins(): | ||
plugins = [] | ||
sys.path.append(PluginFolder) | ||
possibleplugins = os.listdir(PluginFolder) | ||
for i in possibleplugins: | ||
location = os.path.join(PluginFolder, i) | ||
if not os.path.isdir(location) or i == 'Engine': | ||
continue | ||
plugins.append(i) | ||
|
||
return plugins | ||
|
||
|
||
def loadPlugin(i): | ||
try: | ||
module = __import__(i) | ||
my_class = getattr(module, i.replace('_plugin', '')) | ||
getattr(my_class, 'init')() | ||
getattr(my_class, 'readConfig')() | ||
if getattr(my_class, 'pluginEnable'): | ||
print '---> Loading ' + i | ||
getattr(my_class, 'run')() | ||
except: | ||
LOG_ERROR('plugin "' + i + '" contains errors!') | ||
traceback.print_exc() | ||
|
||
|
||
map(loadPlugin, getPlugins()) | ||
# okay decompiling PluginLoader.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters