cottage fixes and variations

master
francisco athens 2022-08-28 20:44:45 -07:00
parent 4c6631c2c0
commit fb789e0848
6 changed files with 51 additions and 46 deletions

View File

@ -1,5 +1,5 @@
2022/08/28: More Cottage variations and furniture
2022/08/28: More Cottage variations and furniture, cleanup of node workarounds, fixes to witch spawning in cottages
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.

View File

@ -193,13 +193,15 @@ local default_params = {
},
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
pos1 = vector.round(pos1)
pos2 = vector.round(pos2)
local wp = working_parameters
local witch_spawn_pos ={}
if params then -- get defaults for any missing params
-- print("default params: "..minetest.serialize(default_params))
@ -713,6 +715,7 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
end
local furnace_pos = {} -- gonna need this later!
-- place some furniture
--bed requires some special attention :P
if window_pos then
local bed = ""
if not beds then
@ -721,30 +724,12 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
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 = {
bed,
"default:bookshelf",
"witches:chest_locked",
bed,
"default:furnace",
shelf
"witches:shelf"
}
local f_pos1 = {}
@ -822,7 +807,7 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
meta:set_string("infotext",
"This chest is magically sealed!")
witches.debug("Unclaimed chest: "..vector.to_string(f_pos1))
witch_spawn_pos = f_pos1
end
if minetest.get_modpath("fireflies") then
@ -836,11 +821,11 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
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})
inv:add_item("main", {name = "witches:bucket", count=1})
end
witch_spawn_pos = f_pos1
elseif f_name ~= "beds:bed" then
elseif f_name ~= bed then
minetest.set_node(f_pos1, {
name = f_name,
paramtype2 = "facedir",
@ -850,7 +835,7 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
witches.debug("placing bottle!")
local v_pos1 = vector.new(f_pos1.x,f_pos1.y+1,f_pos1.z)
minetest.set_node(v_pos1, {
name = bottle,
name = "witches:glass_bottle",
paramtype2 = "facedir",
param2 = f_facedir1
})
@ -1266,18 +1251,21 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
local cottage_va = VoxelArea:new{MinEdge = c_area1, MaxEdge = c_area2}
-- print(mts(VoxelArea))
witches.debug("Attempting spawning cottage witch")
--minetest.add_entity(minetest.find_node_near(f_pos1, 3, "air"), "witches:witch_cottage")
if witch_spawn_pos and mobs:add_mob(minetest.find_node_near(witch_spawn_pos, 3, "air"),{
name = "witches:witch_cottage",
ignore_count = true
})
then
witches.debug("SUCCESS: spawning cottage witch")
else
witches.debug("FAILED: spawning cottage witch"..vector.to_string(witch_spawn_pos))
end
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

@ -6,4 +6,6 @@ mobs_monster?
doors?
flowers?
stairs?
bucket?
vessels?

View File

@ -100,9 +100,9 @@ else
end
dofile(path .. "/magic.lua")
local witches_cottages = settings:get_bool("witches_cottages")
if witches_cottages then
witches.cottages = settings:get_bool("witches_cottages")
if witches.cottages then
witches.cottages = true
dofile(path .. "/cottages.lua")
print_s(S("Witch cottages will be generated"))

View File

@ -1,5 +1,5 @@
name = witches
descriptions = adds witches and their cottages
depends = default, mobs
optional_depends = doors, flowers, stairs, protector, animalia, mobs_animal
optional_depends = doors, bucket, vessels, beds, flowers, stairs, protector, animalia, mobs_animal

View File

@ -1,4 +1,5 @@
local S = minetest.get_translator("witches")
local function print_s(input) print(witches.strip_escapes(input)) end
if not witches.doors then
witches.debug("doors mod not found!")
return
@ -24,11 +25,25 @@ else
})
end
if witches.vessels then
if not minetest.get_modpath("beds") then
print_s(S("bed mod not found! Bed not registered!"))
end
if not minetest.get_modpath("bucket") then
minetest.register_alias("witches:bucket","default:coal")
print_s(S("bucket mod not found! Bucket not registered!"))
else
minetest.register_alias("witches:bucket","bucket_water")
end
if not minetest.get_modpath("vessels") then
minetest.register_alias("witches:shelf", "air")
minetest.register_alias("witches:glass_bottle", "air")
print_s(S("vessels mod not found! Shelf and glass bottle not registered!"))
else
minetest.register_alias("witches:shelf", "vessels:shelf")
minetest.register_alias("witches:glass_bottle", "vessels:glass_bottle")
else
witches.debug("vessels mod not found! shelf not registered!")
end
minetest.register_alias("witches:chest_locked", "default:chest_locked")
@ -55,7 +70,7 @@ minetest.register_node("witches:tree", {
})
local flowers_types = {}
if flowers.datas then
if minetest.get_modpath("flowers") and flowers.datas then
for i, v in pairs(flowers.datas) do flowers_types[i] = "flowers:" .. v[1] end
end