Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Explosives] Self-Interaction Menu Breaking #7637

Closed
GCodeman opened this issue Apr 14, 2020 · 9 comments
Closed

[Explosives] Self-Interaction Menu Breaking #7637

GCodeman opened this issue Apr 14, 2020 · 9 comments

Comments

@GCodeman
Copy link

Mods

  • Arma 3: 1.96.146114
  • CBA: 3.15.0
  • ACE3: 3.13.1

Description:
After hovering your cursor over the Explosives portion of the ACE Self Interaction Menu then dying, the Explosives Tab will be permanently stuck with whatever options you had upon death. This persists regardless of dying again or dropping/gaining any explosives. Also, upon acquiring new explosives, the option to place them does not get added to your menu.

Steps to reproduce:
-Take any explosive
-Open self interaction menu and hover cursor over explosive, but do not place it
-Die in any fashion or press respawn from the menu

Expected behavior:
-Upon respawning, your explosives menu should reset but does not.

Where did the issue occur?

  • Self-Hosted Multiplayer (with several other players)
  • Editor (Hosted in multiplayer editor, but playing only by myself)

Video
https://www.youtube.com/watch?v=SfTBHNMH19g

@GCodeman
Copy link
Author

I just noticed that it also occurs when opening the self-interaction menu at all when an explosive is in your inventory, not just when hovering over an explosive.

@bux
Copy link
Member

bux commented Apr 14, 2020

RPT is missing

@GCodeman
Copy link
Author

ArmA updated to 1.98.146303 today, so I made a new RPT file.
https://pastebin.com/G7cEYt34

@Whigital
Copy link
Contributor

Can confirm this, i think it has to do with how ACE_player reference changes when killed/respawned. Depending on when the cba_event_loadoutEvent is triggered, ace_common_fnc_eraseCache might clear the variables on the ragdoll, since the reference changed.

init.sqf
Report_Data = {
    params [
        "_event"
    ];

    _log = {
        params [
            "_cap",
            "_msg"
        ];

        diag_log (format ["%1: %2", _cap, _msg]);
    };

    private _cache = missionNamespace getVariable ["ace_common_clearCache_cba_events_loadoutEvent", nil];
    private _actions = ACE_player getVariable ["ace_explosives_explosiveActions", []];
    
    diag_log (format ["########## %1 ##########", _event]);
    diag_log (format ["player == %1", player]);
    diag_log (format ["ACE_player == %1", ACE_player]);
    ["ace_common_clearCache_cba_events_loadoutEvent", _cache] call _log;
    ["ace_explosives_explosiveActions", _actions] call _log;
};

