forked from Mineclonia/Mineclonia
Add command to spawn large ruined portal
This commit is contained in:
parent
d8d3f8364d
commit
8fa8a6fe37
|
@ -89,6 +89,8 @@ mcl_structures.call_struct = function(pos, struct_style, rotation, pr)
|
|||
return mcl_structures.generate_end_exit_portal(pos, rotation)
|
||||
elseif struct_style == "end_portal_shrine" then
|
||||
return mcl_structures.generate_end_portal_shrine(pos, rotation, pr)
|
||||
elseif struct_style == "ruined_portal_large" then
|
||||
return mcl_structures.generate_ruined_portal_large(pos, rotation, pr)
|
||||
elseif struct_style == "ruined_portal_small" then
|
||||
return mcl_structures.generate_ruined_portal_small(pos, rotation, pr)
|
||||
end
|
||||
|
@ -406,7 +408,7 @@ mcl_structures.generate_end_portal_shrine = function(pos, rotation, pr)
|
|||
mcl_structures.place_schematic(newpos, path, "0", nil, true, nil, shrine_placement_callback, pr)
|
||||
end
|
||||
|
||||
local function ruined_portal_small_callback(p1, p2, size, rotation, pr)
|
||||
local function ruined_portal_callback(p1, p2, size, rotation, pr)
|
||||
local biome_data = minetest.get_biome_data(p1)
|
||||
local biome_is_cold = (biome_data.heat < 15) or false
|
||||
local biome_name = minetest.get_biome_name(biome_data.biome)
|
||||
|
@ -656,7 +658,10 @@ local function ruined_portal_small_callback(p1, p2, size, rotation, pr)
|
|||
minetest.set_node(nodes[n], node)
|
||||
end
|
||||
-- Add loot into chests.
|
||||
local chests = minetest.find_nodes_in_area(p1, p2, "mcl_chests:chest_small")
|
||||
local chests = minetest.find_nodes_in_area(p1, p2, {
|
||||
"mcl_chests:chest_small",
|
||||
"mcl_chests:trapped_chest_small"
|
||||
})
|
||||
for c=1, #chests do
|
||||
local lootitems = mcl_loot.get_multi_loot({
|
||||
{
|
||||
|
@ -690,6 +695,21 @@ local function ruined_portal_small_callback(p1, p2, size, rotation, pr)
|
|||
end
|
||||
end
|
||||
|
||||
mcl_structures.generate_ruined_portal_large = function(pos, orientation, pr)
|
||||
-- Generates one out of 1 possible small ruined nether portals
|
||||
local newpos = {
|
||||
x = pos.x,
|
||||
y = pos.y - 10,
|
||||
z = pos.z
|
||||
}
|
||||
local portals = {
|
||||
"mcl_structures_ruined_portal_large_1.mts",
|
||||
}
|
||||
local r = pr:next(1, #portals)
|
||||
local path = minetest.get_modpath("mcl_structures") .. "/schematics/" .. portals[r]
|
||||
return mcl_structures.place_schematic(newpos, path, orientation, nil, true, nil, ruined_portal_callback, pr)
|
||||
end
|
||||
|
||||
mcl_structures.generate_ruined_portal_small = function(pos, orientation, pr)
|
||||
-- Generates one out of 5 possible small ruined nether portals
|
||||
local newpos = {
|
||||
|
@ -706,7 +726,7 @@ mcl_structures.generate_ruined_portal_small = function(pos, orientation, pr)
|
|||
}
|
||||
local r = pr:next(1, #portals)
|
||||
local path = minetest.get_modpath("mcl_structures") .. "/schematics/" .. portals[r]
|
||||
return mcl_structures.place_schematic(newpos, path, orientation, nil, true, nil, ruined_portal_small_callback, pr)
|
||||
return mcl_structures.place_schematic(newpos, path, orientation, nil, true, nil, ruined_portal_callback, pr)
|
||||
end
|
||||
|
||||
local function temple_placement_callback(p1, p2, size, rotation, pr)
|
||||
|
@ -839,7 +859,7 @@ end
|
|||
|
||||
-- Debug command
|
||||
minetest.register_chatcommand("spawnstruct", {
|
||||
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine | ruined_portal_small",
|
||||
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine | ruined_portal_large | ruined_portal_small",
|
||||
description = S("Generate a pre-defined structure near your position."),
|
||||
privs = {debug = true},
|
||||
func = function(name, param)
|
||||
|
@ -873,6 +893,8 @@ minetest.register_chatcommand("spawnstruct", {
|
|||
mcl_structures.generate_end_exit_portal(pos, rot, pr)
|
||||
elseif param == "end_portal_shrine" then
|
||||
mcl_structures.generate_end_portal_shrine(pos, rot, pr)
|
||||
elseif param == "ruined_portal_large" then
|
||||
mcl_structures.generate_ruined_portal_large(pos, rot, pr)
|
||||
elseif param == "ruined_portal_small" then
|
||||
mcl_structures.generate_ruined_portal_small(pos, rot, pr)
|
||||
elseif param == "" then
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue