cottage fixes
parent
49b9ab890c
commit
f5250af557
65
cottages.lua
65
cottages.lua
|
@ -36,7 +36,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
if dg and dg.dungeon and #dg.dungeon > 1 then
|
if dg and dg.dungeon and #dg.dungeon > 1 then
|
||||||
local cur_dg = vector.new(dg.dungeon[#dg.dungeon])
|
local cur_dg = vector.new(dg.dungeon[#dg.dungeon])
|
||||||
witches.debug("dungeon registered of size " .. #dg.dungeon .. " at " ..minetest.pos_to_string(cur_dg))
|
witches.debug("dungeon registered of size " .. #dg.dungeon .. " at " ..minetest.pos_to_string(cur_dg))
|
||||||
-- check depth
|
-- check depth
|
||||||
local mindd = dungeon_cellar_depth_min or 2
|
local mindd = dungeon_cellar_depth_min or 2
|
||||||
local maxdd = dungeon_cellar_depth_max or 5 -- max dungeon depth
|
local maxdd = dungeon_cellar_depth_max or 5 -- max dungeon depth
|
||||||
local pos_ck = vector.new(vector.add(cur_dg, vector.new(0, maxdd, 0))) -- how close does the dungeon need to be?
|
local pos_ck = vector.new(vector.add(cur_dg, vector.new(0, maxdd, 0))) -- how close does the dungeon need to be?
|
||||||
|
@ -128,7 +128,7 @@ function witches.grounding(pos, vol_vec, required_list, exception_list,
|
||||||
local protected_area = minetest.is_area_protected(ck_pos1, ck_pos2, "", 2)
|
local protected_area = minetest.is_area_protected(ck_pos1, ck_pos2, "", 2)
|
||||||
|
|
||||||
if #exceptions and #exceptions >= 1 then
|
if #exceptions and #exceptions >= 1 then
|
||||||
|
|
||||||
witches.debug("exceptions count = " .. #exceptions.." at "..minetest.pos_to_string(pos))
|
witches.debug("exceptions count = " .. #exceptions.." at "..minetest.pos_to_string(pos))
|
||||||
return
|
return
|
||||||
elseif protected_area then
|
elseif protected_area then
|
||||||
|
@ -257,7 +257,7 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
|
||||||
-- minetest.set_node(pos, {name = wp.foundation_nodes[math.random(#wp.foundation_nodes)]})
|
-- minetest.set_node(pos, {name = wp.foundation_nodes[math.random(#wp.foundation_nodes)]})
|
||||||
local pos_ck = vector.new(pos.x, pos.y - 10, pos.z)
|
local pos_ck = vector.new(pos.x, pos.y - 10, pos.z)
|
||||||
local pillars = minetest.find_nodes_in_area(pos, pos_ck,
|
local pillars = minetest.find_nodes_in_area(pos, pos_ck,
|
||||||
{"group:liquid", "air"})
|
{"group:liquid", "air","default:snow"})
|
||||||
minetest.bulk_set_node(pillars, {
|
minetest.bulk_set_node(pillars, {
|
||||||
name = wp.foundation_nodes[math.random(#wp.foundation_nodes)]
|
name = wp.foundation_nodes[math.random(#wp.foundation_nodes)]
|
||||||
})
|
})
|
||||||
|
@ -319,15 +319,14 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
|
||||||
-- minetest.set_node(vector.new(pos.x, pos.y - 1, pos.z), {name = root_node})
|
-- minetest.set_node(vector.new(pos.x, pos.y - 1, pos.z), {name = root_node})
|
||||||
local pos_ck = vector.new(pos.x, pos.y - 10, pos.z)
|
local pos_ck = vector.new(pos.x, pos.y - 10, pos.z)
|
||||||
local pillars = minetest.find_nodes_in_area(pos, pos_ck,
|
local pillars = minetest.find_nodes_in_area(pos, pos_ck,
|
||||||
{"group:liquid", "air"})
|
{"group:liquid", "air","default:snow"})
|
||||||
minetest.bulk_set_node(pillars, {name = wall_node})
|
minetest.bulk_set_node(pillars, {name = wall_node})
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--chance of porch bushes
|
--chance of porch bushes
|
||||||
|
|
||||||
|
|
||||||
for i = 1, #pcn do
|
for i = 1, #pcn do
|
||||||
if mr(1,2) == 1 then
|
if mr(1,2) == 1 then
|
||||||
local pos = vector.new(pcn[i].x, pcn[i].y + 1, pcn[i].z)
|
local pos = vector.new(pcn[i].x, pcn[i].y + 1, pcn[i].z)
|
||||||
|
@ -338,8 +337,6 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
|
||||||
bush_growth(pos)
|
bush_growth(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local treecn = {
|
local treecn = {
|
||||||
|
|
||||||
|
@ -352,31 +349,30 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
|
||||||
---this check fails without "minetest" game, why!?
|
---this check fails without "minetest" game, why!?
|
||||||
local tree_pos = treecn[math.random(#treecn)]
|
local tree_pos = treecn[math.random(#treecn)]
|
||||||
local tree_pos2 = treecn[math.random(#treecn)]
|
local tree_pos2 = treecn[math.random(#treecn)]
|
||||||
|
|
||||||
local root_pos = vector.new(tree_pos)
|
local root_pos = vector.new(tree_pos)
|
||||||
local tree_var = wp.tree_types[math.random(#wp.tree_types)]
|
local tree_var = wp.tree_types[math.random(#wp.tree_types)]
|
||||||
|
|
||||||
-- print("spawning "..tree_var )
|
-- print("spawning "..tree_var )
|
||||||
root_pos.y = root_pos.y - 1
|
root_pos.y = root_pos.y - 1
|
||||||
--minetest.spawn_tree(tree_pos, tree_var)
|
--minetest.spawn_tree(tree_pos, tree_var)
|
||||||
|
|
||||||
local tree_growth = wp.default_tree_types[math.random(#wp.default_tree_types)]
|
local tree_growth = wp.default_tree_types[math.random(#wp.default_tree_types)]
|
||||||
tree_growth(tree_pos)
|
tree_growth(tree_pos)
|
||||||
if vector.equals(tree_pos, tree_pos2) then
|
if vector.equals(tree_pos, tree_pos2) then
|
||||||
else
|
else
|
||||||
tree_growth(tree_pos2)
|
tree_growth(tree_pos2)
|
||||||
end
|
end
|
||||||
-- minetest.set_node(root_pos, {name = root_node})
|
-- minetest.set_node(root_pos, {name = root_node})
|
||||||
local pos_ck = vector.new(tree_pos.x, tree_pos.y - 10, tree_pos.z)
|
local pos_ck = vector.new(tree_pos.x, tree_pos.y - 10, tree_pos.z)
|
||||||
local roots = minetest.find_nodes_in_area(tree_pos, pos_ck,
|
local roots = minetest.find_nodes_in_area(tree_pos, pos_ck,
|
||||||
{"group:liquid", "air"})
|
{"group:liquid", "air","default:snow"})
|
||||||
minetest.bulk_set_node(roots, {name = root_node})
|
minetest.bulk_set_node(roots, {name = root_node})
|
||||||
|
|
||||||
if vector.equals(tree_pos, tree_pos2) then
|
if vector.equals(tree_pos, tree_pos2) then
|
||||||
else
|
else
|
||||||
local pos_ck = vector.new(tree_pos2.x, tree_pos2.y - 10, tree_pos2.z)
|
local pos_ck = vector.new(tree_pos2.x, tree_pos2.y - 10, tree_pos2.z)
|
||||||
local roots = minetest.find_nodes_in_area(tree_pos2, pos_ck,
|
local roots = minetest.find_nodes_in_area(tree_pos2, pos_ck,
|
||||||
{"group:liquid", "air"})
|
{"group:liquid", "air","default:snow"})
|
||||||
minetest.bulk_set_node(roots, {name = root_node})
|
minetest.bulk_set_node(roots, {name = root_node})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -473,7 +469,24 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
|
||||||
table.insert(wall_plan,
|
table.insert(wall_plan,
|
||||||
{pos = pos, dir = dir, facedir = facedir, walldir = 13})
|
{pos = pos, dir = dir, facedir = facedir, walldir = 13})
|
||||||
end
|
end
|
||||||
|
-- drop foundation walls
|
||||||
|
local fpl = table.copy(wall_plan)
|
||||||
|
|
||||||
|
for i = 1, #fpl do
|
||||||
|
fpl[i].pos.y = fpl[i].pos.y - 2
|
||||||
|
-- minetest.set_node(pos, {name = wall_node})
|
||||||
|
-- minetest.set_node(vector.new(pos.x, pos.y - 1, pos.z), {name = root_node})
|
||||||
|
local fpl_ck = vector.new(fpl[i].pos.x, fpl[i].pos.y - math.random(1,dungeon_cellar_depth_max), fpl[i].pos.z)
|
||||||
|
local fdepth = minetest.find_nodes_in_area(fpl[i].pos,fpl_ck, {"group:liquid", "air","default:snow"})
|
||||||
|
|
||||||
|
minetest.bulk_set_node(fdepth, {
|
||||||
|
name = window_node,
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
param2 = fpl[i].pos.walldir
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
--- now raise walls...
|
||||||
for h = 1, wp.wall_height do
|
for h = 1, wp.wall_height do
|
||||||
for i = 1, #wall_plan do
|
for i = 1, #wall_plan do
|
||||||
minetest.set_node(wall_plan[i].pos, {
|
minetest.set_node(wall_plan[i].pos, {
|
||||||
|
@ -800,15 +813,15 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
|
||||||
meta:set_string("owner", secret_name)
|
meta:set_string("owner", secret_name)
|
||||||
meta:set_string("infotext",
|
meta:set_string("infotext",
|
||||||
"Sealed chest of " .. secret_name)
|
"Sealed chest of " .. secret_name)
|
||||||
else
|
else
|
||||||
meta:set_string("owner", minetest.pos_to_string(f_pos1))
|
meta:set_string("owner", minetest.pos_to_string(f_pos1))
|
||||||
meta:set_string("secret_name", minetest.pos_to_string(f_pos1))
|
meta:set_string("secret_name", minetest.pos_to_string(f_pos1))
|
||||||
meta:set_string("infotext",
|
meta:set_string("infotext",
|
||||||
"This chest is magically sealed!")
|
"This chest is magically sealed!")
|
||||||
witches.debug("Unclaimed chest: "..minetest.pos_to_string(f_pos1))
|
witches.debug("Unclaimed chest: "..minetest.pos_to_string(f_pos1))
|
||||||
witch_spawn_pos = vector.new(f_pos1)
|
witch_spawn_pos = vector.new(f_pos1)
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.get_modpath("fireflies") then
|
if minetest.get_modpath("fireflies") then
|
||||||
inv:add_item("main", {name = "fireflies:bug_net"})
|
inv:add_item("main", {name = "fireflies:bug_net"})
|
||||||
end
|
end
|
||||||
|
@ -823,7 +836,7 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
|
||||||
inv:add_item("main", {name = "witches:bucket", count=1})
|
inv:add_item("main", {name = "witches:bucket", count=1})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
elseif f_name ~= bed then
|
elseif f_name ~= bed then
|
||||||
minetest.set_node(f_pos1, {
|
minetest.set_node(f_pos1, {
|
||||||
name = f_name,
|
name = f_name,
|
||||||
|
@ -839,7 +852,7 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
|
||||||
param2 = f_facedir1
|
param2 = f_facedir1
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -907,7 +920,7 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
|
||||||
local rfaz = math.floor(rfarea.z / 2)
|
local rfaz = math.floor(rfarea.z / 2)
|
||||||
local rfax = math.floor(rfarea.x / 2)
|
local rfax = math.floor(rfarea.x / 2)
|
||||||
if math.random() < 0.5 then
|
if math.random() < 0.5 then
|
||||||
|
local step_var = mr(1,3)
|
||||||
local midpoint = (rfarea.z + 1) / 2
|
local midpoint = (rfarea.z + 1) / 2
|
||||||
local gmp = rfarea.z - 1
|
local gmp = rfarea.z - 1
|
||||||
for i = 1, midpoint do
|
for i = 1, midpoint do
|
||||||
|
@ -1249,21 +1262,21 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
|
||||||
local cottage_area = {c_area1, c_area2}
|
local cottage_area = {c_area1, c_area2}
|
||||||
local cottage_va = VoxelArea:new{MinEdge = c_area1, MaxEdge = c_area2}
|
local cottage_va = VoxelArea:new{MinEdge = c_area1, MaxEdge = c_area2}
|
||||||
-- print(mts(VoxelArea))
|
-- print(mts(VoxelArea))
|
||||||
|
--[[
|
||||||
if witch_spawn_pos and mobs:add_mob(witch_spawn_pos,{
|
if witch_spawn_pos and mobs:add_mob(witch_spawn_pos,{
|
||||||
name = "witches:witch_cottage",
|
name = "witches:witch_cottage",
|
||||||
ignore_count = true
|
ignore_count = true
|
||||||
})
|
})
|
||||||
then
|
then
|
||||||
witches.debug("SUCCESS: spawning cottage witch")
|
witches.debug("SUCCESS: spawning cottage witch")
|
||||||
else
|
else
|
||||||
witches.debug("FAILED: spawning cottage witch"..minetest.pos_to_string(witch_spawn_pos))
|
witches.debug("FAILED: spawning cottage witch"..minetest.pos_to_string(witch_spawn_pos))
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
end
|
||||||
|
--]]
|
||||||
return l_pos
|
return l_pos
|
||||||
--return witches_spawn_pos
|
--return witches_spawn_pos
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue