beds are against wall and gable window fix

master
francisco athens 2020-08-12 21:48:06 -07:00
parent 78cf4b79e2
commit d22437eaa9
2 changed files with 103 additions and 96 deletions

View File

@ -449,7 +449,6 @@ function witches.generate_cottage(pos1,pos2,params)
print("window:"..mtpts(window_pos[k]))
print("furniture:"..mtpts(f_pos1))
local dir1=vector.direction(f_pos1,v)
local dir2=vector.direction(v,f_pos1)
local f_facedir1 = minetest.dir_to_facedir(dir1)
@ -458,17 +457,23 @@ function witches.generate_cottage(pos1,pos2,params)
local f_name = furniture[f_num]
if f_name == "beds:bed" then
local f_pos2 = vector.new(f_pos1)
if math.random()<0.001 then
f_pos2[v.fp[1] ] = f_pos2[v.fp[1] ]+v.fp[2]
else
f_pos2[v.p] = f_pos2[v.p] + v.fp[2] --bed along wall_nodes
dir1=vector.direction(f_pos2,f_pos1)
dir2=vector.direction(f_pos1,f_pos2)
f_facedir1 = minetest.dir_to_facedir(dir1)
f_facedir2 = minetest.dir_to_facedir(dir2)
end
minetest.set_node(f_pos1,{
name=f_name,
paramtype2 = "facedir",
param2 = f_facedir2
})
print("bed1:"..mtpts(f_pos1))
local f_pos2 = vector.new(f_pos1)
f_pos2[v.fp[1] ] = f_pos2[v.fp[1] ]+v.fp[2]
print("bed2:"..mtpts(f_pos2))
minetest.set_node(f_pos2,{
name=f_name,
@ -543,7 +548,8 @@ function witches.generate_cottage(pos1,pos2,params)
local rfarea = vector.subtract(rfpos2,rfpos1)
local gbarea = vector.subtract(gbpos2,gbpos1)
local l_pos = {}
local rfaz = math.floor(rfarea.z/2)
local rfax = math.floor(rfarea.x/2)
if math.random() < 0.5 then
local midpoint = (rfarea.z+1)/2
@ -604,21 +610,22 @@ function witches.generate_cottage(pos1,pos2,params)
end
-- p is positional axis along which it is made
-- fp is the facing axis and direction inward
local wpos1 = {x=rfpos1.x+1, y=rfpos2.y-2, z=rfpos1.z+(rfarea.z/2), p="z", fp={"x",1}}
local wpos1 = {x=rfpos1.x+1, y=rfpos2.y-2, z=rfpos1.z+(rfaz), p="z", fp={"x",1}}
table.insert(l_pos,wpos1)
local wpos2 = {x=rfpos1.x+rfarea.x-1, y=rfpos2.y-2, z=rfpos1.z+(rfarea.z/2), p="z", fp={"x",-1}}
local wpos2 = {x=rfpos1.x+rfarea.x-1, y=rfpos2.y-2, z=rfpos1.z+(rfaz), p="z", fp={"x",-1}}
table.insert(l_pos,wpos2)
minetest.bulk_set_node({wpos1,wpos2},{
name=wp.window_nodes[1]
})
else
local wpos1 = {x=rfpos1.x+1, y=rfpos2.y-2, z=rfpos1.z+(rfarea.z/2)-1, p="z", fp={"x",1}}
local wpos1 = {x=rfpos1.x+1, y=rfpos2.y-2, z=rfpos1.z+(rfaz)+1, p="z", fp={"x",1}}
table.insert(l_pos,wpos1)
local wpos2 = {x=rfpos1.x+1, y=rfpos2.y-2, z=rfpos1.z+(rfarea.z/2), p="z", fp={"x",1}}
local wpos2 = {x=rfpos1.x+1, y=rfpos2.y-2, z=rfpos1.z+(rfaz), p="z", fp={"x",1}}
table.insert(l_pos,wpos2)
local wpos3 = {x=rfpos1.x+rfarea.x-1, y=rfpos2.y-2, z=rfpos1.z+(rfarea.z/2)-1, p="z", fp={"x",-1}}
local wpos3 = {x=rfpos1.x+rfarea.x-1, y=rfpos2.y-2, z=rfpos1.z+(rfaz)+1, p="z", fp={"x",-1}}
table.insert(l_pos,wpos3)
local wpos4 = {x=rfpos1.x+rfarea.x-1, y=rfpos2.y-2, z=rfpos1.z+(rfarea.z/2), p="z", fp={"x",-1}}
local wpos4 = {x=rfpos1.x+rfarea.x-1, y=rfpos2.y-2, z=rfpos1.z+(rfaz), p="z", fp={"x",-1}}
table.insert(l_pos,wpos4)
minetest.bulk_set_node({wpos1,wpos2,wpos3,wpos4},{
name=wp.window_nodes[1]
@ -681,21 +688,21 @@ function witches.generate_cottage(pos1,pos2,params)
name=rfslabs
})
end
local wpos1 = {x=rfpos1.x+(rfarea.x/2), y=rfpos2.y-2, z=rfpos1.z+1, p="x", fp={"z",1}}
local wpos1 = {x=rfpos1.x+(rfax), y=rfpos2.y-2, z=rfpos1.z+1, p="x", fp={"z",1}}
table.insert(l_pos,wpos1)
local wpos2 = {x=rfpos1.x+(rfarea.x/2), y=rfpos2.y-2, z=rfpos1.z+rfarea.z-1, p="x", fp={"z",-1}}
local wpos2 = {x=rfpos1.x+(rfax), y=rfpos2.y-2, z=rfpos1.z+rfarea.z-1, p="x", fp={"z",-1}}
table.insert(l_pos,wpos2)
minetest.bulk_set_node({wpos1,wpos2},{
name=wp.window_nodes[1]
})
else
local wpos1 = {x=rfpos1.x+(rfarea.x/2), y=rfpos2.y-2, z=rfpos1.z+1, p="x", fp={"z",1}}
local wpos1 = {x=rfpos1.x+(rfax), y=rfpos2.y-2, z=rfpos1.z+1, p="x", fp={"z",1}}
table.insert(l_pos,wpos1)
local wpos2 = {x=rfpos1.x+(rfarea.x/2)-1, y=rfpos2.y-2, z=rfpos1.z+1, p="x", fp={"z",1}}
local wpos2 = {x=rfpos1.x+(rfax)+1, y=rfpos2.y-2, z=rfpos1.z+1, p="x", fp={"z",1}}
table.insert(l_pos,wpos2)
local wpos3 = {x=rfpos1.x+(rfarea.x/2), y=rfpos2.y-2, z=rfpos1.z+rfarea.z-1, p="x", fp={"z",-1}}
local wpos3 = {x=rfpos1.x+(rfax), y=rfpos2.y-2, z=rfpos1.z+rfarea.z-1, p="x", fp={"z",-1}}
table.insert(l_pos,wpos3)
local wpos4 = {x=rfpos1.x+(rfarea.x/2)-1, y=rfpos2.y-2, z=rfpos1.z+rfarea.z-1, p="x", fp={"z",-1}}
local wpos4 = {x=rfpos1.x+(rfax)+1, y=rfpos2.y-2, z=rfpos1.z+rfarea.z-1, p="x", fp={"z",-1}}
table.insert(l_pos,wpos4)
minetest.bulk_set_node({wpos1,wpos2,wpos3,wpos4},{
name=wp.window_nodes[1]

View File

@ -80,7 +80,7 @@ witches.witch_types = {
"flowers:mushroom_brown","flowers:mushroom_red"},
do_custom_addendum = function(self)
if witches.cottages then
if math.random() < 0.01 then
if math.random() < 0.1 then
local volume = witches.grounding(self)
if volume then