Dialog updates

master
francisco athens 2022-02-14 07:03:49 -08:00
parent 0b504e9cb4
commit 6e0d7492fd
7 changed files with 111 additions and 28 deletions

View File

@ -1,3 +1,4 @@
2022/02/14: Dialog updates
2022/02/13: Debug output can be enabled from game Settings tab > All Settings > Mods > witches
2022/02/12: Witches honor protected nodes ("protector" mod support)
2020/08/10: Testing new cottage building code.

View File

@ -27,14 +27,17 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
if dg and dg.dungeon and #dg.dungeon > 2 then
for i=1,#dg.dungeon do
if dg.dungeon[i].y >= dungeon_cellar.max_depth then
--print("dungeon found: "..minetest.pos_to_string(dg.dungeon[i]))
print("dungeon found: "..minetest.pos_to_string(dg.dungeon[i]))
table.insert(dungeon_list, dg.dungeon[i])
end
end
end
end)
--local vol_vec = {x=5,y=5,z=5}
function witches.grounding(self,vol_vec,required_list,exception_list,replacement_node)
local r_tweak = math.random(-1,1)
@ -102,10 +105,11 @@ local default_params = {
orient_materials = true,
door_bottom = "doors:door_wood_witch_a";
door_top = "doors:hidden";
root_nodes = {"witches:treeroots"}
root_nodes = {"witches:treeroots"};
builder = "none"
}
function witches.generate_cottage(pos1,pos2,params)
function witches.generate_cottage(secret_name,pos1,pos2,params)
local working_parameters = params or default_params -- if there is nothing then initialize with defs
pos1 = vector.round(pos1)
pos2 = vector.round(pos2)
@ -120,7 +124,7 @@ function witches.generate_cottage(pos1,pos2,params)
else wp = table.copy(default_params)
end
local ps = wp.porch_size or math.random(2)
local wall_node = wp.wall_nodes[math.random(#wp.wall_nodes)]
local root_node = wp.root_nodes [math.random(#wp.root_nodes)]
@ -520,7 +524,7 @@ function witches.generate_cottage(pos1,pos2,params)
local furnace_pos = {} --gonna need this later!
--place some furniture
if window_pos then
local furniture = {"default:bookshelf","default:chest","beds:bed","default:furnace"}
local furniture = {"default:bookshelf","default:chest_locked","beds:bed","default:furnace"}
local f_pos1 ={}
for j in pairs(window_pos) do
for k,v in ipairs(window_pos[j]) do
@ -571,7 +575,32 @@ function witches.generate_cottage(pos1,pos2,params)
param2 = f_facedir1
})
furnace_pos = vector.new(f_pos1)
elseif f_name == "default:chest_locked" then
minetest.set_node(f_pos1,{
name=f_name,
paramtype2 = "facedir",
param2 = f_facedir1
})
minetest.registered_nodes[ f_name ].on_construct( f_pos1 );
local meta = minetest.get_meta(f_pos1);
local inv = meta:get_inventory();
meta:set_string("secret_type", "witches_chest")
meta:set_string("secret_name", secret_name)
meta:set_string("owner",secret_name)
meta:set_string("infotext", "Sealed chest of "..secret_name)
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
end
elseif f_name ~="beds:bed" then
minetest.set_node(f_pos1,{
name=f_name,

View File

@ -5,7 +5,7 @@
local path = minetest.get_modpath("witches")
witches = {}
witches.version = "20220213"
witches.version = "20220214"
print("This is Witches "..witches.version.."!")
-- Strips any kind of escape codes (translation, colors) from a string

View File

@ -2,6 +2,18 @@
# debug mode
witches_debug (enable debug) bool false
#maximum number of houses per mapchunk
witches_house_max_per_mapchunk (maximum number of houses per mapchunk) int 2
#average number of houses to mapchunks over the world
witches_houses_wanted_per_mapchunk (average number of houses to mapchunks over the world) float .05
# chance (1-99) of a witch house spawning over a dungeon instead of anywhere else
witches_dungeon_cellar_chance (chance as decimal like .5 of a witch house spawning over a dungeon instead of anywhere else) float .5
# depth (1-20) maximum depth of a dungeon to spawn a witch house over
witches_dungeon_cellar_depth (maximum depth 0 to -20 of a dungeon to spawn a witch house over) int -5

3
ui.lua
View File

@ -10,13 +10,14 @@ witches.find_item_quest = {}
witches.found_item_quest = {}
--local item_request = witches.generate_name(witches.quest_dialogs, {"item_request"})
function witches.find_item_quest.get_formspec(self,name)
-- retrieve the thing
--local quest_item = witches.looking_for(self)
local text = ""
if self.item_request.text and type(self.item_request.text) == "table" then
local intro = self.item_request.text.intro
local request = self.item_request.text.request
local request = "\n"..self.item_request.text.request
text = S("@1 @2",intro,request)
--print(text)

View File

@ -11,45 +11,60 @@ witches.name_parts_male = {
syllablesStart = "Aer, Al, Am, An, Ar, Arm, Arth, B, Bal, Bar, Be, Bel, Ber, Bok, Bor, Bran, Breg, Bren, Brod, Cam, Chal, Cham, Ch, Cuth, Dag, Daim, Dair, Del, Dr, Dur, Duv, Ear, Elen, Er, Erel, Erem, Fal, Ful, Gal, G, Get, Gil, Gor, Grin, Gun, H, Hal, Han, Har, Hath, Hett, Hur, Iss, Khel, K, Kor, Lel, Lor, M, Mal, Man, Mard, N, Ol, Radh, Rag, Relg, Rh, Run, Sam, Tarr, T, Tor, Tul, Tur, Ul, Ulf, Unr, Ur, Urth, Yar, Z, Zan, Zer",
syllablesMiddle = "de, do, dra, du, duna, ga, go, hara, kaltho, la, latha, le, ma, nari, ra, re, rego, ro, rodda, romi, rui, sa, to, ya, zila",
syllablesEnd = "bar, bers, blek, chak, chik, dan, dar, das, dig, dil, din, dir, dor, dur, fang, fast, gar, gas, gen, gorn, grim, gund, had, hek, hell, hir, hor, kan, kath, khad, kor, lach, lar, ldil, ldir, leg, len, lin, mas, mnir, ndil, ndur, neg, nik, ntir, rab, rach, rain, rak, ran, rand, rath, rek, rig, rim, rin, rion, sin, sta, stir, sus, tar, thad, thel, tir, von, vor, yon, zor",
syllablesTown = "mar, ton, veil, Loch, del, Pass, Hillock, shire, nia, ing",
}
witches.name_parts_female = {
syllablesStart = "Ad, Aer, Ar, Bel, Bet, Beth, Ce'N, Cyr, Eilin, El, Em, Emel, G, Gl, Glor, Is, Isl, Iv, Lay, Lis, May, Ner, Pol, Por, Sal, Sil, Vel, Vor, X, Xan, Xer, Yv, Zub",
syllablesMiddle = "bre, da, dhe, ga, lda, le, lra, mi, ra, ri, ria, re, se, ya",
syllablesEnd = "ba, beth, da, kira, laith, lle, ma, mina, mira, na, nn, nne, nor, ra, rin, ssra, ta, th, tha, thra, tira, tta, vea, vena, we, wen, wyn",
syllablesTown = "maer, tine, veila, Loch, dael, Pass, Hillock, shire, mia, aeng",
}
witches.words_desc = {
tool_adj = S("shiny, polished, favorite, beloved, cherished, sharpened"),
tool_adj = S("shiny, polished, favorite, beloved, cherished, sharpened, enhanced"),
titles = S("artificer, librarian, logician, sorcerant, thaumaturgist, polymorphist, elementalist, hedge, herbologist, arcanologist, tutor, historian, mendicant, restorationist"),
}
local function quest_dialogs(self)
local thing = self.item_request.item.desc
local thing_l = string.lower(self.item_request.item.desc)
local dialogs = {
intro = {
S("Hello, @1, I am @2, @3 of @4! ", self.speaking_to,self.secret_name,self.secret_title,self.secret_locale),
S("Just one minute, @1! @2, @3 of @4 seeks your assistance! ", self.speaking_to,self.secret_name,self.secret_title,self.secret_locale),
S("If you are indeed @1, perhaps you and I, @2, @3 of @4 can help each other! ", self.speaking_to,self.secret_name,self.secret_title,self.secret_locale),
S("Being a long way from @1, can be confusing. I'm known as @2 the @3! ", self.secret_locale,self.secret_name,self.secret_title),
S("You look as though you could be from @1, but I'm sure we have not yet met. I am @2 the @3! ", self.secret_locale,self.secret_name,self.secret_title),
},
having_met = {
S("Well, @1, I have yet to return to @2. Can you help me? ", self.speaking_to,self.secret_locale),
S("@1, do you have any intention of helping me? ", self.speaking_to),
S("There are some matters that still need my attention, @1. ", self.speaking_to),
S("I have been so busy in my search for materials, @1. ", self.speaking_to),
S("It's just that the @1 is so difficult to procure, @2! ", thing_l, self.speaking_to),
S("Great @1!, Where could that be found, @2?!? ", thing_l, self.speaking_to)
},
item_request = {
S("I've been looking all over for the @1! ",self.item_request.item.desc),
S("I seem to have misplaced the @1! ",self.item_request.item.desc),
S("Would you happen to have some number of @1? ",self.item_request.item.desc),
S("Would you kindly retrieve for me the @1? ",self.item_request.item.desc),
S("Might you please return with the @1? ",self.item_request.item.desc),
S("Do you know I seek only the @1? ",self.item_request.item.desc),
S("Have you but some number of @1? ",self.item_request.item.desc),
S("Why must my task require the @1? ",self.item_request.item.desc),
S("Is it so difficult to find the @1? ",self.item_request.item.desc),
S("Wherefor about this land art the @1? ",self.item_request.item.desc),
S("Must not there be but a few of the @1 about? ",self.item_request.item.desc),
S("Could I trouble you for some kind of @1? ",self.item_request.item.desc),
S("The @1 would make my collection complete! ",self.item_request.item.desc),
S("I sense the @1 are not far away...",self.item_request.item.desc),
S("Certainly the @1 is not as rare as a blood moon! ",self.item_request.item.desc),
S("You look like you know where to find the @1! ",self.item_request.item.desc)
S("A @1, just one will do! ", thing_l),
S("I've been looking all over for the @1! ",thing_l),
S("I seem to have misplaced the @1! ",thing_l),
S("Would you happen to have some number of @1? ",thing_l),
S("Would you kindly retrieve for me the @1? ",thing_l),
S("Might you please return with the @1? ",thing_l),
S("Do you know I seek only the @1? ",thing_l),
S("Have you but some number of @1? ",thing_l),
S("Why must my task require the @1? ",thing_l),
S("Is it so difficult to find the @1? ",thing_l),
S("Wherefor about this land art the @1? ",thing_l),
S("Must not there be but a few of the @1 about? ",thing_l),
S("Could I trouble you for some kind of @1? ",thing_l),
S("The @1 would make my collection complete! ",thing_l),
S("I sense the @1 are not far away...",thing_l),
S("Certainly the @1 is not as rare as a blood moon! ",thing_l),
S("You look like you know where to find the @1! ",thing_l)
}
}
--print(dump(dialogs))
@ -400,8 +415,29 @@ function witches.item_request(self,name)
--we need text for the quest!
-- print("generating")
local dialog_list = quest_dialogs(self)
local dli_num = math.random(1,#dialog_list.intro)
local intro_text = dialog_list.intro[dli_num]
if not self.players then self.players = {} end
if not self.players[name] then
self.players[name] = {}
--if not self.players.met or #self.players.met < 1 or type(self.players.met) == string then
--table.insert(self.players_met, self.secret_name)
end
local intro_text = ""
if not self.players[name].met then
--print(dump(self.players[name]))
--print( "We don't know "..name.."!")
local dli_num = math.random(1,#dialog_list.intro)
intro_text = dialog_list.intro[dli_num]
self.players[name] = {met = math.floor(os.time())}
else
--print(dump(self.players.met))
--print( "We first met "..name.." ".. os.time() - self.players[name].met.." seconds ago")
local dli_num = math.random(1,#dialog_list.having_met)
intro_text = dialog_list.having_met[dli_num]
end
--print(intro_text)
local quest_item = self.item_request.item.desc

View File

@ -94,7 +94,7 @@ witches.witch_types = {
pos.y = pos.y+3
self.object:set_pos(pos)
self.built_house = pos
witches.generate_cottage(volume[1],volume[2])
witches.generate_cottage(self.secret_name,volume[1],volume[2])
end
end
@ -290,7 +290,11 @@ witches.witch_template = { --your average witch,
self.secret_title = witches.generate_text(witches.words_desc, {"titles"})
end
if not self.secret_locale then
self.secret_locale = witches.generate_text(witches.name_parts_female, {"syllablesStart","syllablesEnd"})
if math.random(2) == 1 then
self.secret_locale = witches.generate_text(witches.name_parts_female, {"syllablesStart","syllablesEnd","syllablesTown"})
else
self.secret_locale = witches.generate_text(witches.name_parts_male, {"syllablesStart","syllablesEnd","syllablesTown"})
end
end
--self.item_request.text = witches.generate_name(witches.quest_dialogs, {"item_request"})