Recent changes to attachments.c, located under 5_mission/gui/inventorynew/, has caused CanDisplayAttachmentSlot to not update correctly (for weapons at least).
Here's what my code looks like, weaponRailAK being a custom slot:
override bool CanDisplayAttachmentSlot( string slot_name ) { if (!super.CanDisplayAttachmentSlot(slot_name)) return false; if ( slot_name == "weaponOptics" ) { return this.FindAttachmentBySlotName("weaponOptics") != NULL; } if ( slot_name == "weaponOptics" ) { return this.FindAttachmentBySlotName("weaponRailAK") == NULL; } if ( slot_name == "weaponOpticsAK" ) { return this.FindAttachmentBySlotName("weaponOptics") == NULL; } return true; }
Basically, hiding the weaponOptics attachment slot unless the weaponRailAk slot is attached, and replacing it with weaponOpticsAK when not attached.
With screenshot 1, you're seeing the optic attached, but not showing in the attachment slot. Dropping the weapon and picking it back up fixes it (shown in screenshot 2). But when the rail and optic are removed and replaced with a optic from weaponOpticsAK, it updates the rail being removed, but does not update the original optic being removed (shown in screenshot 3). It's once again fixed by dropping it and picking it back up.
I'm not the only modder who has run into this issue, other mods running similar code that worked before have run into the same issue since 1.15 release. Even with something simpler with no rail in-between and just two optic slots swapping, the issue still persists. Unsure if this change was intentional or not. Looking to have it fixed or at least explained if I'm missing something, thank you!