From c4dbbda9fd9c08ff2108a3f91794b87e0de14baf Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 9 Dec 2017 02:05:41 +0100 Subject: [PATCH] Add end portal room structure --- mods/MAPGEN/mcl_structures/depends.txt | 2 + mods/MAPGEN/mcl_structures/init.lua | 69 +++++++++++++++++- .../mcl_structures_end_portal_room_simple.mts | Bin 0 -> 423 bytes 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_end_portal_room_simple.mts diff --git a/mods/MAPGEN/mcl_structures/depends.txt b/mods/MAPGEN/mcl_structures/depends.txt index eab89039c..4b537d0d1 100644 --- a/mods/MAPGEN/mcl_structures/depends.txt +++ b/mods/MAPGEN/mcl_structures/depends.txt @@ -10,3 +10,5 @@ mcl_chests mcl_inventory mesecons_pressureplates mcl_tnt +mcl_mobspawners +mcl_portals diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index e3e6eec67..4a48e93a9 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -40,6 +40,8 @@ mcl_structures.call_struct = function(pos, struct_style, rotation) return mcl_structures.generate_fossil(pos, rotation) elseif struct_style == "end_exit_portal" then return mcl_structures.generate_end_exit_portal(pos, rotation) + elseif struct_style == "end_portal_room" then + return mcl_structures.generate_end_portal_room(pos, rotation) end end @@ -123,6 +125,68 @@ mcl_structures.generate_end_exit_portal = function(pos) return minetest.place_schematic(pos, path, "0", nil, true) end +mcl_structures.generate_end_portal_room = function(pos) + local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_portal_room_simple.mts" + local size = {x=13, y=8, z=13} + local ret = minetest.place_schematic(pos, path, "0", nil, true) + if ret == nil then + return ret + end + + local area_start, area_end = {x=pos.x-size.x, y=pos.y, z=pos.z-size.z}, vector.add(pos, size) + -- Find and setup spawner with silverfish + local spawners = minetest.find_nodes_in_area(area_start, area_end, "mcl_mobspawners:spawner") + for s=1, #spawners do + local meta = minetest.get_meta(spawners[s]) + mcl_mobspawners.setup_spawner(spawners[s], "mobs_mc:silverfish") + end + + -- Shuffle stone brick types + local bricks = minetest.find_nodes_in_area(area_start, area_end, "mcl_core:stonebrick") + -- FIXME: Use better seeding + local pr = PseudoRandom(math.random(0, 4294967295)) + for b=1, #bricks do + local r_bricktype = pr:next(1, 100) + local r_infested = pr:next(1, 100) + local bricktype + if r_infested <= 8 then + if r_bricktype <= 10 then + bricktype = "mcl_monster_eggs:monster_egg_stonebrickmossy" + elseif r_bricktype <= 20 then + bricktype = "mcl_monster_eggs:monster_egg_stonebrickcracked" + else + bricktype = "mcl_monster_eggs:monster_egg_stonebrick" + end + else + if r_bricktype <= 10 then + bricktype = "mcl_core:stonebrickmossy" + elseif r_bricktype <= 20 then + bricktype = "mcl_core:stonebrickcracked" + end + end + if bricktype ~= nil then + minetest.set_node(bricks[b], { name = bricktype }) + end + end + + -- Randomly add ender eyes into end portal frames, but never fill the entire frame + local frames = minetest.find_nodes_in_area(area_start, area_end, "mcl_portals:end_portal_frame") + local eyes = 0 + for f=1, #frames do + local r_eye = pr:next(1, 10) + if r_eye == 1 then + eyes = eyes + 1 + if eyes < #frames then + local frame_node = minetest.get_node(frames[f]) + frame_node.name = "mcl_portals:end_portal_frame_eye" + minetest.set_node(frames[f], frame_node) + end + end + end + + return ret +end + mcl_structures.generate_desert_temple = function(pos) -- No Generating for the temple ... Why using it ? No Change local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_desert_temple.mts" @@ -201,7 +265,7 @@ end -- Debug command minetest.register_chatcommand("spawnstruct", { - params = "desert_temple | desert_well | igloo | village | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal", + params = "desert_temple | desert_well | igloo | village | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_room", description = "Generate a pre-defined structure near your position.", privs = {debug = true}, func = function(name, param) @@ -240,6 +304,9 @@ minetest.register_chatcommand("spawnstruct", { elseif param == "end_exit_portal" then mcl_structures.generate_end_exit_portal(pos) minetest.chat_send_player(name, "End exit portal placed.") + elseif param == "end_portal_room" then + mcl_structures.generate_end_portal_room(pos) + minetest.chat_send_player(name, "End portal room placed.") elseif param == "" then minetest.chat_send_player(name, "Error: No structure type given. Please use “/spawnstruct ”.") errord = true diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_end_portal_room_simple.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_end_portal_room_simple.mts new file mode 100644 index 0000000000000000000000000000000000000000..d3e6df03c8cb5fa2076cfc3f18040d0b25dc29b5 GIT binary patch literal 423 zcmeYb3HD`RVc=!pVBoEX0tQY7;oRh$_~iVeRIB2W{JhkpqRixM2Ij=fA_o47g2cSk zVymRYqWH9aM(xYC@&vc&k}{L-T2R0c(mXmJTpM={U{AO+;W42sV$ElDk6kjA5g zK?WpQkY7}im{V+(nwJ7)$EOt~=B6?T!0k**O)1I;x=kD;lAE7YT##6vmkP2J!l;<@ zc3L-IvjUIn!j9YVzh6twjc7~aX*QZY?^r~}k~<-C$6^k>t4gTNc~tLSRBv;x<>#_* zFHcu%o)TaAxI#zcN#o=b_AfZ^`yIp^W^4))3Ip^WU$CJY5d!0Pn{FwQ{+7-363=gAiYyWQ-{OuSW_d|QJ F9sqS_zZ(Dm literal 0 HcmV?d00001