if (hasInterface) then {
    // Loadout event tracker ....
    LoadoutEH = [
        "cba_events_loadoutEvent", {
            ["cba_events_loadoutEvent"] call Report_Data;
    }] call CBA_fnc_addEventHandler;

    // ACE death event tracker ....
    DeathEH = [
        "ace_medical_death", {
            ["ace_medical_death"] call Report_Data;

            // [ACE_player, "ace_explosives_explosiveActions"] call ace_common_fnc_eraseCache;
    }] call CBA_fnc_addEventHandler;

    // Respawn event tracker ....
    RespawnEH = (player addEventHandler [
        "Respawn", {
            ["Respawn"] call Report_Data;

            // [{[ACE_player, "ace_explosives_explosiveActions"] call ace_common_fnc_eraseCache;}, [], 1] call CBA_fnc_waitAndExecute;

            0 spawn {
                ["Pre-Cleared"] call Report_Data;
                diag_log "Waiting for 'ACE_player' to become 'player' ....";
                waitUntil {ACE_player == player};
                diag_log "Clearing ace_explosives_explosiveActions variable ....";
                [ACE_player, "ace_explosives_explosiveActions"] call ace_common_fnc_eraseCache;
                ["Cleared"] call Report_Data;
            };
        }]
    );

    // Killed event tracker ....
    KilledEH = (player addEventHandler [
        "Killed", {
            ["Killed"] call Report_Data;

            // [{[ACE_player, "ace_explosives_explosiveActions"] call ace_common_fnc_eraseCache;}, [], 1] call CBA_fnc_waitAndExecute;
        }]
    );
};
Logging output
23:45:55 "########## Killed ##########"
23:45:55 "player == B Alpha 1-1:1 (PFC.Whigital)"
23:45:55 "ACE_player == 1a8dae21740# 8: b_soldier_01.p3d"
23:45:55 "ace_common_clearCache_cba_events_loadoutEvent: [[1a8dae21740# 8: b_soldier_01.p3d,""ace_dogtags_actionsCache""],[1a8dae21740# 8: b_soldier_01.p3d,""ace_tagging_checkRequiredItemsCache""],[1a8dae21740# 8: b_soldier_01.p3d,""ace_explosives_explosiveActions""]]"
23:45:55 "ace_explosives_explosiveActions: [3804.82,[[[""APERSMine_Range_Mag"",""VS-50 Anti-Personnel Mine (3)"",""\A3\Weapons_F\Data\UI\gear_mine_AP_CA.paa"",{[{_this call ace_explosives_fnc_setupExplosive}, _this] call CBA_fnc_execNextFrame},{true},{},""APERSMine_Range_Mag"",{[0, 0, 0]},2,[false,false,false,false,false],{}],[],1a8dae21740# 8: b_soldier_01.p3d],[[""APERSBoundingMine_Range_Mag"",""M26 Anti-Personnel Bounding Mine (3)"",""\A3\Weapons_F\Data\UI\gear_mine_AP_bouncing_CA.paa"",{[{_this call ace_explosives_fnc_setupExplosive}, _this] call CBA_fnc_execNextFrame},{true},{},""APERSBoundingMine_Range_Mag"",{[0, 0, 0]},2,[false,false,false,false,false],{}],[],1a8dae21740# 8: b_soldier_01.p3d],[[""ClaymoreDirectionalMine_Remote_Mag"",""M18A1 Claymore (2)"",""\A3\Weapons_F\Data\UI\gear_mine_AP_miniclaymore_CA.paa"",{[{_this call ace_explosives_fnc_setupExplosive}, _this] call CBA_fnc_execNextFrame},{true},{},""ClaymoreDirectionalMine_Remote_Mag"",{[0, 0, 0]},2,[false,false,false,false,false],{}],[],1a8dae21740# 
23:45:55 "########## Respawn ##########"
23:45:55 "player == B Alpha 1-1:1 (PFC.Whigital)"
23:45:55 "ACE_player == 1a8dae21740# 8: b_soldier_01.p3d"
23:45:55 "ace_common_clearCache_cba_events_loadoutEvent: [[1a8dae21740# 8: b_soldier_01.p3d,""ace_dogtags_actionsCache""],[1a8dae21740# 8: b_soldier_01.p3d,""ace_tagging_checkRequiredItemsCache""],[1a8dae21740# 8: b_soldier_01.p3d,""ace_explosives_explosiveActions""]]"
23:45:55 "ace_explosives_explosiveActions: [3804.82,[[[""APERSMine_Range_Mag"",""VS-50 Anti-Personnel Mine (3)"",""\A3\Weapons_F\Data\UI\gear_mine_AP_CA.paa"",{[{_this call ace_explosives_fnc_setupExplosive}, _this] call CBA_fnc_execNextFrame},{true},{},""APERSMine_Range_Mag"",{[0, 0, 0]},2,[false,false,false,false,false],{}],[],1a8dae21740# 8: b_soldier_01.p3d],[[""APERSBoundingMine_Range_Mag"",""M26 Anti-Personnel Bounding Mine (3)"",""\A3\Weapons_F\Data\UI\gear_mine_AP_bouncing_CA.paa"",{[{_this call ace_explosives_fnc_setupExplosive}, _this] call CBA_fnc_execNextFrame},{true},{},""APERSBoundingMine_Range_Mag"",{[0, 0, 0]},2,[false,false,false,false,false],{}],[],1a8dae21740# 8: b_soldier_01.p3d],[[""ClaymoreDirectionalMine_Remote_Mag"",""M18A1 Claymore (2)"",""\A3\Weapons_F\Data\UI\gear_mine_AP_miniclaymore_CA.paa"",{[{_this call ace_explosives_fnc_setupExplosive}, _this] call CBA_fnc_execNextFrame},{true},{},""ClaymoreDirectionalMine_Remote_Mag"",{[0, 0, 0]},2,[false,false,false,false,false],{}],[],1a8dae21740# 
23:45:55 "########## cba_events_loadoutEvent ##########"
23:45:55 "player == B Alpha 1-1:1 (PFC.Whigital)"
23:45:55 "ACE_player == B Alpha 1-1:1 (PFC.Whigital)"
23:45:55 "ace_common_clearCache_cba_events_loadoutEvent: [[1a8dae21740# 8: b_soldier_01.p3d,""ace_dogtags_actionsCache""],[1a8dae21740# 8: b_soldier_01.p3d,""ace_tagging_checkRequiredItemsCache""],[1a8dae21740# 8: b_soldier_01.p3d,""ace_explosives_explosiveActions""]]"
23:45:55 "ace_explosives_explosiveActions: [3804.82,[[[""APERSMine_Range_Mag"",""VS-50 Anti-Personnel Mine (3)"",""\A3\Weapons_F\Data\UI\gear_mine_AP_CA.paa"",{[{_this call ace_explosives_fnc_setupExplosive}, _this] call CBA_fnc_execNextFrame},{true},{},""APERSMine_Range_Mag"",{[0, 0, 0]},2,[false,false,false,false,false],{}],[],1a8dae21740# 8: b_soldier_01.p3d],[[""APERSBoundingMine_Range_Mag"",""M26 Anti-Personnel Bounding Mine (3)"",""\A3\Weapons_F\Data\UI\gear_mine_AP_bouncing_CA.paa"",{[{_this call ace_explosives_fnc_setupExplosive}, _this] call CBA_fnc_execNextFrame},{true},{},""APERSBoundingMine_Range_Mag"",{[0, 0, 0]},2,[false,false,false,false,false],{}],[],1a8dae21740# 8: b_soldier_01.p3d],[[""ClaymoreDirectionalMine_Remote_Mag"",""M18A1 Claymore (2)"",""\A3\Weapons_F\Data\UI\gear_mine_AP_miniclaymore_CA.paa"",{[{_this call ace_explosives_fnc_setupExplosive}, _this] call CBA_fnc_execNextFrame},{true},{},""ClaymoreDirectionalMine_Remote_Mag"",{[0, 0, 0]},2,[false,false,false,false,false],{}],[],1a8dae21740# 
23:45:55 "########## Pre-Cleared ##########"
23:45:55 "player == B Alpha 1-1:1 (PFC.Whigital)"
23:45:55 "ACE_player == B Alpha 1-1:1 (PFC.Whigital)"
23:45:55 "ace_common_clearCache_cba_events_loadoutEvent: []"
23:45:55 "ace_explosives_explosiveActions: [3804.82,[[[""APERSMine_Range_Mag"",""VS-50 Anti-Personnel Mine (3)"",""\A3\Weapons_F\Data\UI\gear_mine_AP_CA.paa"",{[{_this call ace_explosives_fnc_setupExplosive}, _this] call CBA_fnc_execNextFrame},{true},{},""APERSMine_Range_Mag"",{[0, 0, 0]},2,[false,false,false,false,false],{}],[],1a8dae21740# 8: b_soldier_01.p3d],[[""APERSBoundingMine_Range_Mag"",""M26 Anti-Personnel Bounding Mine (3)"",""\A3\Weapons_F\Data\UI\gear_mine_AP_bouncing_CA.paa"",{[{_this call ace_explosives_fnc_setupExplosive}, _this] call CBA_fnc_execNextFrame},{true},{},""APERSBoundingMine_Range_Mag"",{[0, 0, 0]},2,[false,false,false,false,false],{}],[],1a8dae21740# 8: b_soldier_01.p3d],[[""ClaymoreDirectionalMine_Remote_Mag"",""M18A1 Claymore (2)"",""\A3\Weapons_F\Data\UI\gear_mine_AP_miniclaymore_CA.paa"",{[{_this call ace_explosives_fnc_setupExplosive}, _this] call CBA_fnc_execNextFrame},{true},{},""ClaymoreDirectionalMine_Remote_Mag"",{[0, 0, 0]},2,[false,false,false,false,false],{}],[],1a8dae21740# 
23:45:55 "Waiting for 'ACE_player' to become 'player' ...."
23:45:55 "Clearing ace_explosives_explosiveActions variable ...."
23:45:55 "########## Cleared ##########"
23:45:55 "player == B Alpha 1-1:1 (PFC.Whigital)"
23:45:55 "ACE_player == B Alpha 1-1:1 (PFC.Whigital)"
23:45:55 "ace_common_clearCache_cba_events_loadoutEvent: []"
23:45:55 "ace_explosives_explosiveActions: []"

Adding a waitUntil {ACE_player == player}; before calling ace_common_fnc_eraseCache seems to fix the issue.

@GCodeman
Copy link
Author

Thanks a bunch for the workaround until this gets fixed! Cheers

@Whigital
Copy link
Contributor

Whigital commented May 7, 2020

Shouldn't it be

} else {
    _cacheList pushBack [_namespace, _uid];
    missionNamespace setVariable [_varName, _cacheList];
};

at the end of this statement

if (isNil "_cacheList") then {
_cacheList = [];
missionNamespace setVariable [_varName, _cacheList];
[_event, {
#ifdef DEBUG_MODE_FULL
INFO_1("Clear cached variables on event: %1",_eventName);
#endif
// Get the list of caches to clear
//IGNORE_PRIVATE_WARNING ["_eventName"];
// _eventName is defined on the function that calls the event
private _varName = format [QGVAR(clearCache_%1), _eventName];
private _cacheList = missionNamespace getVariable [_varName, []];
// Erase all the cached results
{
_x call FUNC(eraseCache);
} forEach _cacheList;
// Empty the list
missionNamespace setVariable [_varName, []];
}] call CBA_fnc_addEventHandler;
};

since the missionNamespace var ("ace_common_clearCache_cba_events_loadoutEvent" in this case) never gets updated with the new _cachelist, if it exists ?

@dedmen
Copy link
Contributor

dedmen commented May 7, 2020

Shouldn't it be

No? pushBack modifies by reference. And the reference already came from the misionNamespace variable.

@Whigital
Copy link
Contributor

Whigital commented May 7, 2020

Thanks for the clarification, thought getVariable returned the value, not a reference.

PabstMirror added a commit that referenced this issue Jun 10, 2020
…7637) (#7739)

* respawn handler

* Revert "respawn handler"

This reverts commit abdf959.

* unit switched eh

Co-Authored-By: PabstMirror <pabstmirror@gmail.com>

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
@mharis001
Copy link
Member

Closing as fixed by #7739 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants