Page MenuHomeFeedback Tracker

Attachments.c Changes in 5_Mission Causes CanDisplayAttachmentSlot To Not Update
Closed, ResolvedPublic

Description

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!

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10
Category
General
Steps To Reproduce

Run CanDisplayAttachmentSlots in weapon's script and have it set to swap between showing two attachment slots (Optics being easiest). Attach one attachment from one slot, then remove and attach a different attachment from a different slot. If it doesn't update, drop the weapon and pick back up.,

Event Timeline

Geez changed the task status from New to Assigned.Jan 6 2022, 1:46 PM
Geez closed this task as Resolved.Feb 17 2022, 2:55 PM
Geez claimed this task.
Geez added a subscriber: Geez.

Hello CashewSan.
The issue has been fixed internally and the fix will appear with the upcoming experimental update.
Regards,
Geez

lava76 added a subscriber: lava76.Mar 11 2022, 12:06 AM
lava76 removed a subscriber: lava76.
Geez added a comment.Apr 25 2022, 1:38 PM
This comment was removed by Geez.