Cottage variations

master
francisco athens 2022-08-28 15:13:03 -07:00
parent 3b66af4461
commit 7a748aab1d
4 changed files with 118 additions and 103 deletions

View File

@ -1,4 +1,6 @@
2022/08/27: clean up deprecated vector tables, quest and chest fixes
2022/08/28: More Cottage variations and furniture
2022/08/27: Clean up deprecated vector tables, quest and chest fixes
2022/02/23: Fixes and formatting
2022/02/22: Restored Cottages spawning over dungeons (!) and some related settings.
2022/02/19: Require only default and mobs now, additional checks, cottage generation now optional from game Settings tab > All Settings > Mods > witches

View File

@ -180,14 +180,20 @@ local default_params = {
root_nodes = {"witches:jungleroots"},
tree_types = {witches.acacia_tree, witches.acacia_tree2},
default_tree_types = {
default.grow_new_apple_tree,
default.grow_new_pine_tree,
default.grow_bush,
default.grow_pine_bush,
default.grow_blueberry_bush
},
default.grow_new_apple_tree,
default.grow_new_pine_tree,
default.grow_bush,
default.grow_pine_bush,
default.grow_blueberry_bush
},
default_bush_types = {
default.grow_bush,
default.grow_pine_bush,
default.grow_blueberry_bush
},
owner = "none"
}
local witch_spawn_pos ={}
function witches.generate_cottage(pos1, pos2, params, secret_name)
local working_parameters = params or default_params -- if there is nothing then initialize with defs
@ -298,24 +304,42 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
}
local pcn_height = wp.foundation_depth + 1
for h = 1, pcn_height do
for i = 1, #pcn do
local pos = vector.new(pcn[i].x, pcn[i].y + 2 - h, pcn[i].z)
-- minetest.set_node(pos, {name = wall_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 pillars = minetest.find_nodes_in_area(pos, pos_ck,
{"group:liquid", "air"})
minetest.bulk_set_node(pillars, {name = wall_node})
end
end
local function mr(min, max)
local v = math.random(min, max)
return v
end
--chance of porch pillars
if mr(1,5) == 1 then
for h = 1, pcn_height do
for i = 1, #pcn do
local pos = vector.new(pcn[i].x, pcn[i].y + 2 - h, pcn[i].z)
-- minetest.set_node(pos, {name = wall_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 pillars = minetest.find_nodes_in_area(pos, pos_ck,
{"group:liquid", "air"})
minetest.bulk_set_node(pillars, {name = wall_node})
end
end
end
--chance of porch bushes
for i = 1, #pcn do
if mr(1,2) == 1 then
local pos = vector.new(pcn[i].x, pcn[i].y + 1, pcn[i].z)
-- minetest.set_node(pos, {name = wall_node})
-- minetest.set_node(vector.new(pos.x, pos.y - 1, pos.z), {name = root_node})
local bush_growth = wp.default_bush_types[math.random(#wp.default_bush_types)]
bush_growth(pos)
end
end
local treecn = {
vector.new(pcn[1].x - ps + mr(-1, 1), pos2.y - 1, pcn[1].z - ps + mr(-1, 1)),
@ -696,8 +720,31 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
else
bed = "beds:bed"
end
local bckt = ""
if not bucket then
bckt = "default:coal"
else
bckt = "bucket:bucket_water"
end
local shelf = ""
local bottle = ""
if not witches.vessels then
shelf = "air"
bottle = "air"
else
shelf = "witches:shelf"
bottle = "witches:glass_bottle"
end
local furniture = {
"default:bookshelf", "witches:chest_locked", bed, "default:furnace"
"default:bookshelf",
"witches:chest_locked",
bed,
"default:furnace",
shelf
}
local f_pos1 = {}
@ -776,21 +823,8 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
"This chest is magically sealed!")
witches.debug("Unclaimed chest: "..vector.to_string(f_pos1))
--minetest.add_entity(minetest.find_node_near(f_pos1, 3, "air"), "witches:witch_cottage")
witches.debug("Attempting spawning cottage witch")
if mobs:add_mob(minetest.find_node_near(f_pos1, 2, "air"),{
name = "witches:witch_cottage",
ignore_count = true
})
then
witches.debug("SUCCESS: spawning cottage witch")
else
witches.debug("FAILED: spawning cottage witch")
end
end
end
if minetest.get_modpath("fireflies") then
inv:add_item("main", {name = "fireflies:bug_net"})
end
@ -801,13 +835,28 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
for i = 1, math.random(3) do
inv:add_item("main", {name = "default:steel_ingot", count=math.random(1,10)})
end
for i = 1, math.random(3) do
inv:add_item("main", {name = bckt, count=1})
end
witch_spawn_pos = f_pos1
elseif f_name ~= "beds:bed" then
minetest.set_node(f_pos1, {
name = f_name,
paramtype2 = "facedir",
param2 = f_facedir1
})
if mr(1,2) == 1 then
print("placing bottle!")
local v_pos1 = vector.new(f_pos1.x,f_pos1.y+1,f_pos1.z)
minetest.set_node(v_pos1, {
name = bottle,
paramtype2 = "facedir",
param2 = f_facedir1
})
end
end
table.remove(furniture, f_num)
@ -822,11 +871,11 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
local sfpos1 = vector.new(ffpos1.x, ffpos2.y + wp.wall_height, ffpos1.z)
local sfpos2 = vector.new(ffpos2.x, ffpos2.y + wp.wall_height, ffpos2.z)
local sfarea = vector.subtract(sfpos2, sfpos1)
--
for i = 1, sfarea.z + 1 do
for j = 1, sfarea.x + 1 do
local sfvar = mr(0,1)
for i = 1, sfarea.z + 1 + 2*sfvar do
for j = 1, sfarea.x + 1 + 2*sfvar do
local pos = vector.new(sfpos1.x + j - 1, sfpos1.y + 1, sfpos1.z + i - 1)
local pos = vector.new(sfpos1.x + j - 1 - sfvar, sfpos1.y + 1, sfpos1.z + i - 1 - sfvar)
minetest.set_node(pos, {
name = sfnodes,
paramtype2 = "facedir",
@ -1220,3 +1269,15 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
return l_pos
end
--minetest.add_entity(minetest.find_node_near(f_pos1, 3, "air"), "witches:witch_cottage")
witches.debug("Attempting spawning cottage witch")
if mobs:add_mob(minetest.find_node_near(witch_spawn_pos, 2, "air"),{
name = "witches:witch_cottage",
ignore_count = true
})
then
witches.debug("SUCCESS: spawning cottage witch")
else
witches.debug("FAILED: spawning cottage witch")
end

View File

@ -4,7 +4,7 @@
local path = minetest.get_modpath("witches")
witches = {}
witches.version = "202200827"
witches.version = "20220828"
print("This is Witches " .. witches.version .. "!")
-- Strips any kind of escape codes (translation, colors) from a string
@ -68,6 +68,14 @@ else
witches.debug("doors mod found")
end
if not minetest.get_modpath("vessels") then
witches.debug("vessels mod not found")
witches.vessels = false
else
witches.vessels = true
witches.debug("vessels mod found")
end
dofile(path .. "/utilities.lua")
dofile(path .. "/ui.lua")
dofile(path .. "/items.lua")

View File

@ -24,6 +24,13 @@ else
})
end
if witches.vessels then
minetest.register_alias("witches:shelf", "vessels:shelf")
minetest.register_alias("witches:glass_bottle", "vessels:glass_bottle")
else
print("vessels mod not found! shelf not registered!")
end
minetest.register_alias("witches:chest_locked", "default:chest_locked")
minetest.register_node("witches:tree", {
@ -46,69 +53,6 @@ minetest.register_node("witches:tree", {
}
}
})
-- ]]
-- the following are based on: https://dev.minetest.net/L-system_tree_examples
witches.acacia_tree = {
axiom = "FFFFFFccccA",
rules_a = "[B]//[B]//[B]//[B]",
rules_b = "&TTTT&TT^^G&&----GGGGGG++GGG++" -- line up with the "canvas" edge
.. "fffffRfGG++G++" -- first layer, drawn in a zig-zag raster pattern
.. "Gffffffff--G--" .. "ffffRfffG++G++" .. "fffffffff--G--" ..
"fffffffff++G++" .. "ffRffffff--G--" .. "ffffffffG++G++" ..
"GffffRfff--G--" .. "fffffffGG" .. "^^G&&----GGGGGGG++GGGGGG++" -- re-align to second layer canvas edge
.. "ffffGGG++G++" -- second layer
.. "GGfffff--G--" .. "ffRfffG++G++" .. "fffffff--G--" .. "ffffRfG++G++" ..
"GGfffff--G--" .. "ffRfGGG",
rules_c = "/",
trunk = "default:tree",
leaves = "default:leaves",
angle = 45,
iterations = 3,
random_level = 1,
trunk_type = "single",
thin_branches = true,
fruit_chance = 5,
fruit = "default:apple"
}
witches.acacia_tree2 = {
axiom = "FFFFFFccccA",
rules_a = "[B]//[B]//[B]//[B]",
rules_b = "&TTTT&TT^^G&&----GGGGGG++GGG++" -- line up with the "canvas" edge
.. "fffffRfGG++G++" -- first layer, drawn in a zig-zag raster pattern
.. "Gffffffff--G--" .. "ffffRfffG++G++" .. "fffffffff--G--" ..
"fffffffff++G++" .. "ffRffffff--G--" .. "ffffffffG++G++" ..
"GffffRfff--G--" .. "fffffffGG" .. "^^G&&----GGGGGGG++GGGGGG++" -- re-align to second layer canvas edge
.. "ffffGGG++G++" -- second layer
.. "GGfffff--G--" .. "ffRfffG++G++" .. "fffffff--G--" .. "ffffRfG++G++" ..
"GGfffff--G--" .. "ffRfGGG",
rules_c = "/",
trunk = "default:tree",
leaves = "default:leaves",
angle = 45,
iterations = 5,
random_level = 4,
trunk_type = "single",
thin_branches = true,
fruit_chance = 2,
fruit = "default:apple"
}
witches.apple_tree = {
axiom = "FFFFFAFFBF",
rules_a = "[&&&FFFFF&&FFFF][&&&++++FFFFF&&FFFF][&&&----FFFFF&&FFFF]",
rules_b = "[&&&++FFFFF&&FFFF][&&&--FFFFF&&FFFF][&&&------FFFFF&&FFFF]",
trunk = "default:tree",
leaves = "default:leaves",
angle = 30,
iterations = 3,
random_level = 1,
trunk_type = "single",
thin_branches = true,
fruit_chance = 10,
fruit = "default:apple"
}
local flowers_types = {}
if flowers.datas then