Skip to content
Snippets Groups Projects
Commit 762fdb95 authored by DarkGod's avatar DarkGod
Browse files

Lore can now have a tempalte=true field that shows it must be processed first

parent c408f82e
No related branches found
No related tags found
No related merge requests found
......@@ -510,3 +510,8 @@ end
function _M:getEntityKind()
return "actor"
end
function _M:he_she() return string.he_she(self) end
function _M:his_her() return string.his_her(self) end
function _M:him_her() return string.him_her(self) end
function _M:his_her_self() return string.his_her_self(self) end
......@@ -586,6 +586,13 @@ function string.a_an(str)
else return "a "..str end
end
function string.he_she(actor)
if actor.female then return "she"
elseif actor.neuter then return "it"
else return "he"
end
end
function string.his_her(actor)
if actor.female then return "her"
elseif actor.neuter then return "it"
......@@ -593,6 +600,13 @@ function string.his_her(actor)
end
end
function string.him_her(actor)
if actor.female then return "her"
elseif actor.neuter then return "it"
else return "him"
end
end
function string.his_her_self(actor)
if actor.female then return "herself"
elseif actor.neuter then return "itself"
......
......@@ -20,6 +20,7 @@
require "engine.class"
local Dialog = require "engine.ui.Dialog"
local LorePopup = require "mod.dialogs.LorePopup"
local slt2 = require "slt2"
module(..., package.seeall, class.make)
......@@ -65,7 +66,14 @@ function _M:getLore(lore, silent)
self.lore_known = self.lore_known or {}
self.additional_lore = self.additional_lore or {}
if not silent then assert(self.lore_defs[lore] or self.additional_lore[lore], "bad lore id "..lore) end
return self.lore_defs[lore] or self.additional_lore[lore]
local l = table.clone(self.lore_defs[lore] or self.additional_lore[lore])
if l.template then
local tpl = slt2.loadstring(l.lore)
l.lore = slt2.render(tpl, {player=self:findMember{main=true}, self=self})
end
return l
end
function _M:additionalLore(id, name, category, lore)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment