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
; get the beta version of SKSE
int Function GetVersionBeta()
int Function GetVersionBeta() global
return 0
endFunction

View File

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

View File

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

View File

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

View File

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

View File

@ -8,6 +8,14 @@ int function _GetScriptVersion() Global
return 1
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)
; 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()
If self == PlayerREF
GoToState("RealPlayer")
RegisterForActions()
EndIf
OnPlayerLoadGame()
EndEvent
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()
else
Debug.Trace("NO SKSE: individual shout cooldowns are disabled")
if GetState() != "Disabled"
GoToState("Disabled")
endif
EndIf
EndEvent
@ -90,6 +95,10 @@ State RealPlayer
EndState
state Disabled
; Do nothing
endstate
;=====================================================================================
; PROPERTIES
;=====================================================================================

View File

@ -111,6 +111,11 @@ endEvent
event OnGameReload()
if SKSE.GetVersion() == 0
Debug.Trace("NO SKSE: companion health bars are disabled")
return
endif
parent.OnGameReload()
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
Event OnInit()
RegisterForMenu("Journal Menu")
if SKSE.GetVersion() > 0
RegisterForMenu("Journal Menu")
else
Debug.Trace("NO SKSE: Dice Jack stats display is disabled")
endif
EndEvent
Event OnPlayerLoadGame()
OnInit()
EndEvent

View File

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