Compare commits
1 Commits
master
...
mcl-struct
Author | SHA1 | Date |
---|---|---|
AFCMS | 3a2ce2feb8 |
|
@ -1,9 +1,7 @@
|
|||
mcl_structures.registered_structures = {}
|
||||
|
||||
local place_queue = {}
|
||||
local disabled_structures = minetest.settings:get("mcl_disabled_structures")
|
||||
if disabled_structures then disabled_structures = disabled_structures:split(",")
|
||||
else disabled_structures = {} end
|
||||
local disabled_structures = minetest.settings:get("mcl_disabled_structures"):split(",")
|
||||
|
||||
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||
local mob_cap_player = tonumber(minetest.settings:get("mcl_mob_cap_player")) or 75
|
||||
|
@ -13,11 +11,13 @@ local logging = minetest.settings:get_bool("mcl_logging_structures",true)
|
|||
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
|
||||
local modpath = minetest.get_modpath("mcl_structures")
|
||||
|
||||
local rotations = {
|
||||
"0",
|
||||
"90",
|
||||
"180",
|
||||
"270"
|
||||
"270",
|
||||
}
|
||||
|
||||
function mcl_structures.is_disabled(structname)
|
||||
|
@ -26,17 +26,21 @@ end
|
|||
|
||||
local function ecb_place(blockpos, action, calls_remaining, param)
|
||||
if calls_remaining >= 1 then return end
|
||||
minetest.place_schematic(param.pos, param.schematic, param.rotation, param.replacements, param.force_placement, param.flags)
|
||||
minetest.place_schematic(param.pos, param.schematic, param.rotation, param.replacements, param.force_placement,
|
||||
param.flags)
|
||||
if param.after_placement_callback and param.p1 and param.p2 then
|
||||
param.after_placement_callback(param.p1, param.p2, param.size, param.rotation, param.pr, param.callback_param)
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_structures.place_schematic(pos, schematic, rotation, replacements, force_placement, flags, after_placement_callback, pr, callback_param)
|
||||
function mcl_structures.place_schematic(pos, schematic, rotation, replacements, force_placement, flags,
|
||||
after_placement_callback, pr, callback_param)
|
||||
if type(schematic) ~= "table" and not mcl_util.file_exists(schematic) then
|
||||
minetest.log("warning", "[mcl_structures] schematic file " .. tostring(schematic) .. " does not exist.")
|
||||
return end
|
||||
local s = loadstring(minetest.serialize_schematic(schematic, "lua", {lua_use_comments = false, lua_num_indent_spaces = 0}) .. " return schematic")()
|
||||
return
|
||||
end
|
||||
local s = loadstring(minetest.serialize_schematic(schematic, "lua",
|
||||
{ lua_use_comments = false, lua_num_indent_spaces = 0 }) .. " return schematic")()
|
||||
if s and s.size then
|
||||
local x, z = s.size.x, s.size.z
|
||||
if rotation then
|
||||
|
@ -50,23 +54,32 @@ function mcl_structures.place_schematic(pos, schematic, rotation, replacements,
|
|||
x, z = z, x
|
||||
end
|
||||
end
|
||||
local p1 = {x=pos.x , y=pos.y , z=pos.z }
|
||||
local p2 = {x=pos.x+x-1, y=pos.y+s.size.y-1, z=pos.z+z-1}
|
||||
minetest.log("verbose", "[mcl_structures] size=" ..minetest.pos_to_string(s.size) .. ", rotation=" .. tostring(rotation) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2))
|
||||
local param = {pos=vector.new(pos), schematic=s, rotation=rotation, replacements=replacements, force_placement=force_placement, flags=flags, p1=p1, p2=p2, after_placement_callback = after_placement_callback, size=vector.new(s.size), pr=pr, callback_param=callback_param}
|
||||
local p1 = vector.copy(pos)
|
||||
local p2 = vector.offset(pos, x - 1, s.size.y - 1, z - 1)
|
||||
minetest.log("verbose",
|
||||
"[mcl_structures] size=" ..
|
||||
minetest.pos_to_string(s.size) ..
|
||||
", rotation=" ..
|
||||
tostring(rotation) .. ", emerge from " .. minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2))
|
||||
local param = { pos = vector.copy(pos), schematic = s, rotation = rotation, replacements = replacements,
|
||||
force_placement = force_placement, flags = flags, p1 = p1, p2 = p2,
|
||||
after_placement_callback = after_placement_callback, size = vector.copy(s.size), pr = pr,
|
||||
callback_param = callback_param }
|
||||
minetest.emerge_area(p1, p2, ecb_place, param)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_structures.get_struct(file)
|
||||
local localfile = modpath.."/schematics/"..file
|
||||
function mcl_structures.get_struct(filename)
|
||||
local localfile = modpath .. "/schematics/" .. filename
|
||||
local file, errorload = io.open(localfile, "rb")
|
||||
if errorload then
|
||||
minetest.log("error", "[mcl_structures] Could not open this struct: " .. localfile)
|
||||
return nil
|
||||
end
|
||||
|
||||
assert(file)
|
||||
|
||||
local allnode = file:read("*a")
|
||||
file:close()
|
||||
|
||||
|
@ -75,6 +88,7 @@ end
|
|||
|
||||
-- Call on_construct on pos.
|
||||
-- Useful to init chests from formspec.
|
||||
---@param pos Vector
|
||||
local function init_node_construct(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
|
@ -84,8 +98,13 @@ local function init_node_construct(pos)
|
|||
end
|
||||
return false
|
||||
end
|
||||
|
||||
mcl_structures.init_node_construct = init_node_construct
|
||||
|
||||
---@param p1 Vector
|
||||
---@param p2 Vector
|
||||
---@param loot table
|
||||
---@param pr PseudoRandom
|
||||
function mcl_structures.fill_chests(p1, p2, loot, pr)
|
||||
for it, lt in pairs(loot) do
|
||||
local nodes = minetest.find_nodes_in_area(p1, p2, it)
|
||||
|
@ -99,6 +118,9 @@ function mcl_structures.fill_chests(p1,p2,loot,pr)
|
|||
end
|
||||
end
|
||||
|
||||
---@param pos Vector
|
||||
---@param def table
|
||||
---@param pr PseudoRandom
|
||||
local function generate_loot(pos, def, pr)
|
||||
local hl = def.sidelen
|
||||
local p1 = vector.offset(pos, -hl, -hl, -hl)
|
||||
|
@ -106,6 +128,9 @@ local function generate_loot(pos, def, pr)
|
|||
if def.loot then mcl_structures.fill_chests(p1, p2, def.loot, pr) end
|
||||
end
|
||||
|
||||
---@param p1 Vector
|
||||
---@param p2 Vector
|
||||
---@param nodes string[]
|
||||
function mcl_structures.construct_nodes(p1, p2, nodes)
|
||||
local nn = minetest.find_nodes_in_area(p1, p2, nodes)
|
||||
for _, p in pairs(nn) do
|
||||
|
@ -113,11 +138,19 @@ function mcl_structures.construct_nodes(p1,p2,nodes)
|
|||
end
|
||||
end
|
||||
|
||||
---@param pos Vector
|
||||
---@param def table
|
||||
---@param pr PseudoRandom
|
||||
local function construct_nodes(pos, def, pr)
|
||||
return mcl_structures.construct_nodes(vector.offset(pos,-def.sidelen/2,0,-def.sidelen/2),vector.offset(pos,def.sidelen/2,def.sidelen,def.sidelen/2),def.construct_nodes)
|
||||
return mcl_structures.construct_nodes(
|
||||
vector.offset(pos, -def.sidelen / 2, 0, -def.sidelen / 2),
|
||||
vector.offset(pos, def.sidelen / 2, def.sidelen, def.sidelen / 2),
|
||||
def.construct_nodes
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
---@param pp Vector[]
|
||||
---@return integer
|
||||
function mcl_structures.find_lowest_y(pp)
|
||||
local y = 31000
|
||||
for _, p in pairs(pp) do
|
||||
|
@ -126,6 +159,8 @@ function mcl_structures.find_lowest_y(pp)
|
|||
return y
|
||||
end
|
||||
|
||||
---@param pp Vector[]
|
||||
---@return integer
|
||||
function mcl_structures.find_highest_y(pp)
|
||||
local y = -31000
|
||||
for _, p in pairs(pp) do
|
||||
|
@ -134,12 +169,18 @@ function mcl_structures.find_highest_y(pp)
|
|||
return y
|
||||
end
|
||||
|
||||
---@param nn Vector[]
|
||||
---@param pos Vector
|
||||
---@param plane? boolean
|
||||
---@param amnt? integer
|
||||
---@return Vector[]
|
||||
local function smooth_cube(nn, pos, plane, amnt)
|
||||
local r = {}
|
||||
local amnt = amnt or 9
|
||||
amnt = amnt or 9
|
||||
table.sort(nn, function(a, b)
|
||||
if false or plane then
|
||||
return vector.distance(vector.new(pos.x,0,pos.z), vector.new(a.x,0,a.z)) < vector.distance(vector.new(pos.x,0,pos.z), vector.new(b.x,0,b.z))
|
||||
return vector.distance(vector.new(pos.x, 0, pos.z), vector.new(a.x, 0, a.z)) <
|
||||
vector.distance(vector.new(pos.x, 0, pos.z), vector.new(b.x, 0, b.z))
|
||||
else
|
||||
return vector.distance(pos, a) < vector.distance(pos, b)
|
||||
end
|
||||
|
@ -148,24 +189,32 @@ local function smooth_cube(nn,pos,plane,amnt)
|
|||
return r
|
||||
end
|
||||
|
||||
---@param pos Vector
|
||||
---@param nn Vector[]
|
||||
---@param gn string
|
||||
---@return integer
|
||||
local function find_ground(pos, nn, gn)
|
||||
local r = 0
|
||||
for _, v in pairs(nn) do
|
||||
local p=vector.new(v)
|
||||
local p = vector.copy(v)
|
||||
repeat
|
||||
local n = minetest.get_node(p).name
|
||||
p = vector.offset(p, 0, -1, 0)
|
||||
until not n or n == "mcl_core:bedrock" or n == "ignore" or n == gn
|
||||
--minetest.log(tostring(pos.y - p.y))
|
||||
if pos.y - p.y > r then r = pos.y - p.y end
|
||||
if pos.y - p.y > r then
|
||||
r = pos.y - p.y
|
||||
end
|
||||
end
|
||||
return r
|
||||
end
|
||||
|
||||
local function get_foundation_nodes(ground_p1, ground_p2, pos, sidelen, node_stone)
|
||||
local replace = {"air","group:liquid","mcl_core:snow","group:tree","group:leaves","group:plant","grass_block","group:dirt"}
|
||||
local replace = { "air", "group:liquid", "mcl_core:snow", "group:tree", "group:leaves", "group:plant", "grass_block",
|
||||
"group:dirt" }
|
||||
local depth = find_ground(pos, minetest.find_nodes_in_area(ground_p1, ground_p2, replace), node_stone)
|
||||
local nn = smooth_cube(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-depth,0),replace),vector.offset(pos,0,-depth,0),true,sidelen * 64)
|
||||
local nn = smooth_cube(minetest.find_nodes_in_area(vector.offset(ground_p1, 0, -1, 0),
|
||||
vector.offset(ground_p2, 0, -depth, 0), replace), vector.offset(pos, 0, -depth, 0), true, sidelen * 64)
|
||||
local stone = {}
|
||||
local filler = {}
|
||||
local top = {}
|
||||
|
@ -207,7 +256,7 @@ local function foundation(ground_p1,ground_p2,pos,sidelen)
|
|||
end
|
||||
|
||||
local stone, filler, top, dust = get_foundation_nodes(ground_p1, ground_p2, pos, sidelen, node_stone)
|
||||
minetest.bulk_set_node(top,{name=node_top},node_stone)
|
||||
minetest.bulk_set_node(top, { name = node_top })
|
||||
|
||||
if node_dust then
|
||||
minetest.bulk_set_node(dust, { name = node_dust })
|
||||
|
@ -216,6 +265,7 @@ local function foundation(ground_p1,ground_p2,pos,sidelen)
|
|||
minetest.bulk_set_node(stone, { name = node_stone })
|
||||
end
|
||||
|
||||
--[[
|
||||
local function process_queue()
|
||||
if #place_queue < 1 then return end
|
||||
local s = table.remove(place_queue)
|
||||
|
@ -226,6 +276,7 @@ local function process_queue()
|
|||
end, s.pr)
|
||||
minetest.after(0.5, process_queue)
|
||||
end
|
||||
]]
|
||||
|
||||
function mcl_structures.spawn_mobs(mob, spawnon, p1, p2, pr, n, water)
|
||||
n = n or 1
|
||||
|
@ -270,10 +321,12 @@ function mcl_structures.place_structure(pos, def, pr, blockseed, rot)
|
|||
local solid = minetest.find_nodes_in_area(ground_p1, ground_p2, { "group:solid" })
|
||||
if #solid < (def.sidelen * def.sidelen) then
|
||||
if def.make_foundation then
|
||||
foundation(vector.offset(pos,-def.sidelen/2 - 3,-1,-def.sidelen/2 - 3),vector.offset(pos,def.sidelen/2 + 3,-1,def.sidelen/2 + 3),pos,def.sidelen)
|
||||
foundation(vector.offset(pos, -def.sidelen / 2 - 3, -1, -def.sidelen / 2 - 3),
|
||||
vector.offset(pos, def.sidelen / 2 + 3, -1, def.sidelen / 2 + 3), pos, def.sidelen)
|
||||
else
|
||||
if log_enabled then
|
||||
minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pp).." not placed. No solid ground.")
|
||||
minetest.log("warning",
|
||||
"[mcl_structures] " .. def.name .. " at " .. minetest.pos_to_string(pp) .. " not placed. No solid ground.")
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
@ -281,7 +334,8 @@ function mcl_structures.place_structure(pos, def, pr, blockseed, rot)
|
|||
end
|
||||
if def.on_place and not def.on_place(pos, def, pr, blockseed) then
|
||||
if log_enabled then
|
||||
minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pp).." not placed. Conditions not satisfied.")
|
||||
minetest.log("warning",
|
||||
"[mcl_structures] " .. def.name .. " at " .. minetest.pos_to_string(pp) .. " not placed. Conditions not satisfied.")
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
@ -291,16 +345,17 @@ function mcl_structures.place_structure(pos, def, pr, blockseed, rot)
|
|||
local file = def.filenames[r]
|
||||
if file then
|
||||
local rot = rotations[pr:next(1, #rotations)]
|
||||
local ap = function(pos,def,pr,blockseed) end
|
||||
local ap = function(_, _, _, _) end
|
||||
|
||||
if def.daughters then
|
||||
ap = function(pos,def,pr,blockseed)
|
||||
ap = function(pos, def, pr, _)
|
||||
for _, d in pairs(def.daughters) do
|
||||
local p = vector.add(pos, d.pos)
|
||||
local rot = d.rot or 0
|
||||
mcl_structures.place_schematic(p, d.files[pr:next(1,#d.files)], rot, nil, true, "place_center_x,place_center_z",function()
|
||||
if def.loot then generate_loot(pp,def,pr,blockseed) end
|
||||
if def.construct_nodes then construct_nodes(pp,def,pr,blockseed) end
|
||||
mcl_structures.place_schematic(p, d.files[pr:next(1, #d.files)], rot, nil, true, "place_center_x,place_center_z",
|
||||
function()
|
||||
if def.loot then generate_loot(pp, def, pr) end
|
||||
if def.construct_nodes then construct_nodes(pp, def, pr) end
|
||||
if def.after_place then
|
||||
def.after_place(pos, def, pr)
|
||||
end
|
||||
|
@ -310,12 +365,13 @@ function mcl_structures.place_structure(pos, def, pr, blockseed, rot)
|
|||
elseif def.after_place then
|
||||
ap = def.after_place
|
||||
end
|
||||
mcl_structures.place_schematic(pp, file, rot, def.replacements, true, "place_center_x,place_center_z",function(p1, p2, size, rotation)
|
||||
mcl_structures.place_schematic(pp, file, rot, def.replacements, true, "place_center_x,place_center_z",
|
||||
function(p1, p2, size, rotation)
|
||||
if not def.daughters then
|
||||
if def.loot then generate_loot(pp,def,pr,blockseed) end
|
||||
if def.construct_nodes then construct_nodes(pp,def,pr,blockseed) end
|
||||
if def.loot then generate_loot(pp, def, pr) end
|
||||
if def.construct_nodes then construct_nodes(pp, def, pr) end
|
||||
end
|
||||
return ap(pp,def,pr,blockseed,p1,p2,size,rotation)
|
||||
return ap(pp, def, pr, blockseed)
|
||||
end, pr)
|
||||
if log_enabled then
|
||||
minetest.log("action", "[mcl_structures] " .. def.name .. " placed at " .. minetest.pos_to_string(pp))
|
||||
|
@ -324,8 +380,8 @@ function mcl_structures.place_structure(pos, def, pr, blockseed, rot)
|
|||
end
|
||||
elseif def.place_func and def.place_func(pp, def, pr, blockseed) then
|
||||
if not def.after_place or (def.after_place and def.after_place(pp, def, pr, blockseed)) then
|
||||
if def.loot then generate_loot(pp,def,pr,blockseed) end
|
||||
if def.construct_nodes then construct_nodes(pp,def,pr,blockseed) end
|
||||
if def.loot then generate_loot(pp, def, pr) end
|
||||
if def.construct_nodes then construct_nodes(pp, def, pr) end
|
||||
if log_enabled then
|
||||
minetest.log("action", "[mcl_structures] " .. def.name .. " placed at " .. minetest.pos_to_string(pp))
|
||||
end
|
||||
|
@ -366,7 +422,8 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it
|
|||
y_max = def.y_max,
|
||||
y_min = def.y_min
|
||||
})
|
||||
minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups,sunlight_propagates = true,})
|
||||
minetest.register_node(":" .. structblock,
|
||||
{ drawtype = "airlike", walkable = false, pointable = false, groups = sbgroups, sunlight_propagates = true, })
|
||||
def.structblock = structblock
|
||||
def.deco_id = minetest.get_decoration_id("mcl_structures:deco_" .. name)
|
||||
minetest.set_gen_notify({ decoration = true }, { def.deco_id })
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
---@param pos Vector
|
||||
---@param def table
|
||||
---@param pr PseudoRandom
|
||||
local function temple_placement_callback(pos, def, pr)
|
||||
local hl = def.sidelen / 2
|
||||
local p1 = vector.offset(pos, -hl, -hl, -hl)
|
||||
|
@ -9,10 +11,10 @@ local function temple_placement_callback(pos,def, pr)
|
|||
-- Delete cacti leftovers:
|
||||
local cactus_nodes = minetest.find_nodes_in_area_under_air(p1, p2, "mcl_core:cactus")
|
||||
if cactus_nodes and #cactus_nodes > 0 then
|
||||
for _, pos in pairs(cactus_nodes) do
|
||||
local node_below = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
for _, cpos in pairs(cactus_nodes) do
|
||||
local node_below = minetest.get_node(vector.offset(cpos, 0, -1, 0))
|
||||
if node_below and node_below.name == "mcl_core:sandstone" then
|
||||
minetest.swap_node(pos, {name="air"})
|
||||
minetest.swap_node(cpos, { name = "air" })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -81,6 +83,7 @@ mcl_structures.register_structure("desert_temple",{
|
|||
{ itemstring = "mcl_core:sand", weight = 10, amount_min = 1, amount_max = 8 },
|
||||
{ itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max = 8 },
|
||||
}
|
||||
}}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
local spawnon = { "mcl_end:purpur_block" }
|
||||
|
@ -28,7 +27,8 @@ mcl_structures.register_structure("end_shipwreck",{
|
|||
filenames = {
|
||||
modpath .. "/schematics/mcl_structures_end_shipwreck_1.mts",
|
||||
},
|
||||
construct_nodes = {"mcl_chests:ender_chest_small","mcl_chests:ender_chest","mcl_brewing:stand_000","mcl_chests:violet_shulker_box_small"},
|
||||
construct_nodes = { "mcl_chests:ender_chest_small", "mcl_chests:ender_chest", "mcl_brewing:stand_000",
|
||||
"mcl_chests:violet_shulker_box_small" },
|
||||
after_place = function(pos, def, pr)
|
||||
local fr = minetest.find_node_near(pos, def.sidelen, { "mcl_itemframes:item_frame" })
|
||||
if fr then
|
||||
|
@ -61,20 +61,34 @@ mcl_structures.register_structure("end_shipwreck",{
|
|||
{ itemstring = "mcl_books:book", weight = 1, func = function(stack, pr)
|
||||
mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr)
|
||||
end },
|
||||
{ itemstring = "mcl_tools:pick_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_tools:shovel_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_tools:sword_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:helmet_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:chestplate_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:leggings_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:boots_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_tools:pick_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_tools:shovel_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_tools:sword_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:helmet_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:chestplate_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:leggings_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:boots_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_tools:pick_iron_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_tools:shovel_iron_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_tools:sword_iron_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:helmet_iron_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:chestplate_iron_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:leggings_iron_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:boots_iron_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_tools:pick_diamond_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_tools:shovel_diamond_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_tools:sword_diamond_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:helmet_diamond_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:chestplate_diamond_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:leggings_diamond_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:boots_diamond_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 },
|
||||
{ itemstring = "mcl_mobitems:iron_horse_armor", weight = 1, },
|
||||
{ itemstring = "mcl_mobitems:gold_horse_armor", weight = 1, },
|
||||
|
@ -99,7 +113,8 @@ mcl_structures.register_structure("end_boat",{
|
|||
modpath .. "/schematics/mcl_structures_end_boat.mts",
|
||||
},
|
||||
after_place = spawn_shulkers,
|
||||
construct_nodes = {"mcl_chests:ender_chest_small","mcl_chests:ender_chest","mcl_brewing:stand_000","mcl_chests:violet_shulker_box_small"},
|
||||
construct_nodes = { "mcl_chests:ender_chest_small", "mcl_chests:ender_chest", "mcl_brewing:stand_000",
|
||||
"mcl_chests:violet_shulker_box_small" },
|
||||
loot = {
|
||||
["mcl_chests:chest_small"] = { {
|
||||
stacks_min = 2,
|
||||
|
@ -112,18 +127,30 @@ mcl_structures.register_structure("end_boat",{
|
|||
{ itemstring = "mcl_core:diamond", weight = 3, amount_min = 2, amount_max = 7 },
|
||||
{ itemstring = "mcl_mobitems:saddle", weight = 3, },
|
||||
{ itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 },
|
||||
{ itemstring = "mcl_tools:pick_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_tools:shovel_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_tools:sword_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:helmet_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:chestplate_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:leggings_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:boots_iron_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_tools:pick_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_tools:shovel_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:helmet_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:leggings_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_armor:boots_diamond_enchanted", weight = 3,func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_tools:pick_iron_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_tools:shovel_iron_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_tools:sword_iron_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:helmet_iron_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:chestplate_iron_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:leggings_iron_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:boots_iron_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_tools:pick_diamond_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_tools:shovel_diamond_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:helmet_diamond_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:leggings_diamond_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:boots_diamond_enchanted", weight = 3,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 },
|
||||
{ itemstring = "mcl_mobitems:iron_horse_armor", weight = 1, },
|
||||
{ itemstring = "mcl_mobitems:gold_horse_armor", weight = 1, },
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
|
||||
mcl_structures.register_structure("end_spawn_obsidian_platform", {
|
||||
static_pos = { mcl_vars.mg_end_platform_pos },
|
||||
place_func = function(pos, def, pr)
|
||||
local obby = minetest.find_nodes_in_area(vector.offset(pos,-2,0,-2),vector.offset(pos,2,0,2),{"air","mcl_end:end_stone"})
|
||||
local air = minetest.find_nodes_in_area(vector.offset(pos,-2,1,-2),vector.offset(pos,2,3,2),{"air","mcl_end:end_stone"})
|
||||
local obby = minetest.find_nodes_in_area(vector.offset(pos, -2, 0, -2), vector.offset(pos, 2, 0, 2),
|
||||
{ "air", "mcl_end:end_stone" })
|
||||
local air = minetest.find_nodes_in_area(vector.offset(pos, -2, 1, -2), vector.offset(pos, 2, 3, 2),
|
||||
{ "air", "mcl_end:end_stone" })
|
||||
minetest.bulk_set_node(obby, { name = "mcl_core:obsidian" })
|
||||
minetest.bulk_set_node(air, { name = "air" })
|
||||
return true
|
||||
|
@ -65,7 +66,8 @@ local function get_tower(p,h,tbl)
|
|||
end
|
||||
|
||||
local function make_endspike(pos, width, height)
|
||||
local nn = minetest.find_nodes_in_area(vector.offset(pos,-width/2,0,-width/2),vector.offset(pos,width/2,0,width/2),{"air","group:solid"})
|
||||
local nn = minetest.find_nodes_in_area(vector.offset(pos, -width / 2, 0, -width / 2),
|
||||
vector.offset(pos, width / 2, 0, width / 2), { "air", "group:solid" })
|
||||
table.sort(nn, function(a, b)
|
||||
return vector.distance(pos, a) < vector.distance(pos, b)
|
||||
end)
|
||||
|
@ -77,7 +79,7 @@ local function make_endspike(pos,width,height)
|
|||
return vector.offset(pos, 0, height, 0)
|
||||
end
|
||||
|
||||
function make_cage(pos,width)
|
||||
local function make_cage(pos, width)
|
||||
local nodes = {}
|
||||
local nodes2 = {}
|
||||
local r = math.max(1, math.floor(width / 2) - 2)
|
||||
|
@ -85,7 +87,9 @@ function make_cage(pos,width)
|
|||
if x == r or x == -r or z == r or z == -r then
|
||||
table.insert(nodes, vector.add(pos, vector.new(x, y, z)))
|
||||
end
|
||||
end end end
|
||||
end
|
||||
end
|
||||
end
|
||||
if xpanes then
|
||||
minetest.bulk_set_node(nodes, { name = "xpanes:bar_flat" })
|
||||
for _, p in pairs(nodes) do
|
||||
|
@ -97,7 +101,8 @@ end
|
|||
local function get_points_on_circle(pos, r, n)
|
||||
local rt = {}
|
||||
for i = 1, n do
|
||||
table.insert(rt,vector.offset(pos,r * math.cos(((i-1)/n) * (2*math.pi)),0, r* math.sin(((i-1)/n) * (2*math.pi)) ))
|
||||
table.insert(rt, vector.offset(pos, r * math.cos(((i - 1) / n) * (2 * math.pi)), 0,
|
||||
r * math.sin(((i - 1) / n) * (2 * math.pi))))
|
||||
end
|
||||
return rt
|
||||
end
|
||||
|
|
|
@ -7,10 +7,11 @@ local adjacents = {
|
|||
vector.new(0, -1, 0)
|
||||
}
|
||||
|
||||
---@param pos Vector
|
||||
---@param node node
|
||||
local function set_node_no_bedrock(pos, node)
|
||||
local n = minetest.get_node(pos)
|
||||
if n.name == "mcl_core:bedrock" then return end
|
||||
return minetest.set_node(pos,node)
|
||||
if minetest.get_node(pos).name == "mcl_core:bedrock" then return end
|
||||
minetest.set_node(pos, node)
|
||||
end
|
||||
|
||||
local function makegeode(pos, def, pr)
|
||||
|
@ -43,7 +44,8 @@ local function makegeode(pos,def,pr)
|
|||
set_node_no_bedrock(v, { name = "mcl_amethyst:budding_amethyst_block" })
|
||||
end
|
||||
all_amethyst = false
|
||||
elseif an.name ~= "mcl_amethyst:amethyst_block" and an.name ~= "air" and an.name ~= "mcl_amethyst:budding_amethyst_block" then
|
||||
elseif an.name ~= "mcl_amethyst:amethyst_block" and an.name ~= "air" and
|
||||
an.name ~= "mcl_amethyst:budding_amethyst_block" then
|
||||
all_amethyst = false
|
||||
end
|
||||
end
|
||||
|
@ -52,18 +54,19 @@ local function makegeode(pos,def,pr)
|
|||
end
|
||||
|
||||
for _, v in pairs(calcite) do
|
||||
for _,vv in pairs(minetest.find_nodes_in_area(vector.offset(v,-1,-1,-1),vector.offset(v,1,1,1),{"group:material_stone"})) do
|
||||
for _, vv in pairs(minetest.find_nodes_in_area(vector.offset(v, -1, -1, -1), vector.offset(v, 1, 1, 1),
|
||||
{ "group:material_stone" })) do
|
||||
set_node_no_bedrock(vv, { name = "mcl_blackstone:basalt_smooth" })
|
||||
end
|
||||
end
|
||||
|
||||
for k,v in pairs(minetest.find_nodes_in_area_under_air(p1,p2,{"mcl_amethyst:amethyst_block","mcl_amethyst:budding_amethyst_block"})) do
|
||||
for k, v in pairs(minetest.find_nodes_in_area_under_air(p1, p2,
|
||||
{ "mcl_amethyst:amethyst_block", "mcl_amethyst:budding_amethyst_block" })) do
|
||||
local r = pr:next(1, 50)
|
||||
if r < 10 then
|
||||
set_node_no_bedrock(vector.offset(v, 0, 1, 0), { name = "mcl_amethyst:amethyst_cluster", param2 = 1 })
|
||||
end
|
||||
end
|
||||
return true
|
||||
end)
|
||||
return true
|
||||
end
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
---@param pos Vector
|
||||
---@param pr PseudoRandom
|
||||
---@return boolean|nil
|
||||
---@return string
|
||||
function mcl_structures.generate_igloo_top(pos, pr)
|
||||
-- Furnace does ot work atm because apparently meta is not set. Need a bit of help with fixing this for furnaces, bookshelves, and brewing stands.
|
||||
local newpos = {x=pos.x,y=pos.y-2,z=pos.z}
|
||||
local newpos = vector.offset(pos, 0, -2, 0)
|
||||
local path = modpath .. "/schematics/mcl_structures_igloo_top.mts"
|
||||
local rotation = tostring(pr:next(0, 3) * 90)
|
||||
return mcl_structures.place_schematic(newpos, path, rotation, nil, true, nil, function()
|
||||
|
@ -32,6 +35,10 @@ local function spawn_mobs(p1,p2,vi,zv)
|
|||
end
|
||||
end
|
||||
|
||||
---@param pos Vector
|
||||
---@param orientation any
|
||||
---@param loot any
|
||||
---@param pr PseudoRandom
|
||||
function mcl_structures.generate_igloo_basement(pos, orientation, loot, pr)
|
||||
-- TODO: Add monster eggs
|
||||
local path = modpath .. "/schematics/mcl_structures_igloo_basement.mts"
|
||||
|
@ -44,6 +51,9 @@ function mcl_structures.generate_igloo_basement(pos, orientation, loot, pr)
|
|||
end, pr)
|
||||
end
|
||||
|
||||
---@param pos Vector
|
||||
---@param def table
|
||||
---@param pr PseudoRandom
|
||||
function mcl_structures.generate_igloo(pos, def, pr)
|
||||
-- Place igloo
|
||||
local success, rotation = mcl_structures.generate_igloo_top(pos, pr)
|
||||
|
@ -67,26 +77,26 @@ function mcl_structures.generate_igloo(pos, def, pr)
|
|||
return success
|
||||
end
|
||||
local depth = pr:next(19, buffer)
|
||||
local bpos = {x=pos.x, y=pos.y-depth, z=pos.z}
|
||||
local bpos = vector.offset(pos, 0, -depth, 0)
|
||||
-- trapdoor position
|
||||
local tpos
|
||||
local dir, tdir
|
||||
if rotation == "0" then
|
||||
dir = {x=-1, y=0, z=0}
|
||||
tdir = {x=1, y=0, z=0}
|
||||
tpos = {x=pos.x+7, y=pos.y-2, z=pos.z+3}
|
||||
dir = vector.new(-1, 0, 0)
|
||||
tdir = vector.new(1, 0, 0)
|
||||
tpos = vector.offset(pos, 7, -2, 3)
|
||||
elseif rotation == "90" then
|
||||
dir = {x=0, y=0, z=-1}
|
||||
tdir = {x=0, y=0, z=-1}
|
||||
tpos = {x=pos.x+3, y=pos.y-2, z=pos.z+1}
|
||||
dir = vector.new(0, 0, -1)
|
||||
tdir = vector.new(0, 0, -1)
|
||||
tpos = vector.offset(pos, 3, -2, 1)
|
||||
elseif rotation == "180" then
|
||||
dir = {x=1, y=0, z=0}
|
||||
tdir = {x=-1, y=0, z=0}
|
||||
tpos = {x=pos.x+1, y=pos.y-2, z=pos.z+3}
|
||||
dir = vector.new(1, 0, 0)
|
||||
tdir = vector.new(-1, 0, 0)
|
||||
tpos = vector.offset(pos, 1, -2, 3)
|
||||
elseif rotation == "270" then
|
||||
dir = {x=0, y=0, z=1}
|
||||
tdir = {x=0, y=0, z=1}
|
||||
tpos = {x=pos.x+3, y=pos.y-2, z=pos.z+7}
|
||||
dir = vector.new(0, 0, 1)
|
||||
tdir = vector.new(0, 0, 1)
|
||||
tpos = vector.offset(pos, 3, -2, 7)
|
||||
else
|
||||
return success
|
||||
end
|
||||
|
@ -109,14 +119,15 @@ function mcl_structures.generate_igloo(pos, def, pr)
|
|||
end
|
||||
minetest.set_node(pos, { name = brick })
|
||||
end
|
||||
|
||||
local ladder_param2 = minetest.dir_to_wallmounted(tdir)
|
||||
local real_depth = 0
|
||||
-- Check how deep we can actuall dig
|
||||
for y = 1, depth - 5 do
|
||||
real_depth = real_depth + 1
|
||||
local node = minetest.get_node({x=tpos.x,y=tpos.y-y,z=tpos.z})
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if not (def and def.walkable and def.liquidtype == "none" and def.is_ground_content) then
|
||||
local node = minetest.get_node(vector.offset(tpos, 0, -y, 0))
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
if not (ndef and ndef.walkable and ndef.liquidtype == "none" and ndef.is_ground_content) then
|
||||
bpos.y = tpos.y - y + 1
|
||||
break
|
||||
end
|
||||
|
@ -126,17 +137,17 @@ function mcl_structures.generate_igloo(pos, def, pr)
|
|||
end
|
||||
-- Generate ladder to basement
|
||||
for y = 1, real_depth - 1 do
|
||||
set_brick({x=tpos.x-1,y=tpos.y-y,z=tpos.z })
|
||||
set_brick({x=tpos.x+1,y=tpos.y-y,z=tpos.z })
|
||||
set_brick({x=tpos.x ,y=tpos.y-y,z=tpos.z-1})
|
||||
set_brick({x=tpos.x ,y=tpos.y-y,z=tpos.z+1})
|
||||
minetest.set_node({x=tpos.x,y=tpos.y-y,z=tpos.z}, {name="mcl_core:ladder", param2=ladder_param2})
|
||||
set_brick(vector.offset(tpos, -1, -y, 0))
|
||||
set_brick(vector.offset(tpos, 1, -y, 0))
|
||||
set_brick(vector.offset(tpos, 0, -y, -1))
|
||||
set_brick(vector.offset(tpos, 0, -y, 1))
|
||||
minetest.set_node(vector.offset(tpos, 0, -y, 0), { name = "mcl_core:ladder", param2 = ladder_param2 })
|
||||
end
|
||||
-- Place basement
|
||||
mcl_structures.generate_igloo_basement(bpos, rotation, def.loot, pr)
|
||||
-- Place hidden trapdoor
|
||||
minetest.after(5, function(tpos, dir)
|
||||
minetest.set_node(tpos, {name="mcl_doors:trapdoor", param2=20+minetest.dir_to_facedir(dir)}) -- TODO: more reliable param2
|
||||
minetest.after(5, function(tpos2, dir2)
|
||||
minetest.set_node(tpos2, { name = "mcl_doors:trapdoor", param2 = 20 + minetest.dir_to_facedir(dir2) }) -- TODO: more reliable param2
|
||||
end, tpos, dir)
|
||||
end
|
||||
return success
|
||||
|
|
|
@ -70,12 +70,16 @@ mcl_structures.register_structure("boulder",{
|
|||
mcl_structures.register_structure("ice_spike_small", {
|
||||
filenames = { modpath .. "/schematics/mcl_structures_ice_spike_small.mts" },
|
||||
}, true) --is spawned as a normal decoration. this is just for /spawnstruct
|
||||
|
||||
mcl_structures.register_structure("ice_spike_large", {
|
||||
sidelen = 6,
|
||||
filenames = { modpath .. "/schematics/mcl_structures_ice_spike_large.mts" },
|
||||
}, true) --is spawned as a normal decoration. this is just for /spawnstruct
|
||||
|
||||
-- Debug command
|
||||
|
||||
---Debug command
|
||||
---@param dir Vector
|
||||
---@return '"0"'|'"90"'|'"180"'|'"270"'
|
||||
local function dir_to_rotation(dir)
|
||||
local ax, az = math.abs(dir.x), math.abs(dir.z)
|
||||
if ax > az then
|
||||
|
@ -96,33 +100,39 @@ minetest.register_chatcommand("spawnstruct", {
|
|||
privs = { debug = true },
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then return end
|
||||
|
||||
if not player then
|
||||
return false, S("Player isn't online")
|
||||
end
|
||||
|
||||
local pos = player:get_pos()
|
||||
if not pos then return end
|
||||
pos = vector.round(pos)
|
||||
|
||||
local dir = minetest.yaw_to_dir(player:get_look_horizontal())
|
||||
|
||||
local rot = dir_to_rotation(dir)
|
||||
local pr = PseudoRandom(pos.x + pos.y + pos.z)
|
||||
|
||||
local errord = false
|
||||
local message = S("Structure placed.")
|
||||
local uknown_struct_message = S("Error: Unknown structure type. Please use “/spawnstruct <type>”.") ..
|
||||
"\n" .. S("Use /help spawnstruct to see a list of avaiable types.")
|
||||
|
||||
if param == "dungeon" and mcl_dungeons and mcl_dungeons.spawn_dungeon then
|
||||
mcl_dungeons.spawn_dungeon(pos, rot, pr)
|
||||
elseif param == "" then
|
||||
message = S("Error: No structure type given. Please use “/spawnstruct <type>”.")
|
||||
errord = true
|
||||
else
|
||||
for n,d in pairs(mcl_structures.registered_structures) do
|
||||
if n == param then
|
||||
mcl_structures.place_structure(pos,d,pr,math.random(),rot)
|
||||
return true,message
|
||||
end
|
||||
end
|
||||
message = S("Error: Unknown structure type. Please use “/spawnstruct <type>”.")
|
||||
if mcl_structures.registered_structures[param] then
|
||||
mcl_structures.place_structure(pos, mcl_structures.registered_structures[param], pr, math.random(), rot)
|
||||
else
|
||||
message = uknown_struct_message
|
||||
errord = true
|
||||
end
|
||||
minetest.chat_send_player(name, message)
|
||||
end
|
||||
|
||||
if errord then
|
||||
minetest.chat_send_player(name, S("Use /help spawnstruct to see a list of avaiable types."))
|
||||
return false, message
|
||||
else
|
||||
return true, message
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
mcl_structures.register_structure("jungle_temple", {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
local cold_oceans = {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||
--local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||
|
||||
local spawnon = { "mcl_core:stripped_oak", "mcl_stairs:slab_birchwood_top" }
|
||||
|
||||
|
@ -58,7 +57,8 @@ mcl_structures.register_structure("pillager_outpost",{
|
|||
items = {
|
||||
{ itemstring = "mcl_bows:crossbow" },
|
||||
}
|
||||
}}
|
||||
}
|
||||
}
|
||||
},
|
||||
after_place = function(p, def, pr)
|
||||
local p1 = vector.offset(p, -9, 0, -9)
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
---@param b Vector[]
|
||||
---@param c integer
|
||||
---@param pr PseudoRandom
|
||||
---@return Vector[]
|
||||
local function get_replacements(b, c, pr)
|
||||
local r = {}
|
||||
if not b then return r end
|
||||
for k,v in pairs(b) do
|
||||
for _, v in pairs(b) do
|
||||
if pr:next(1, 100) < c then table.insert(r, v) end
|
||||
end
|
||||
return r
|
||||
end
|
||||
|
||||
local def = {
|
||||
place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass","group:grass_block","group:sand","group:grass_block_snow","mcl_core:snow"},
|
||||
place_on = { "group:grass_block", "group:dirt", "mcl_core:dirt_with_grass", "group:grass_block", "group:sand",
|
||||
"group:grass_block_snow", "mcl_core:snow" },
|
||||
fill_ratio = 0.01,
|
||||
flags = "place_center_x, place_center_z, all_floors",
|
||||
solid_ground = true,
|
||||
|
@ -77,9 +82,13 @@ local def = {
|
|||
} }
|
||||
}
|
||||
}
|
||||
|
||||
mcl_structures.register_structure("ruined_portal_overworld", def)
|
||||
|
||||
local ndef = table.copy(def)
|
||||
ndef.y_min = mcl_vars.mg_lava_nether_max + 10
|
||||
ndef.y_max = mcl_vars.mg_nether_max - 15
|
||||
ndef.place_on = {"mcl_nether:netherrack","group:soul_block","mcl_blackstone:basalt,mcl_blackstone:blackstone","mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium"},
|
||||
ndef.place_on = { "mcl_nether:netherrack", "group:soul_block", "mcl_blackstone:basalt,mcl_blackstone:blackstone",
|
||||
"mcl_crimson:crimson_nylium", "mcl_crimson:warped_nylium" }
|
||||
|
||||
mcl_structures.register_structure("ruined_portal_nether", ndef)
|
||||
|
|
|
@ -2,9 +2,9 @@ local modname = minetest.get_current_modname()
|
|||
local modpath = minetest.get_modpath(modname)
|
||||
--local S = minetest.get_translator(modname)
|
||||
|
||||
local seed = minetest.get_mapgen_setting("seed")
|
||||
--local seed = minetest.get_mapgen_setting("seed")
|
||||
local water_level = minetest.get_mapgen_setting("water_level")
|
||||
local pr = PseudoRandom(seed)
|
||||
--local pr = PseudoRandom(seed)
|
||||
|
||||
--schematics by chmodsayshello
|
||||
local schems = {
|
||||
|
@ -130,13 +130,17 @@ mcl_structures.register_structure("shipwreck",{
|
|||
{ itemstring = "mcl_mobitems:rotten_flesh", weight = 5, amount_min = 5, amount_max = 24 },
|
||||
{ itemstring = "mcl_farming:potato_item", weight = 3, amount_min = 1, amount_max = 5 },
|
||||
{ itemstring = "mcl_armor:helmet_leather_enchanted", weight = 3, func = function(stack, pr)
|
||||
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end },
|
||||
mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" })
|
||||
end },
|
||||
{ itemstring = "mcl_armor:chestplate_leather_enchanted", weight = 3, func = function(stack, pr)
|
||||
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end },
|
||||
mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" })
|
||||
end },
|
||||
{ itemstring = "mcl_armor:leggings_leather_enchanted", weight = 3, func = function(stack, pr)
|
||||
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end },
|
||||
mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" })
|
||||
end },
|
||||
{ itemstring = "mcl_armor:boots_leather_enchanted", weight = 3, func = function(stack, pr)
|
||||
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end },
|
||||
mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" })
|
||||
end },
|
||||
--{ itemstring = "TODO:bamboo", weight = 2, amount_min = 1, amount_max = 3 },
|
||||
{ itemstring = "mcl_farming:pumpkin", weight = 2, amount_min = 1, amount_max = 3 },
|
||||
{ itemstring = "mcl_tnt:tnt", weight = 1, amount_min = 1, amount_max = 2 },
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||
|
@ -7,7 +6,8 @@ local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
|||
local function spawn_witch(p1, p2)
|
||||
local c = minetest.find_node_near(p1, 15, { "mcl_cauldrons:cauldron" })
|
||||
if c then
|
||||
local nn = minetest.find_nodes_in_area_under_air(vector.new(p1.x,c.y-1,p1.z),vector.new(p2.x,c.y-1,p2.z),{"mcl_core:sprucewood"})
|
||||
local nn = minetest.find_nodes_in_area_under_air(vector.new(p1.x, c.y - 1, p1.z), vector.new(p2.x, c.y - 1, p2.z),
|
||||
{ "mcl_core:sprucewood" })
|
||||
local witch
|
||||
if not peaceful then
|
||||
witch = minetest.add_entity(vector.offset(nn[math.random(#nn)], 0, 1, 0), "mobs_mc:witch"):get_luaentity()
|
||||
|
@ -23,6 +23,9 @@ local function spawn_witch(p1,p2)
|
|||
end
|
||||
end
|
||||
|
||||
---@param pos Vector
|
||||
---@param def table
|
||||
---@param pr PseudoRandom
|
||||
local function hut_placement_callback(pos, def, pr)
|
||||
local hl = def.sidelen / 2
|
||||
local p1 = vector.offset(pos, -hl, -hl, -hl)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||
--local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||
|
||||
local spawnon = { "mcl_deepslate:deepslate", "mcl_core:birchwood", "mcl_wool:red_carpet", "mcl_wool:brown_carpet" }
|
||||
|
||||
|
@ -39,7 +38,8 @@ mcl_structures.register_structure("woodland_cabin",{
|
|||
{ itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max = 8 },
|
||||
|
||||
{ itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 },
|
||||
}},{
|
||||
}
|
||||
}, {
|
||||
stacks_min = 1,
|
||||
stacks_max = 4,
|
||||
items = {
|
||||
|
@ -53,13 +53,15 @@ mcl_structures.register_structure("woodland_cabin",{
|
|||
{ itemstring = "mcl_core:iron_ingot", weight = 10, amount_min = 1, amount_max = 4 },
|
||||
{ itemstring = "mcl_buckets:bucket_empty", weight = 10, amount_min = 1, amount_max = 1 },
|
||||
{ itemstring = "mcl_core:gold_ingot", weight = 5, amount_min = 1, amount_max = 4 },
|
||||
}},{
|
||||
}
|
||||
}, {
|
||||
stacks_min = 1,
|
||||
stacks_max = 4,
|
||||
items = {
|
||||
--{ itemstring = "FIXME:lead", weight = 20, amount_min = 1, amount_max = 1 },
|
||||
{ itemstring = "mcl_mobs:nametag", weight = 2, amount_min = 1, amount_max = 3 },
|
||||
{ itemstring = "mcl_books:book", weight = 1, func = function(stack, pr)mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end },
|
||||
{ itemstring = "mcl_books:book", weight = 1,
|
||||
func = function(stack, pr) mcl_enchanting.enchant_uniform_randomly(stack, { "soul_speed" }, pr) end },
|
||||
{ itemstring = "mcl_armor:chestplate_chain", weight = 1, },
|
||||
{ itemstring = "mcl_armor:chestplate_diamond", weight = 1, },
|
||||
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2, },
|
||||
|
|
Loading…
Reference in New Issue