fixed interaction config option only being updated on cell change

This commit is contained in:
Lilian Jónsdóttir 2020-08-06 23:24:06 -07:00
parent 6f4d0792ab
commit efc88eddb2
2 changed files with 15 additions and 2 deletions

View file

@ -26,4 +26,13 @@ this.inspect = function(thing)
this.log(inspect(thing))
end
this.vowel = function(str)
local s = string.sub(str, 1, 1)
local n = ""
if string.match(s, "[AOEUIaoeui]") then n = "n" end
return n
end
return this

View file

@ -686,7 +686,7 @@ local function updatePlayerTrespass(cell)
cell = cell or tes3.getPlayerCell()
if checkInteriorCell(cell) and not isIgnoredCell(cell) and not isPublicHouse(cell) then
if config.disableInteraction and checkTime() then
if checkTime() then
tes3.player.data.NPCsGoHome.intruding = true
else
tes3.player.data.NPCsGoHome.intruding = false
@ -701,7 +701,11 @@ end
-- {{{ event functions
local function onActivated(e)
if e.activator ~= tes3.player or e.target.object.objectType ~= tes3.objectType.npc then return end
if e.activator ~= tes3.player or
e.target.object.objectType ~= tes3.objectType.npc or
not config.disableInteraction then
return
end
if tes3.player.data.NPCsGoHome.intruding and not isIgnoredNPC(e.target) then
tes3.messageBox(string.format("%s: Get out before I call the guards!", e.target.object.name))