Gracefully disable some SKSE-dependent features

This commit is contained in:
Eddoursul 2024-02-07 16:20:32 +01:00
parent 55865dc379
commit 90a5a2868e
20 changed files with 50 additions and 15 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -13,7 +13,7 @@ int Function GetVersionMinor() global
endFunction endFunction
; get the beta version of SKSE ; get the beta version of SKSE
int Function GetVersionBeta() int Function GetVersionBeta() global
return 0 return 0
endFunction endFunction

View File

@ -5,7 +5,7 @@ Function Enable(FormList referenceList) Global
Int nItems = referenceList.GetSize() Int nItems = referenceList.GetSize()
Int i = 0 Int i = 0
If nItems < 128 && nItems > 1 If nItems < 128 && nItems > 1 && SKSE.GetVersion() > 0
Form[] refArray = referenceList.ToArray() Form[] refArray = referenceList.ToArray()
While i < nItems While i < nItems
(refArray[i] as ObjectReference).EnableNoWait() (refArray[i] as ObjectReference).EnableNoWait()
@ -25,7 +25,7 @@ Function Disable(FormList referenceList) Global
Int nItems = referenceList.GetSize() Int nItems = referenceList.GetSize()
Int i = 0 Int i = 0
If nItems < 128 && nItems > 1 If nItems < 128 && nItems > 1 && SKSE.GetVersion() > 0
Form[] refArray = referenceList.ToArray() Form[] refArray = referenceList.ToArray()
While i < nItems While i < nItems
(refArray[i] as ObjectReference).DisableNoWait() (refArray[i] as ObjectReference).DisableNoWait()

View File

@ -6,10 +6,11 @@ Function RemoveAllItemsSafeVersion(ObjectReference TransferToLoc = NONE)
EndIf EndIf
RemoveItemsIncrementally(Gold001, TransferToLoc) RemoveItemsIncrementally(Gold001, TransferToLoc)
Form[] arrows = _00E_AllAmmos.ToArray()
Int nItems = _00E_AllAmmos.GetSize()
Int i = 0 Int i = 0
While i < arrows.Length While i < nItems
RemoveItemsIncrementally(arrows[i], TransferToLoc) RemoveItemsIncrementally(_00E_AllAmmos.GetAt(i), TransferToLoc)
i += 1 i += 1
EndWhile EndWhile

View File

@ -7,11 +7,13 @@ Int Property LOCK_LEVEL_EXPERT = 75 AutoReadOnly
Int Property LOCK_LEVEL_MASTER = 254 AutoReadOnly Int Property LOCK_LEVEL_MASTER = 254 AutoReadOnly
event OnInit() event OnInit()
RegisterForModEvent("Enderal_UnlockSpellHit", "OnUnlockSpell") OnPlayerLoadGame()
endevent endevent
event OnPlayerLoadGame() event OnPlayerLoadGame()
if SKSE.GetVersion() > 0
RegisterForModEvent("Enderal_UnlockSpellHit", "OnUnlockSpell") RegisterForModEvent("Enderal_UnlockSpellHit", "OnUnlockSpell")
endif
endevent endevent
Event OnUnlockSpell(string eventName, string strArg, float fSpellFormID, Form containerForm) Event OnUnlockSpell(string eventName, string strArg, float fSpellFormID, Form containerForm)

View File

@ -29,6 +29,7 @@ Function UpdateAutoSaveInterval()
if SKSE.GetVersion() <= 0 if SKSE.GetVersion() <= 0
UnregisterForUpdate() UnregisterForUpdate()
Debug.Trace("NO SKSE: timed autosaves are disabled")
return return
endif endif

View File

@ -8,6 +8,14 @@ int function _GetScriptVersion() Global
return 1 return 1
endFunction endFunction
event OnGameReload()
if SKSE.GetVersion() == 0
Debug.Trace("NO SKSE: the Mod Configuration Menu is disabled")
return
endif
parent.OnGameReload()
endevent
Event OnPageReset(string page) Event OnPageReset(string page)
; adding options to rebind new key options: 1) Hero menu 2) meditation 3) Phasmalist summon apparition 4) Horseflute ; adding options to rebind new key options: 1) Hero menu 2) meditation 3) Phasmalist summon apparition 4) Horseflute

View File

@ -38,15 +38,20 @@ EndFunction
;===================================================================================== ;=====================================================================================
Event OnInit() Event OnInit()
If self == PlayerREF OnPlayerLoadGame()
GoToState("RealPlayer")
RegisterForActions()
EndIf
EndEvent EndEvent
Event OnPlayerLoadGame() Event OnPlayerLoadGame()
If self == PlayerREF ; A check just in case. Most likely this condition is always True If self == PlayerREF && SKSE.GetVersion() > 0
if GetState() != "RealPlayer"
GoToState("RealPlayer")
endif
RegisterForActions() RegisterForActions()
else
Debug.Trace("NO SKSE: individual shout cooldowns are disabled")
if GetState() != "Disabled"
GoToState("Disabled")
endif
EndIf EndIf
EndEvent EndEvent
@ -90,6 +95,10 @@ State RealPlayer
EndState EndState
state Disabled
; Do nothing
endstate
;===================================================================================== ;=====================================================================================
; PROPERTIES ; PROPERTIES
;===================================================================================== ;=====================================================================================

View File

@ -111,6 +111,11 @@ endEvent
event OnGameReload() event OnGameReload()
if SKSE.GetVersion() == 0
Debug.Trace("NO SKSE: companion health bars are disabled")
return
endif
parent.OnGameReload() parent.OnGameReload()
If Game.GetModByName("SkyUI_SE.esp") == 255 || _00E_ActorHealthBarsEnabled.GetValue() == 0 If Game.GetModByName("SkyUI_SE.esp") == 255 || _00E_ActorHealthBarsEnabled.GetValue() == 0

View File

@ -12,8 +12,13 @@ GlobalVariable Property ProphetDiceLostGold Auto
GlobalVariable Property _SAG_ProphDiceWonGold Auto GlobalVariable Property _SAG_ProphDiceWonGold Auto
Event OnInit() Event OnInit()
if SKSE.GetVersion() > 0
RegisterForMenu("Journal Menu") RegisterForMenu("Journal Menu")
else
Debug.Trace("NO SKSE: Dice Jack stats display is disabled")
endif
EndEvent EndEvent
Event OnPlayerLoadGame() Event OnPlayerLoadGame()
OnInit() OnInit()
EndEvent EndEvent

View File

@ -13,7 +13,11 @@ String sLostBetsValue
Event OnInit() Event OnInit()
if SKSE.GetVersion() > 0
RegisterForMenu("Journal Menu") RegisterForMenu("Journal Menu")
else
Debug.Trace("NO SKSE: card game stats display is disabled")
endif
endEvent endEvent
Event OnPlayerLoadGame() Event OnPlayerLoadGame()