mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add valid
field to mod and set it to false for incomplete mods
This commit is contained in:
parent
6c1d3ce8fa
commit
19334bfb25
3 changed files with 5 additions and 4 deletions
|
@ -49,6 +49,7 @@ struct ModSpec
|
||||||
std::unordered_set<std::string> optdepends;
|
std::unordered_set<std::string> optdepends;
|
||||||
std::unordered_set<std::string> unsatisfied_depends;
|
std::unordered_set<std::string> unsatisfied_depends;
|
||||||
|
|
||||||
|
bool valid = true; /// False if incomplete
|
||||||
bool part_of_modpack = false;
|
bool part_of_modpack = false;
|
||||||
bool is_modpack = false;
|
bool is_modpack = false;
|
||||||
|
|
||||||
|
|
|
@ -2576,4 +2576,7 @@ void push_mod_spec(lua_State *L, const ModSpec &spec, bool include_unsatisfied)
|
||||||
lua_rawseti(L, -2, i++);
|
lua_rawseti(L, -2, i++);
|
||||||
}
|
}
|
||||||
lua_setfield(L, -2, "unsatisfied_depends");
|
lua_setfield(L, -2, "unsatisfied_depends");
|
||||||
|
|
||||||
|
lua_pushboolean(L, spec.valid);
|
||||||
|
lua_setfield(L, -2, "valid");
|
||||||
}
|
}
|
||||||
|
|
|
@ -450,10 +450,7 @@ int ModApiMainMenu::l_check_mod_configuration(lua_State *L)
|
||||||
spec.name = fs::GetFilenameFromPath(modpath.c_str());
|
spec.name = fs::GetFilenameFromPath(modpath.c_str());
|
||||||
spec.path = modpath;
|
spec.path = modpath;
|
||||||
spec.virtual_path = virtual_path;
|
spec.virtual_path = virtual_path;
|
||||||
if (!parseModContents(spec)) {
|
spec.valid = parseModContents(spec);
|
||||||
warningstream << "Mod \"" << spec.name
|
|
||||||
<< "\" has no \"init.lua\" or \"modpack.conf\"" << std::endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
modmgr.addMods(modSpecs);
|
modmgr.addMods(modSpecs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue