Optimized playerTransformStorage

This commit is contained in:
Eddoursul 2024-02-13 11:59:56 +01:00
parent 9adcab8fa6
commit c0a7c2f880
4 changed files with 36 additions and 34 deletions

Binary file not shown.

View File

@ -413,8 +413,10 @@ Function _InitAchemyControl()
EndIf EndIf
EndIf EndIf
; Re-register menu listener to stay resilient to co-save deletion or corruption if SKSE.GetVersion()
RegisterForMenu("Crafting Menu") ; Re-register menu listener to stay resilient to co-save deletion or corruption
RegisterForMenu("Crafting Menu")
endif
EndFunction EndFunction

View File

@ -30,11 +30,11 @@ Int Property whatKindRight Auto
; Skipped compiler generated GotoState ; Skipped compiler generated GotoState
Event OnInit() Event OnInit()
originalRace = Game.GetPlayer().GetRace() originalRace =(Game.GetForm(0x14) as Actor).GetRace()
EndEvent EndEvent
Function checkForEquipedItems() Function checkForEquipedItems()
Actor PlayerRef = Game.GetPlayer() Actor PlayerRef = Game.GetForm(0x14) as Actor
EquippedItemLeft = PlayerRef.GetEquippedObject(0) EquippedItemLeft = PlayerRef.GetEquippedObject(0)
EquippedItemRight = PlayerRef.GetEquippedObject(1) EquippedItemRight = PlayerRef.GetEquippedObject(1)
If !EquippedItemLeft If !EquippedItemLeft
@ -55,24 +55,24 @@ Function checkForEquipedItems()
Else Else
whatKindLeft = 1 whatKindLeft = 1
EndIf EndIf
armor1 = Game.GetPlayer().GetWornForm(1) as Armor armor1 = PlayerRef.GetWornForm(1) as Armor
armor2 = Game.GetPlayer().GetWornForm(2) as Armor armor2 = PlayerRef.GetWornForm(2) as Armor
armor3 = Game.GetPlayer().GetWornForm(4) as Armor armor3 = PlayerRef.GetWornForm(4) as Armor
armor4 = Game.GetPlayer().GetWornForm(8) as Armor armor4 = PlayerRef.GetWornForm(8) as Armor
armor5 = Game.GetPlayer().GetWornForm(16) as Armor armor5 = PlayerRef.GetWornForm(16) as Armor
armor6 = Game.GetPlayer().GetWornForm(32) as Armor armor6 = PlayerRef.GetWornForm(32) as Armor
armor7 = Game.GetPlayer().GetWornForm(64) as Armor armor7 = PlayerRef.GetWornForm(64) as Armor
armor8 = Game.GetPlayer().GetWornForm(128) as Armor armor8 = PlayerRef.GetWornForm(128) as Armor
armor9 = Game.GetPlayer().GetWornForm(256) as Armor armor9 = PlayerRef.GetWornForm(256) as Armor
armor10 = Game.GetPlayer().GetWornForm(512) as Armor armor10 = PlayerRef.GetWornForm(512) as Armor
armor11 = Game.GetPlayer().GetWornForm(1024) as Armor armor11 = PlayerRef.GetWornForm(1024) as Armor
armor12 = Game.GetPlayer().GetWornForm(2048) as Armor armor12 = PlayerRef.GetWornForm(2048) as Armor
armor13 = Game.GetPlayer().GetWornForm(4096) as Armor armor13 = PlayerRef.GetWornForm(4096) as Armor
armor14 = Game.GetPlayer().GetWornForm(8192) as Armor armor14 = PlayerRef.GetWornForm(8192) as Armor
EndFunction EndFunction
Function equipeItems() Function equipeItems()
Actor PlayerRef = Game.GetPlayer() Actor PlayerRef = Game.GetForm(0x14) as Actor
If whatKindRight == 2 If whatKindRight == 2
PlayerRef.EquipSpell(EquippedItemRight as Spell, 1) PlayerRef.EquipSpell(EquippedItemRight as Spell, 1)
Else Else
@ -92,45 +92,45 @@ Function equipeItems()
endif endif
EndIf EndIf
If armor1 If armor1
Game.GetPlayer().EquipItem(armor1 as Form, False, True) PlayerRef.EquipItem(armor1 as Form, False, True)
EndIf EndIf
If armor2 If armor2
Game.GetPlayer().EquipItem(armor2 as Form, False, True) PlayerRef.EquipItem(armor2 as Form, False, True)
EndIf EndIf
If armor3 If armor3
Game.GetPlayer().EquipItem(armor3 as Form, False, True) PlayerRef.EquipItem(armor3 as Form, False, True)
EndIf EndIf
If armor4 If armor4
Game.GetPlayer().EquipItem(armor4 as Form, False, True) PlayerRef.EquipItem(armor4 as Form, False, True)
EndIf EndIf
If armor5 If armor5
Game.GetPlayer().EquipItem(armor5 as Form, False, True) PlayerRef.EquipItem(armor5 as Form, False, True)
EndIf EndIf
If armor6 If armor6
Game.GetPlayer().EquipItem(armor6 as Form, False, True) PlayerRef.EquipItem(armor6 as Form, False, True)
EndIf EndIf
If armor7 If armor7
Game.GetPlayer().EquipItem(armor7 as Form, False, True) PlayerRef.EquipItem(armor7 as Form, False, True)
EndIf EndIf
If armor8 If armor8
Game.GetPlayer().EquipItem(armor8 as Form, False, True) PlayerRef.EquipItem(armor8 as Form, False, True)
EndIf EndIf
If armor9 If armor9
Game.GetPlayer().EquipItem(armor9 as Form, False, True) PlayerRef.EquipItem(armor9 as Form, False, True)
EndIf EndIf
If armor10 If armor10
Game.GetPlayer().EquipItem(armor10 as Form, False, True) PlayerRef.EquipItem(armor10 as Form, False, True)
EndIf EndIf
If armor11 If armor11
Game.GetPlayer().EquipItem(armor11 as Form, False, True) PlayerRef.EquipItem(armor11 as Form, False, True)
EndIf EndIf
If armor12 If armor12
Game.GetPlayer().EquipItem(armor12 as Form, False, True) PlayerRef.EquipItem(armor12 as Form, False, True)
EndIf EndIf
If armor13 If armor13
Game.GetPlayer().EquipItem(armor13 as Form, False, True) PlayerRef.EquipItem(armor13 as Form, False, True)
EndIf EndIf
If armor14 If armor14
Game.GetPlayer().EquipItem(armor14 as Form, False, True) PlayerRef.EquipItem(armor14 as Form, False, True)
EndIf EndIf
EndFunction EndFunction