[VMF Mod Manager] Forbid creating mods in runtime

This commit is contained in:
Azumgi 2018-12-17 19:03:39 +03:00
parent 4154e86310
commit 34e9bed306

View file

@ -16,6 +16,8 @@ local ERRORS = {
"string, not %s.", "string, not %s.",
mod_data_path_wrong_type = "[VMF Mod Manager] (new_mod) '%s': 'mod_data' (optional) should be a string, not %s.", mod_data_path_wrong_type = "[VMF Mod Manager] (new_mod) '%s': 'mod_data' (optional) should be a string, not %s.",
mod_script_path_wrong_type = "[VMF Mod Manager] (new_mod) '%s': 'mod_script' should be a string, not %s.", mod_script_path_wrong_type = "[VMF Mod Manager] (new_mod) '%s': 'mod_script' should be a string, not %s.",
too_late_for_mod_creation = "[VMF Mod Manager] (new_mod) '%s': you can't create mods after vanilla mod manager " ..
"finishes loading mod bundles.",
-- vmf.initialize_mod_data: -- vmf.initialize_mod_data:
mod_data_wrong_type = "[VMF Mod Manager] (new_mod) 'mod_data' initialization: mod_data file should return " .. mod_data_wrong_type = "[VMF Mod Manager] (new_mod) 'mod_data' initialization: mod_data file should return " ..
"table, not %s.", "table, not %s.",
@ -73,6 +75,11 @@ function new_mod(mod_name, mod_resources)
return return
end end
if vmf.all_mods_were_loaded then
vmf:error(ERRORS.REGULAR.too_late_for_mod_creation, mod_name, type(mod_resources.mod_localization))
return
end
-- Create a mod object -- Create a mod object
local mod = create_mod(mod_name) local mod = create_mod(mod_name)
if not mod then if not mod then