old registered_structures -> structure_data

This commit is contained in:
cora 2022-06-06 01:46:32 +02:00
parent deeb7ce919
commit 899c849996
3 changed files with 9 additions and 9 deletions

View File

@ -87,7 +87,7 @@ minetest.register_craftitem("mcl_end:ender_eye", {
end end
local origin = user:get_pos() local origin = user:get_pos()
origin.y = origin.y + 1.5 origin.y = origin.y + 1.5
local strongholds = mcl_structures.get_registered_structures("stronghold") local strongholds = mcl_structures.get_structure_data("stronghold")
local dim = mcl_worlds.pos_to_dimension(origin) local dim = mcl_worlds.pos_to_dimension(origin)
local is_creative = minetest.is_creative_enabled(user:get_player_name()) local is_creative = minetest.is_creative_enabled(user:get_player_name())

View File

@ -61,7 +61,7 @@ local function init_strongholds()
end end
end end
mcl_structures.register_structures("stronghold", table.copy(strongholds)) mcl_structures.register_structure_data("stronghold", table.copy(strongholds))
strongholds_inited = true strongholds_inited = true
end end

View File

@ -530,7 +530,7 @@ function mcl_structures.generate_desert_temple(pos, rotation, pr)
mcl_structures.place_schematic(newpos, path, rotation or "random", nil, true, nil, temple_placement_callback, pr) mcl_structures.place_schematic(newpos, path, rotation or "random", nil, true, nil, temple_placement_callback, pr)
end end
local registered_structures = {} local structure_data = {}
--[[ Returns a table of structure of the specified type. --[[ Returns a table of structure of the specified type.
Currently the only valid parameter is "stronghold". Currently the only valid parameter is "stronghold".
@ -543,18 +543,18 @@ Format of return value:
TODO: Implement this function for all other structure types as well. TODO: Implement this function for all other structure types as well.
]] ]]
function mcl_structures.get_registered_structures(structure_type) function mcl_structures.get_structure_data(structure_type)
if registered_structures[structure_type] then if structure_data[structure_type] then
return table.copy(registered_structures[structure_type]) return table.copy(structure_data[structure_type])
else else
return {} return {}
end end
end end
-- Register a structures table for the given type. The table format is the same as for -- Register a structures table for the given type. The table format is the same as for
-- mcl_structures.get_registered_structures. -- mcl_structures.get_structure_data.
function mcl_structures.register_structures(structure_type, structures) function mcl_structures.register_structure_data(structure_type, structures)
registered_structures[structure_type] = structures structure_data[structure_type] = structures
end end
local function dir_to_rotation(dir) local function dir_to_rotation(dir)