cottage fixes

master
francisco athens 2022-09-03 23:16:53 -07:00
parent 49b9ab890c
commit f5250af557
1 changed files with 39 additions and 26 deletions

View File

@ -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,7 +319,7 @@ 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
@ -327,7 +327,6 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
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)
@ -339,8 +338,6 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
end end
end end
local treecn = { local treecn = {
vector.new(pcn[1].x - ps + mr(-1, 1), pos2.y - 1, pcn[1].z - ps + mr(-1, 1)), vector.new(pcn[1].x - ps + mr(-1, 1), pos2.y - 1, pcn[1].z - ps + mr(-1, 1)),
@ -352,7 +349,6 @@ 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)]
@ -369,14 +365,14 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
-- 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, {
@ -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,7 +1262,7 @@ 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
@ -1260,7 +1273,7 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
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