About this mod
Adds additional eyewear to Myopia Simulator (Immersive Glasses) mod.
- Requirements
- Permissions and credits
Only the Fallout 4 base game is required, but if you have additional DLC packs then the eyewear from those are recognized and added. Also, the following other mods are recognized and added as well. What other eyewear mods would you like supported? Report them in the comments.
The mod consists of a single Quest PrescriptionEyewearQuest that only runs a single script that injects the glasses entries from an eyewear database "DB" as follows:
Scriptname PrescriptionEyewear:PrescriptionEyewearScript extends Quest
{Inject eyewear into Immersive Glasses Form Lists}
Group Database
Eyewear[] Property DB Auto Const Mandatory
{database of eyewear}
EndGroup
Struct Eyewear
String name
{Name of the Form}
String plugin
{Plugin Filename}
Int id
{Form ID as Integer}
Int type
{0=disabled, 1=Immersive eyeglasses, 2=Immersive sunglasses}
EndStruct
FormList glasses
FormList sunglasses
Event OnQuestInit()
RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame")
Inject()
EndEvent
Event OnQuestShutdown()
UnregisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame")
Remove()
EndEvent
Event Actor.OnPlayerLoadGame(Actor akSender)
Inject()
EndEvent
Bool Function LoadFormLists()
If !Game.IsPluginInstalled("immersiveglasses.esp")
glasses = None
sunglasses = None
Else
glasses = Game.GetFormFromFile(0x07000FA0, "immersiveglasses.esp") as FormList
sunglasses = Game.GetFormFromFile(0x07000FA1, "immersiveglasses.esp") as FormList
EndIf
Debug.Trace("[Prescription Eyewear] FormList Glasses:" + glasses + " Sunglasses:" + sunglasses)
Return glasses != None && sunglasses != None
EndFunction
Function Remove()
If LoadFormLists()
glasses.Revert()
sunglasses.Revert()
EndIf
EndFunction
Function Inject()
If LoadFormLists()
Int i = 0
While i < DB.Length
Eyewear e = DB[i] as Eyewear
If Game.IsPluginInstalled(e.plugin)
Armor a = Game.GetFormFromFile(e.id, e.plugin) as Armor
If e.type == 1
InjectFormList(glasses, a)
ElseIf e.type == 2
InjectFormList(sunglasses, a)
Endif
EndIf
i += 1
EndWhile
EndIf
EndFunction
Function InjectFormList(FormList akList, Armor akItem)
If akList != None && akItem != None && !akList.HasForm(akItem)
Debug.Trace("[Prescription Eyewear] Injecting Name:" + akItem.GetName() + " Form:" + akItem + " into FormList:" + akList)
akList.AddForm(akItem)
EndIf
EndFunction
Supporting eyewear from other mods only requires adding the entries to the eyewear database "DB". On game load, the new entries should be injected into the glasses and sunglasses lists if they are not there already. It also reverts the changes (theoretically if Bethesda docs are to be believed from the FormList documentation on the "Revert" function) if the Quest shuts down.
This mod is great if used with mods like Glasses Drop or Combat Strip (NSFW) where your eyewear may get unequipped.
Seeing is believing, so load up the mod and enjoy!