@@ -12,9 +12,15 @@ namespace RE
1212
1313 BSTArray<BGSKeyword*> keywordsAmmo;
1414 std::unordered_map<BGSKeyword*, BGSListForm*> keywordFormlistMap;
15+
16+ BSTArray<BGSKeyword*> keywordsOMOD;
17+
1518 BGSKeyword* noFormlistWEAP;
1619 BGSKeyword* uniqueFormlistWEAP;
1720 BGSKeyword* materialChange;
21+ BGSKeyword* omodAP;
22+
23+ std::vector<std::pair<BGSKeyword*, BGSMod::Attachment::Mod*>> omodFormListMap;
1824
1925 bool InitializeAmmoSwitch () {
2026 // Return true to make sure proper menu audio is played if ammo switch is successfully initiated, otherwise false return.
@@ -168,6 +174,8 @@ namespace RE
168174
169175 if (inventoryItem)
170176 {
177+
178+
171179 ExtraDataList* extraDataList = inventoryItem->stackData ->extra .get ();
172180 BGSObjectInstanceExtra* objectModData = (BGSObjectInstanceExtra*)extraDataList->GetByType (EXTRA_DATA_TYPE::kObjectInstance );
173181 if (objectModData)
@@ -190,12 +198,15 @@ namespace RE
190198 TESDataHandler* dataHandler = TESDataHandler::GetSingleton ();
191199 BSTArray<TESForm*> ammoEntries = dataHandler->formArrays [std::to_underlying (ENUM_FORM_ID::kAMMO )];
192200 BSTArray<TESForm*> keywordEntries = dataHandler->formArrays [std::to_underlying (ENUM_FORM_ID::kKYWD )];
201+ BSTArray<TESForm*> omodEntries = dataHandler->formArrays [std::to_underlying (ENUM_FORM_ID::kOMOD )];
193202 noFormlistWEAP = dataHandler->LookupForm <BGSKeyword>(0x2D9AB8 , " FalloutCascadia.esm" );
194203 uniqueFormlistWEAP = dataHandler->LookupForm <BGSKeyword>(0x2D9AB9 , " FalloutCascadia.esm" );
204+ omodAP = dataHandler->LookupForm <BGSKeyword>(0x0008FC , " CAS_AmmoSwitch_OMOD.esp" );
195205 materialChange = dataHandler->LookupForm <BGSKeyword>(0x000001 , " CAS_AmmoSwitch_Extension.esp" );
196206
197207 const char * standardListPrefix = " CAS_AmmoSwitch_Standard_" ;
198208 const char * uniqueListPrefix = " CAS_AmmoSwitch_Unique_" ;
209+ const char * omodPrefix = " CAS_AmmoSwitch_OMOD_" ;
199210
200211 for (TESForm* tesForm : keywordEntries)
201212 {
@@ -207,7 +218,14 @@ namespace RE
207218 keywordsAmmo.push_back ((BGSKeyword*)tesForm);
208219 keywordFormlistMap[(BGSKeyword*)tesForm] = new BGSListForm;
209220 }
210- }
221+
222+ if (strncmp (formEditorID, omodPrefix, strlen (omodPrefix)) == 0 )
223+ {
224+ DEBUG (" 'AmmoSwitch::DefineAmmoLists' - matching keyword: {}, added to 'keywordsOMOD'." , formEditorID);
225+ keywordsOMOD.push_back ((BGSKeyword*)tesForm);
226+ }
227+ }
228+
211229 for (TESForm* tesForm : ammoEntries)
212230 {
213231 TESAmmo* tesAMMO = static_cast <TESAmmo*>(tesForm);
@@ -240,6 +258,17 @@ namespace RE
240258 }
241259 }
242260 }
261+
262+ for (TESForm* tesForm : omodEntries)
263+ {
264+ BGSMod::Attachment::Mod* omod = static_cast <BGSMod::Attachment::Mod*>(tesForm);
265+ BGSKeyword* currentKeyword = BGSKeyword::GetTypedKeywordByIndex (KeywordType::kAttachPoint , omod->attachPoint .keywordIndex );
266+ if ()
267+ if (currentKeyword == omodAP)
268+ {
269+
270+ }
271+ }
243272 DEBUG (" 'AmmoSwitch::DefineAmmoLists' - 'keywordFormlistMap' size: {}" , keywordFormlistMap.size ());
244273 }
245274
0 commit comments