Delayed follower rescanning
This commit is contained in:
parent
3b78c86e79
commit
6eb5841745
Binary file not shown.
@ -16,6 +16,7 @@ int iFollowerIndex = 0
|
|||||||
bool bAtHome = false
|
bool bAtHome = false
|
||||||
bool bRescanHome = false
|
bool bRescanHome = false
|
||||||
bool bRescanPersistent = false
|
bool bRescanPersistent = false
|
||||||
|
bool bRescanFollowers = false
|
||||||
ObjectReference lastDestContainer = None
|
ObjectReference lastDestContainer = None
|
||||||
bool lastDestIsPersistent = false
|
bool lastDestIsPersistent = false
|
||||||
int iUpdateCount
|
int iUpdateCount
|
||||||
@ -39,20 +40,8 @@ Event OnLocationChange(Location akOldLoc, Location akNewLoc)
|
|||||||
bAtHome = akNewLoc && akNewLoc.HasKeyword(LocTypePlayerHouse)
|
bAtHome = akNewLoc && akNewLoc.HasKeyword(LocTypePlayerHouse)
|
||||||
lastDestContainer = None
|
lastDestContainer = None
|
||||||
|
|
||||||
int iCurrentFollowers = 0;
|
bRescanFollowers = true
|
||||||
Actor[] aFollowers = ETR_Functions.GetPlayerFollowers()
|
RegisterForSingleUpdate(3.0)
|
||||||
int i = aFollowers.length
|
|
||||||
while i > 0
|
|
||||||
i -= 1
|
|
||||||
iCurrentFollowers += aFollowers[i].GetFormID()
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
if iCurrentFollowers != iFollowerIndex
|
|
||||||
iFollowerIndex = iCurrentFollowers
|
|
||||||
bRescanHome = false
|
|
||||||
bRescanPersistent = false
|
|
||||||
RegisterForSingleUpdate(5.0) ; wait until followers load into the location
|
|
||||||
endif
|
|
||||||
|
|
||||||
endEvent
|
endEvent
|
||||||
|
|
||||||
@ -65,6 +54,25 @@ EndEvent
|
|||||||
|
|
||||||
Event OnUpdate()
|
Event OnUpdate()
|
||||||
|
|
||||||
|
if bRescanFollowers
|
||||||
|
bRescanFollowers = false
|
||||||
|
|
||||||
|
int iCurrentFollowers = 0;
|
||||||
|
Actor[] aFollowers = ETR_Functions.GetPlayerFollowers()
|
||||||
|
int i = aFollowers.length
|
||||||
|
while i > 0
|
||||||
|
i -= 1
|
||||||
|
iCurrentFollowers += aFollowers[i].GetFormID()
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
if iCurrentFollowers == iFollowerIndex
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
iFollowerIndex = iCurrentFollowers
|
||||||
|
Debug.Notification("Team changed, rescanning")
|
||||||
|
endif
|
||||||
|
|
||||||
if UI.IsMenuOpen("ContainerMenu")
|
if UI.IsMenuOpen("ContainerMenu")
|
||||||
RegisterForMenu("ContainerMenu")
|
RegisterForMenu("ContainerMenu")
|
||||||
return
|
return
|
||||||
@ -81,11 +89,12 @@ Event OnUpdate()
|
|||||||
Debug.Notification("Running Found OnUpdate " + iUpdateCount)
|
Debug.Notification("Running Found OnUpdate " + iUpdateCount)
|
||||||
|
|
||||||
if bRescanHome
|
if bRescanHome
|
||||||
|
bRescanHome = false
|
||||||
|
|
||||||
if lastDestContainer && lastDestContainer as Actor && (lastDestContainer as Actor).IsPlayerTeammate()
|
if lastDestContainer && lastDestContainer as Actor && (lastDestContainer as Actor).IsPlayerTeammate()
|
||||||
lastDestContainer = None
|
lastDestContainer = None
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
bRescanHome = false
|
|
||||||
|
|
||||||
if lastDestContainer && lastDestContainer as PlayerBookShelfContainerScript
|
if lastDestContainer && lastDestContainer as PlayerBookShelfContainerScript
|
||||||
int iLimit = 10
|
int iLimit = 10
|
||||||
|
Loading…
x
Reference in New Issue
Block a user