extremely basic interop module

for now only exposes guard following player
This commit is contained in:
Lilian Jónsdóttir 2020-09-07 16:24:57 -07:00
parent 61d41a8fe2
commit 66353bfaff
2 changed files with 16 additions and 0 deletions

View file

@ -0,0 +1,12 @@
local this = {}
local guard
this.setGuardFollower = function(g)
guard = g
end
this.getGuardFollower = function()
return guard
end
return this

View file

@ -1,5 +1,6 @@
local common = require("celediel.MoreAttentiveGuards.common") local common = require("celediel.MoreAttentiveGuards.common")
local config = require("celediel.MoreAttentiveGuards.config").getConfig() local config = require("celediel.MoreAttentiveGuards.config").getConfig()
local interop = require("celediel.MoreAttentiveGuards.interop")
local this = {} local this = {}
-- {{{ variables and such -- {{{ variables and such
@ -74,6 +75,7 @@ local function stopFollowing(onTimer)
tes3.setAIWander({reference = follower, range = wanderRange, reset = true, idles = idles}) tes3.setAIWander({reference = follower, range = wanderRange, reset = true, idles = idles})
follower = nil follower = nil
interop.setGuardFollower(follower)
end end
local function startTravel() local function startTravel()
@ -161,6 +163,7 @@ this.onDetectSneak = function(e)
if e.isDetected and not follower and not isFollowing then if e.isDetected and not follower and not isFollowing then
follower = e.detector follower = e.detector
interop.setGuardFollower(follower)
-- follow for a time -- follow for a time
startFollowing() startFollowing()
-- else -- uncomment this for extreme debug messages -- else -- uncomment this for extreme debug messages
@ -187,6 +190,7 @@ this.onLoaded = function(e)
dialogueTimer = nil dialogueTimer = nil
ogPosition = nil ogPosition = nil
isFollowing = false isFollowing = false
interop.setGuardFollower(follower)
end end
-- }}} -- }}}