Do not request autosaves when player is riding or swimming; removed unused starting/stopping functions

This commit is contained in:
Eddoursul 2023-12-04 01:38:52 +01:00
parent 962a0861cd
commit a3554130b4
2 changed files with 12 additions and 38 deletions

View File

@ -14,14 +14,10 @@ Scriptname _00E_AutoSaveSystem_Functions extends Quest
; 1: Unknown flag.
Event OnUpdate()
If bAutosaveSystemStopped
return
EndIf
Actor PlayerREF = Game.GetForm(0x14) as Actor
If PlayerREF.IsInCombat() || ! Game.IsFightingControlsEnabled() || PlayerREF.IsDead() || Utility.IsInMenuMode() || UI.IsTextInputEnabled() || UI.IsMenuOpen("Dialogue Menu")
If PlayerREF.IsInCombat() || PlayerREF.IsOnMount() || PlayerREF.IsSwimming() || ! Game.IsFightingControlsEnabled() || PlayerREF.IsDead() || Utility.IsInMenuMode() || UI.IsTextInputEnabled() || UI.IsMenuOpen("Dialogue Menu")
RegisterForSingleUpdate(5)
return
endif
@ -41,42 +37,20 @@ EndEvent
; called from _00E_AutosaveIntervalAlias to update ini setting fAutosaveEveryXMins in case it was changed
Function UpdateAutoSaveInterval()
fUpdateTime = GetAutosaveEveryXMins()
if SKSE.GetVersion() <= 0
UnregisterForUpdate()
return
endif
fUpdateTime = Utility.GetIniFloat("fAutosaveEveryXMins:SaveGame")
If fUpdateTime <= 0.0 ; just in case
fUpdateTime = 30
EndIf
RegisterForSingleUpdate(fUpdateTime*60)
EndFunction
Function StopAutosaveSystem()
bAutosaveSystemStopped = true
UnregisterForUpdate()
EndFunction
Function ResumeAutosaveSystemInXMinutes(float _fMinutes = 0.0)
If _fMinutes == 0.0
_fMinutes = fUpdateTime
If _fMinutes <= 0.0 ; just in case
_fMinutes = 30
EndIf
EndIf
RegisterForSingleUpdate(_fMinutes*60)
bAutosaveSystemStopped = false
EndFunction
float function GetAutosaveEveryXMins()
float fUpdateMinutes = Utility.GetIniFloat("fAutosaveEveryXMins:SaveGame")
If fUpdateMinutes <= 0.0 ; just in case
fUpdateMinutes = 30
EndIf
return fUpdateMinutes
endfunction
bool bAutosaveSystemStopped = false
int iAutosaveIndex = 0
float fUpdateTime