Fixes to quests, chests etc.
parent
4366acd973
commit
3b66af4461
|
@ -1,4 +1,4 @@
|
|||
2022/08/27: clean up deprecated vector tables
|
||||
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
|
||||
|
|
61
cottages.lua
61
cottages.lua
|
@ -179,6 +179,13 @@ local default_params = {
|
|||
door_top = "doors:hidden",
|
||||
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
|
||||
},
|
||||
owner = "none"
|
||||
}
|
||||
|
||||
|
@ -316,20 +323,37 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
|
|||
vector.new(pcn[3].x + ps + mr(-1, 1), pos2.y - 1, pcn[3].z + ps + mr(-1, 1)),
|
||||
vector.new(pcn[4].x + ps + mr(-1, 1), pos2.y - 1, pcn[4].z - ps + mr(-1, 1))
|
||||
}
|
||||
if wp.tree_types and #wp.tree_types >= 1 then
|
||||
if wp.tree_types and #wp.tree_types >= 1 and math.random(2) == 1 then
|
||||
---this check fails without "minetest" game, why!?
|
||||
local tree_pos = treecn[math.random(#treecn)]
|
||||
local tree_pos2 = treecn[math.random(#treecn)]
|
||||
|
||||
local root_pos = vector.new(tree_pos)
|
||||
local tree_var = wp.tree_types[math.random(#wp.tree_types)]
|
||||
|
||||
-- print("spawning "..tree_var )
|
||||
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)]
|
||||
tree_growth(tree_pos)
|
||||
if vector.equals(tree_pos, tree_pos2) then
|
||||
else
|
||||
tree_growth(tree_pos2)
|
||||
end
|
||||
-- minetest.set_node(root_pos, {name = root_node})
|
||||
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,
|
||||
{"group:liquid", "air"})
|
||||
minetest.bulk_set_node(roots, {name = root_node})
|
||||
|
||||
if vector.equals(tree_pos, tree_pos2) then
|
||||
else
|
||||
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,
|
||||
{"group:liquid", "air"})
|
||||
minetest.bulk_set_node(roots, {name = root_node})
|
||||
end
|
||||
end
|
||||
|
||||
-- first floor!
|
||||
|
@ -673,7 +697,7 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
|
|||
bed = "beds:bed"
|
||||
end
|
||||
local furniture = {
|
||||
"default:bookshelf", "default:chest_locked", bed, "default:furnace"
|
||||
"default:bookshelf", "witches:chest_locked", bed, "default:furnace"
|
||||
}
|
||||
|
||||
local f_pos1 = {}
|
||||
|
@ -726,7 +750,7 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
|
|||
param2 = f_facedir1
|
||||
})
|
||||
furnace_pos = vector.new(f_pos1)
|
||||
elseif f_name == "default:chest_locked" then
|
||||
elseif f_name == "witches:chest_locked" then
|
||||
|
||||
minetest.set_node(f_pos1, {
|
||||
name = f_name,
|
||||
|
@ -745,16 +769,37 @@ function witches.generate_cottage(pos1, pos2, params, secret_name)
|
|||
meta:set_string("owner", secret_name)
|
||||
meta:set_string("infotext",
|
||||
"Sealed chest of " .. secret_name)
|
||||
else
|
||||
meta:set_string("owner", vector.to_string(f_pos1))
|
||||
meta:set_string("secret_name", vector.to_string(f_pos1))
|
||||
meta:set_string("infotext",
|
||||
"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
|
||||
|
||||
if minetest.get_modpath("fireflies") then
|
||||
inv:add_item("main", {name = "fireflies:bug_net"})
|
||||
end
|
||||
inv:add_item("main", {name = "default:meselamp"})
|
||||
if math.random() < 0.50 then
|
||||
for i = 1, math.random(3) do
|
||||
inv:add_item("main", {name = "default:diamond"})
|
||||
end
|
||||
for i = 1, math.random(3) do
|
||||
inv:add_item("main", {name = "default:diamond", count=math.random(1,10)})
|
||||
end
|
||||
for i = 1, math.random(3) do
|
||||
inv:add_item("main", {name = "default:steel_ingot", count=math.random(1,10)})
|
||||
end
|
||||
|
||||
elseif f_name ~= "beds:bed" then
|
||||
|
|
|
@ -24,6 +24,8 @@ else
|
|||
})
|
||||
end
|
||||
|
||||
minetest.register_alias("witches:chest_locked", "default:chest_locked")
|
||||
|
||||
minetest.register_node("witches:tree", {
|
||||
tiles = {
|
||||
"default_tree_top.png", "default_tree_top.png", "default_tree.png",
|
||||
|
|
|
@ -5,12 +5,6 @@ witches_debug (enable debug) bool false
|
|||
#enable cottages
|
||||
witches_cottages (enable cottages) bool true
|
||||
|
||||
#maximum number of houses per mapchunk (unused for now)
|
||||
witches_house_max_per_mapchunk (maximum number of houses per mapchunk) int 2
|
||||
|
||||
#average number of houses to mapchunks over the world (unused for now)
|
||||
witches_houses_wanted_per_mapchunk (average number of houses to mapchunks over the world) float .05
|
||||
|
||||
# chance (1 or more) of a witch house spawning over a dungeon
|
||||
witches_dungeon_cellar_chance (chance as 1 in <positive integer> of a witch house spawning over a dungeon) int 2
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ for _, col in ipairs(all_colours) do
|
|||
|
||||
self.object:set_properties({
|
||||
textures = {"witches_sheep.png^(witches_sheep_wool.png^[colorize:" .. col[3]..")"},
|
||||
mesh = "mobs_sheep.b3d",
|
||||
mesh = "witches_sheep.b3d",
|
||||
})
|
||||
end
|
||||
end,
|
||||
|
@ -117,7 +117,7 @@ for _, col in ipairs(all_colours) do
|
|||
|
||||
self.object:set_properties({
|
||||
textures = {"witches_sheep.png^(witches_sheep_wool.png^[colorize:" .. col[3]..")"},
|
||||
mesh = "mobs_sheep.b3d",
|
||||
mesh = "witches_sheep.b3d",
|
||||
})
|
||||
end
|
||||
|
||||
|
|
2
ui.lua
2
ui.lua
|
@ -53,7 +53,7 @@ function witches.found_item_quest.get_formspec(self,name)
|
|||
local text = S("Thank you @1, for finding @2!",name,quest_item.desc)
|
||||
--print(dump(self.players[name].reward_text))
|
||||
if self.players[name].reward_text then
|
||||
text = text.."\n("..self.players[name].reward_text .. "!)"
|
||||
text = text.."\n("..self.players[name].reward_text..")"
|
||||
end
|
||||
if self.players[name].reward_item then
|
||||
display_item = self.players[name].reward_item
|
||||
|
|
|
@ -374,10 +374,11 @@ function witches.award_witches_chest(self, player)
|
|||
local info = {self.secret_name, sname, self.witches_chest_pos, pname}
|
||||
local pos_string = minetest.pos_to_string(info[3])
|
||||
local reward_text = S(
|
||||
"You receive permission from @1 to access the magic chest of @2!\n(@3)",
|
||||
info[1], info[2], pos_string)
|
||||
"You receive permission from @1 to access their magic chest located at @2!",
|
||||
info[1], pos_string)
|
||||
local reward = {r_text = reward_text, r_item = "default:chest"}
|
||||
meta:set_string("infotext", S("@1's chest of @2", info[1], info[2]))
|
||||
--meta:set_string("infotext", S("@1's chest of @2", info[1], info[2]))
|
||||
meta:set_string("infotext", S("@1's unlocked chest", info[1]))
|
||||
self.witches_chest_owner = pname
|
||||
return reward
|
||||
end
|
||||
|
@ -395,12 +396,13 @@ function witches.claim_witches_chest(self)
|
|||
local sn = meta:get_string("secret_name")
|
||||
-- if sn then print(sn) end
|
||||
local o = meta:get_string("owner")
|
||||
if o and sn and sn == o then
|
||||
if o and sn and sn == o then
|
||||
witches.debug("unbound chest: " .. sn)
|
||||
meta:set_string("owner", self.secret_name)
|
||||
meta:set_string("secret_name", self.secret_name)
|
||||
-- meta:set_string("secret_name", self.secret_name)
|
||||
meta:set_string("infotext",
|
||||
S("Sealed chest of @1",self.secret_name))
|
||||
self.witches_chest = sn
|
||||
self.witches_chest = self.secret_name
|
||||
self.witches_chest_owner = self.secret_name
|
||||
self.witches_chest_pos = meta_table[i]
|
||||
end
|
||||
|
@ -504,23 +506,24 @@ function witches.found_item(self, clicker)
|
|||
|
||||
if not self.players then
|
||||
self.players = {}
|
||||
-- print("no records")
|
||||
witches.debug("no records")
|
||||
end
|
||||
|
||||
if not self.players[pname] then
|
||||
self.players[pname] = {}
|
||||
-- print("no records 2")
|
||||
witches.debug("no records 2")
|
||||
end
|
||||
-- print(dump(self.players))
|
||||
witches.debug(dump(self.players))
|
||||
if not self.players[pname].favors then
|
||||
self.players[pname] = {favors = 0}
|
||||
--self.players[pname] = {met = self.players[pname].met , favors = 0}
|
||||
self.players[pname].favors = 0
|
||||
end
|
||||
|
||||
self.players[pname].favors = self.players[pname].favors + 1
|
||||
local reward = {}
|
||||
-- print(self.secret_name.." has now received 2 favors"..self.players[pname].favors.." from " ..pname)
|
||||
witches.debug(self.secret_name.." has now received "..self.players[pname].favors.." favors from " ..pname)
|
||||
|
||||
if self.players[pname].favors >= 3 and
|
||||
if self.players[pname].favors >= 5 and
|
||||
math.fmod(18, self.players[pname].favors) == 0 then
|
||||
if self.witches_chest and self.witches_chest_owner ==
|
||||
self.secret_name then
|
||||
|
@ -530,15 +533,16 @@ function witches.found_item(self, clicker)
|
|||
|
||||
end
|
||||
else
|
||||
if math.random(1,4) == 1 then
|
||||
reward = witches.gift(self, pname)
|
||||
|
||||
-- print(reward_text)
|
||||
witches.debug(reward)
|
||||
end
|
||||
end
|
||||
if reward and reward.r_text then
|
||||
self.players[pname].reward_text = reward.r_text
|
||||
end
|
||||
if reward and reward.r_item then
|
||||
-- print("reward: "..reward.r_item)
|
||||
witches.debug("reward: "..reward.r_item)
|
||||
self.players[pname].reward_item = reward.r_item
|
||||
end
|
||||
|
||||
|
|
12
witches.lua
12
witches.lua
|
@ -6,11 +6,11 @@ local hair_colors = witches.hair_colors
|
|||
local spawning = {
|
||||
cottage = {
|
||||
nodes = {"group:wood", "default:mossycobble", "default:cobble"},
|
||||
neighbors = {"air", "default:locked_chest", "doors:wood_witch_a"},
|
||||
neighbors = {"air", "witches:chest_locked", "doors:wood_witch_a"},
|
||||
min_light = 5,
|
||||
max_light = 15,
|
||||
interval = 30,
|
||||
chance = 1000,
|
||||
interval = 100,
|
||||
chance = 500,
|
||||
active_object_count = 2,
|
||||
min_height = 0,
|
||||
max_height = 200,
|
||||
|
@ -208,7 +208,11 @@ witches.witch_template = { -- your average witch,
|
|||
{name = "default:pick_steel", chance = 1000, min = 0, max = 1},
|
||||
{name = "default:shovel_steel", chance = 1000, min = 0, max = 1},
|
||||
{name = "default:axe_steel", chance = 1000, min = 0, max = 1},
|
||||
{name = "default:axe_stone", chance = 5, min = 0, max = 1}
|
||||
{name = "default:pick_stone", chance = 5, min = 0, max = 1},
|
||||
{name = "default:shovel_stone", chance = 5, min = 0, max = 1},
|
||||
{name = "default:axe_stone", chance = 5, min = 0, max = 1},
|
||||
{name = "default:torch", chance = 5, min = 5, max = 20},
|
||||
{name = "mobs:shears", chance = 100, min = 0, max = 1}
|
||||
},
|
||||
|
||||
follow = {},
|
||||
|
|
Loading…
Reference in New Issue