1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Add error message

This commit is contained in:
Xeno333 2025-06-10 21:30:06 -05:00
parent 71402ffcd2
commit ba697c0d33
2 changed files with 8 additions and 2 deletions

View file

@ -175,7 +175,8 @@ local function create_world_formspec(dialogdata)
if not is_internal_mapgen then if not is_internal_mapgen then
-- Select singlenode if using lua-defined mapgen -- Select singlenode if using lua-defined mapgen
-- Here we have to make sure it doesn't override an internal mapgen -- Here we have to make sure it doesn't override an internal mapgen
if lua_mapgens[current_mapgen_internal] ~= nil and (current_mapgen == dialogdata.mg or lua_mapgens[current_mapgen_internal].title == dialogdata.mg) then if lua_mapgens[current_mapgen_internal] ~= nil and
(current_mapgen == dialogdata.mg or lua_mapgens[current_mapgen_internal].title == dialogdata.mg) then
current_mapgen_internal = "singlenode" current_mapgen_internal = "singlenode"
end end
end end

View file

@ -132,17 +132,22 @@ void ModConfiguration::addMapgenFromConfig(
* *
* If the mod is enabled, add it to `mapgen_mod` and break * If the mod is enabled, add it to `mapgen_mod` and break
*/ */
bool mapgen_found = false;
for (const auto &mapgenPath : mapgenPaths) { for (const auto &mapgenPath : mapgenPaths) {
std::vector<ModSpec> addon_mods_in_path = flattenMods(getModsInPath(mapgenPath.second, mapgenPath.first)); std::vector<ModSpec> addon_mods_in_path = flattenMods(getModsInPath(mapgenPath.second, mapgenPath.first));
for (const auto &mod : addon_mods_in_path) { for (const auto &mod : addon_mods_in_path) {
if (mod.name == mapgen) { if (mod.name == mapgen) {
mapgen_mod.push_back(mod); mapgen_mod.push_back(mod);
mapgen_found = true;
break; break;
} }
} }
} }
addMods(mapgen_mod); if (!mapgen_found) {
throw ModError("This world is configured to use a lua-defined mapgen: '" + mapgen + "' must be installed to load this world.");
} else
addMods(mapgen_mod);
} }
void ModConfiguration::addModsFromConfig( void ModConfiguration::addModsFromConfig(