From 8e20664142eaf60e2fbbc517e6f0d25534964dc1 Mon Sep 17 00:00:00 2001 From: Scrivener07 Date: Sun, 22 Jul 2018 12:19:45 -0400 Subject: [PATCH] Fixes for improper loading. --- .../Fallout/Overlays/Framework.psc | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/Data/Scripts/Source/FO4_Overlays/Fallout/Overlays/Framework.psc b/Data/Scripts/Source/FO4_Overlays/Fallout/Overlays/Framework.psc index 177ffca..9457fc4 100644 --- a/Data/Scripts/Source/FO4_Overlays/Fallout/Overlays/Framework.psc +++ b/Data/Scripts/Source/FO4_Overlays/Fallout/Overlays/Framework.psc @@ -39,9 +39,9 @@ EndEvent Event Actor.OnItemEquipped(Actor sender, Form akBaseObject, ObjectReference akReference) - If (ItemEquipped(akBaseObject)) - Equipment() + If (ItemFilter(akBaseObject)) WriteLine(self, "Actor.OnItemEquipped", "akBaseObject="+akBaseObject) + Equipment() EndIf EndEvent @@ -54,7 +54,7 @@ EndEvent ; Methods ;--------------------------------------------- -bool Function ItemEquipped(Form item) +bool Function ItemFilter(Form item) Armor armo = item as Armor return armo && HasSlotMask(armo, kSlotMask47) EndFunction @@ -75,41 +75,37 @@ EndFunction string Function GetURI() - int slot = GetSlot() - If (slot > Invalid) - string value - ObjectMod[] mods = Player.GetWornItemMods(slot) - If (mods) - int index = 0 - While (index < mods.Length) - value = GetLooseMod(mods[index]) - If (!StringIsNoneOrEmpty(value)) - WriteLine(self, "GetURI", "LooseMod:'"+value+"'") - return value - EndIf - index += 1 - EndWhile - EndIf - ;--------------------------------------------- - value = GetDefault(slot) - WriteLine(self, "GetURI", "Default:'"+value+"'") - return value - Else - return "" - EndIf -EndFunction - - -int Function GetSlot() int slot = 0 While (slot <= BipedEyes) - Form item = Player.GetWornItem(slot, ThirdPerson).Item - If (ItemEquipped(item)) - return slot + Actor:WornItem worn = Player.GetWornItem(slot, ThirdPerson) + If (ItemFilter(worn.Item)) + string value + ObjectMod[] mods = Player.GetWornItemMods(slot) + If (mods) + int index = 0 + While (index < mods.Length) + value = GetLooseMod(mods[index]) + If (!StringIsNoneOrEmpty(value)) + WriteLine(self, "GetURI", "LooseMod:'"+value+"'") + return value + EndIf + index += 1 + EndWhile + EndIf + ;--------------------------------------------- + value = GetWorldModel(worn) + If (!StringIsNoneOrEmpty(value)) + WriteLine(self, "GetURI", "WorldModel:'"+value+"'") + return value + Else + value = GetModel(worn) + WriteLine(self, "GetURI", "Model:'"+value+"'") + return value + EndIf EndIf slot += 1 EndWhile - return Invalid + return "" EndFunction @@ -124,19 +120,23 @@ string Function GetLooseMod(ObjectMod omod) EndFunction -string Function GetDefault(int slot) - {Derived from the armor model name.} - return Player.GetWornItem(slot, ThirdPerson).ModelName +string Function GetWorldModel(Actor:WornItem worn) + {Derived from the armor world model path.} + Armor armo = worn.Item as Armor + If (armo && armo.HasWorldModel()) + return armo.GetWorldModelPath() + Else + return "" + EndIf EndFunction - -string Function GetWorldModel(int slot) - return Player.GetWornItem(slot, ThirdPerson).Item.GetWorldModelPath() +string Function GetModel(Actor:WornItem worn) + {Derived from the armor model name.} + return worn.ModelName EndFunction - bool Function TryChange(string value) If (value != URI) WriteChangedValue(self, "URI", URI, value) @@ -188,16 +188,16 @@ State Equipped ;--------------------------------------------- Event Actor.OnItemEquipped(Actor akSender, Form akBaseObject, ObjectReference akReference) - If (ItemEquipped(akBaseObject)) - Equipment() + If (ItemFilter(akBaseObject)) WriteLine(self, "Equipped.Actor.OnItemEquipped", "akBaseObject="+akBaseObject) + Equipment() EndIf EndEvent Event Actor.OnItemUnequipped(Actor akSender, Form akBaseObject, ObjectReference akReference) - If (ItemEquipped(akBaseObject)) + If (ItemFilter(akBaseObject)) + WriteLine(self, "Equipped.Actor.OnItemUnequipped", "akBaseObject="+akBaseObject) Equipment() - WriteLine(self, "Equipped.Actor.OnItemEquipped", "akBaseObject="+akBaseObject) EndIf EndEvent