since I don't know when contentdb will accept the changed name for namegen, adding support for both names temporarily

This commit is contained in:
FaceDeer
2020-12-01 21:54:10 -07:00
parent d2ed498f45
commit 2b8f808605
3 changed files with 16 additions and 8 deletions

View File

@ -9,6 +9,14 @@ local bones_loot_path = minetest.get_modpath("bones_loot")
local named_waypoints_path = minetest.get_modpath("named_waypoints")
local name_generator_path = minetest.get_modpath("name_generator")
-- TEMP backwards compatibility for the change of name of the name_generator mod. Once it's updated in the contentDB, remove this and also the optional_depends
local namegenerator = nil
if not name_generator_path and minetest.get_modpath("namegen") and namegen and namegen.parse_lines and namegen.generate then
namegenerator = namegen
elseif name_generator_path then
namegenerator = name_generator
end
local hunters_enabled = minetest.get_modpath("hunter_statue") and df_underworld_items.config.underworld_hunter_statues
local name_pit = function() end
@ -51,14 +59,14 @@ if named_waypoints_path then
end
named_waypoints.register_named_waypoints("puzzle_seals", seal_waypoint_def)
if name_generator_path then
name_generator.parse_lines(io.lines(modpath.."/underworld_names.cfg"))
if namegenerator then
namegenerator.parse_lines(io.lines(modpath.."/underworld_names.cfg"))
name_pit = function()
return name_generator.generate("glowing_pits")
return namegenerator.generate("glowing_pits")
end
name_ruin = function()
return name_generator.generate("underworld_ruins")
return namegenerator.generate("underworld_ruins")
end
local underworld_ruin_def = {
@ -467,7 +475,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
mapgen_helper.place_schematic_on_data(data, data_param2, area, building.pos, small_building_schematic, building.rotation)
elseif building.building_type == "medium building" then
mapgen_helper.place_schematic_on_data(data, data_param2, area, building.pos, medium_building_schematic, building.rotation)
if named_waypoints_path and name_generator_path then
if named_waypoints_path and namegenerator then
if not next(named_waypoints.get_waypoints_in_area("underworld_ruins", vector.subtract(building.pos, 250), vector.add(building.pos, 250))) then
named_waypoints.add_waypoint("underworld_ruins", {x=building.pos.x, y=floor_height+1, z=building.pos.z}, {name=name_ruin()})
end