2023-05-07 20:55:13 +02:00
|
|
|
function __initAddon() {
|
2023-04-22 16:23:51 +02:00
|
|
|
var dirPath = DIRECTORY + "Addons";
|
2023-05-07 20:55:13 +02:00
|
|
|
globalvar ADDONS, ADDONS_ON_START;
|
2023-04-22 16:23:51 +02:00
|
|
|
ADDONS = [];
|
2023-05-07 20:55:13 +02:00
|
|
|
ADDONS_ON_START = [];
|
2023-04-22 16:23:51 +02:00
|
|
|
|
|
|
|
if(!directory_exists(dirPath)) {
|
|
|
|
directory_create(dirPath);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var f = file_find_first(dirPath + "\\*", fa_directory);
|
2023-05-07 20:55:13 +02:00
|
|
|
var _f = "";
|
|
|
|
|
|
|
|
while(f != "" && f != _f) {
|
|
|
|
_f = f;
|
2023-05-03 21:42:17 +02:00
|
|
|
var _path = dirPath + "\\" + f;
|
|
|
|
var _meta = _path + "\\meta.json";
|
|
|
|
|
2023-05-07 20:55:13 +02:00
|
|
|
if(!file_exists(_meta)) {
|
|
|
|
f = file_find_next();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2023-05-03 21:42:17 +02:00
|
|
|
var _mSrt = json_load_struct(_meta);
|
|
|
|
var _str = {
|
|
|
|
name: f,
|
|
|
|
path: _path,
|
|
|
|
meta: _mSrt.meta,
|
|
|
|
|
|
|
|
open: false
|
|
|
|
};
|
|
|
|
|
|
|
|
array_push(ADDONS, _str);
|
2023-04-22 16:23:51 +02:00
|
|
|
f = file_find_next();
|
|
|
|
}
|
2023-05-07 20:55:13 +02:00
|
|
|
|
|
|
|
file_find_close();
|
|
|
|
}
|
|
|
|
|
|
|
|
function loadAddon() {
|
|
|
|
var _path = DIRECTORY + "Addons\\__init.json";
|
|
|
|
if(!file_exists(_path)) return;
|
|
|
|
|
|
|
|
ADDONS_ON_START = json_load_struct(_path);
|
|
|
|
for( var i = 0; i < array_length(ADDONS_ON_START); i++ )
|
|
|
|
addonTrigger(ADDONS_ON_START[i], false);
|
2023-04-22 16:23:51 +02:00
|
|
|
}
|