diff --git a/mods/MAPGEN/mcl_mapgen_core/depends.txt b/mods/MAPGEN/mcl_mapgen_core/depends.txt index ff23a1ec86..6bc0defc6b 100644 --- a/mods/MAPGEN/mcl_mapgen_core/depends.txt +++ b/mods/MAPGEN/mcl_mapgen_core/depends.txt @@ -2,4 +2,4 @@ mcl_init mcl_util mcl_core stairs -random_struct +mcl_structures diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 9432d7a636..0f3ad2c93d 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -891,7 +891,7 @@ minetest.register_on_generated(function(minp, maxp, seed) if nn == "mcl_core:sand" or nn == "mcl_core:sandstone" then if math.random(0,12000) == 1 then -- Spawn desert temple - random_struct.call_struct(p,2) + mcl_structures.call_struct(p,2) end end end diff --git a/mods/MAPGEN/random_struct/build/desert_temple.we b/mods/MAPGEN/mcl_structures/build/desert_temple.we similarity index 100% rename from mods/MAPGEN/random_struct/build/desert_temple.we rename to mods/MAPGEN/mcl_structures/build/desert_temple.we diff --git a/mods/MAPGEN/random_struct/build/pnj_field_1.we b/mods/MAPGEN/mcl_structures/build/pnj_field_1.we similarity index 100% rename from mods/MAPGEN/random_struct/build/pnj_field_1.we rename to mods/MAPGEN/mcl_structures/build/pnj_field_1.we diff --git a/mods/MAPGEN/random_struct/build/pnj_house_1.we b/mods/MAPGEN/mcl_structures/build/pnj_house_1.we similarity index 100% rename from mods/MAPGEN/random_struct/build/pnj_house_1.we rename to mods/MAPGEN/mcl_structures/build/pnj_house_1.we diff --git a/mods/MAPGEN/random_struct/build/pnj_house_2.we b/mods/MAPGEN/mcl_structures/build/pnj_house_2.we similarity index 100% rename from mods/MAPGEN/random_struct/build/pnj_house_2.we rename to mods/MAPGEN/mcl_structures/build/pnj_house_2.we diff --git a/mods/MAPGEN/random_struct/build/pnj_house_3.we b/mods/MAPGEN/mcl_structures/build/pnj_house_3.we similarity index 100% rename from mods/MAPGEN/random_struct/build/pnj_house_3.we rename to mods/MAPGEN/mcl_structures/build/pnj_house_3.we diff --git a/mods/MAPGEN/random_struct/build/pnj_light.we b/mods/MAPGEN/mcl_structures/build/pnj_light.we similarity index 100% rename from mods/MAPGEN/random_struct/build/pnj_light.we rename to mods/MAPGEN/mcl_structures/build/pnj_light.we diff --git a/mods/MAPGEN/random_struct/build/pnj_town_1.we b/mods/MAPGEN/mcl_structures/build/pnj_town_1.we similarity index 100% rename from mods/MAPGEN/random_struct/build/pnj_town_1.we rename to mods/MAPGEN/mcl_structures/build/pnj_town_1.we diff --git a/mods/MAPGEN/random_struct/build/pnj_town_withway_1.we b/mods/MAPGEN/mcl_structures/build/pnj_town_withway_1.we similarity index 100% rename from mods/MAPGEN/random_struct/build/pnj_town_withway_1.we rename to mods/MAPGEN/mcl_structures/build/pnj_town_withway_1.we diff --git a/mods/MAPGEN/random_struct/build/pnj_watersource.we b/mods/MAPGEN/mcl_structures/build/pnj_watersource.we similarity index 100% rename from mods/MAPGEN/random_struct/build/pnj_watersource.we rename to mods/MAPGEN/mcl_structures/build/pnj_watersource.we diff --git a/mods/MAPGEN/random_struct/build/witcher_house.we b/mods/MAPGEN/mcl_structures/build/witcher_house.we similarity index 100% rename from mods/MAPGEN/random_struct/build/witcher_house.we rename to mods/MAPGEN/mcl_structures/build/witcher_house.we diff --git a/mods/MAPGEN/random_struct/depends.txt b/mods/MAPGEN/mcl_structures/depends.txt similarity index 100% rename from mods/MAPGEN/random_struct/depends.txt rename to mods/MAPGEN/mcl_structures/depends.txt diff --git a/mods/MAPGEN/random_struct/init.lua b/mods/MAPGEN/mcl_structures/init.lua similarity index 88% rename from mods/MAPGEN/random_struct/init.lua rename to mods/MAPGEN/mcl_structures/init.lua index fa65a3c707..103a36bd91 100644 --- a/mods/MAPGEN/random_struct/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -1,11 +1,11 @@ local init = os.clock() -random_struct ={} +mcl_structures ={} -random_struct.get_struct = function(file) - local localfile = minetest.get_modpath("random_struct").."/build/"..file +mcl_structures.get_struct = function(file) + local localfile = minetest.get_modpath("mcl_structures").."/build/"..file local file, errorload = io.open(localfile, "rb") if errorload ~= nil then - minetest.log("action", '[Random_Struct] error: could not open this struct "' .. localfile .. '"') + minetest.log("error", '[mcl_structures] Could not open this struct: ' .. localfile) return nil end @@ -18,7 +18,7 @@ end -- World edit function -random_struct.valueversion_WE = function(value) +mcl_structures.valueversion_WE = function(value) if value:find("([+-]?%d+)%s+([+-]?%d+)%s+([+-]?%d+)") and not value:find("%{") then --previous list format return 3 elseif value:find("^[^\"']+%{%d+%}") then @@ -31,13 +31,13 @@ random_struct.valueversion_WE = function(value) end return 0 --unknown format end -random_struct.allocate_WE = function(originpos, value) +mcl_structures.allocate_WE = function(originpos, value) local huge = math.huge local pos1x, pos1y, pos1z = huge, huge, huge local pos2x, pos2y, pos2z = -huge, -huge, -huge local originx, originy, originz = originpos.x, originpos.y, originpos.z local count = 0 - local version = random_struct.valueversion_WE (value) + local version = mcl_structures.valueversion_WE (value) if version == 1 or version == 2 then --flat table format --obtain the node table local get_tables = loadstring(value) @@ -128,16 +128,16 @@ random_struct.allocate_WE = function(originpos, value) local pos2 = {x=pos2x, y=pos2y, z=pos2z} return pos1, pos2, count end -random_struct.deserialise_WE = function(originpos, value) +mcl_structures.deserialise_WE = function(originpos, value) --make area stay loaded - local pos1, pos2 = random_struct.allocate_WE(originpos, value) + local pos1, pos2 = mcl_structures.allocate_WE(originpos, value) local manip = minetest.get_voxel_manip() manip:read_from_map(pos1, pos2) local originx, originy, originz = originpos.x, originpos.y, originpos.z local count = 0 local add_node, get_meta = minetest.add_node, minetest.get_meta - local version = random_struct.valueversion_WE(value) + local version = mcl_structures.valueversion_WE(value) if version == 1 or version == 2 then --original flat table format --obtain the node table local get_tables = loadstring(value) @@ -222,33 +222,33 @@ end -- The call of Struct -random_struct.call_struct= function(pos, struct_style) +mcl_structures.call_struct= function(pos, struct_style) -- 1: Village , 2: Desert temple if struct_style == 1 then - random_struct.geerate_village(pos) + mcl_structures.geerate_village(pos) elseif struct_style == 2 then - random_struct.generate_desert_temple(pos) + mcl_structures.generate_desert_temple(pos) end end -random_struct.generate_village = function(pos) +mcl_structures.generate_village = function(pos) -- No Generating for the moment only place it :D - local city = random_struct.get_struct("pnj_town_1.we") + local city = mcl_structures.get_struct("pnj_town_1.we") local newpos = {x=pos.x,y=pos.y,z=pos.z} if newpos == nil then return end - random_struct.deserialise_WE(newpos, city ) + mcl_structures.deserialise_WE(newpos, city ) end -random_struct.generate_desert_temple = function(pos) +mcl_structures.generate_desert_temple = function(pos) -- No Generating for the temple ... Why using it ? No Change - local temple = random_struct.get_struct("desert_temple.we") + local temple = mcl_structures.get_struct("desert_temple.we") local newpos = {x=pos.x,y=pos.y-12,z=pos.z} if newpos == nil then return end - random_struct.deserialise_WE(newpos, temple) + mcl_structures.deserialise_WE(newpos, temple) end @@ -264,10 +264,10 @@ minetest.register_chatcommand("spawnstruct", { end local errord = false if param == "village" then - random_struct.generate_village(pos) + mcl_structures.generate_village(pos) minetest.chat_send_player(name, "Village created.") elseif param == "desert_temple" then - random_struct.generate_desert_temple(pos) + mcl_structures.generate_desert_temple(pos) minetest.chat_send_player(name, "Desert temple created.") elseif param == "" then minetest.chat_send_player(name, "Error: No structure type given. Please use “/spawnstruct ”.") diff --git a/mods/MAPGEN/mcl_structures/mod.conf b/mods/MAPGEN/mcl_structures/mod.conf new file mode 100644 index 0000000000..8624419050 --- /dev/null +++ b/mods/MAPGEN/mcl_structures/mod.conf @@ -0,0 +1 @@ +name = mcl_structures