advanced_npc/init.lua
zorman2000 762337cc6d Dialogues: Added function to select random dialogues for NPCs from random data.
Modified NPCs so random dialogues are chosen on initialization.
Added function to start a dialogue, choosing randomly NPCs dialogues.
Changed NPC code to use new dialogue code
2016-12-01 14:37:00 -05:00

33 lines
606 B
Lua
Executable File

local path = minetest.get_modpath("advanced_npc")
-- Intllib
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s, a, ...)
if a == nil then
return s
end
a = {a, ...}
return s:gsub("(@?)@(%(?)(%d+)(%)?)",
function(e, o, n, c)
if e == ""then
return a[tonumber(n)] .. (o == "" and c or "")
else
return "@" .. o .. n .. c
end
end)
end
end
mobs.intllib = S
-- NPC
dofile(path .. "/npc.lua")
dofile(path .. "/dialogue.lua")
dofile(path .. "/random_data.lua")
--dofile(path .. "/trader.lua")
print (S("[MOD] Advanced NPC loaded"))