Skip to content

Commit

Permalink
Keep original args for cba_disposable_fnc_replaceMagazineCargo
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror committed Aug 8, 2024
1 parent 991ff47 commit a089ba7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 1 addition & 5 deletions addons/disposable/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ private _cfgMagazines = configFile >> "CfgMagazines";
} forEach configProperties [configFile >> "CBA_DisposableLaunchers", "isArray _x"];

["CBA_settingsInitialized", {
["All", "InitPost", {
params ["_object"];

[typeOf _object, _object] call FUNC(replaceMagazineCargo);
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
["All", "InitPost", {call FUNC(replaceMagazineCargo)}, nil, nil, true] call CBA_fnc_addClassEventHandler;
}] call CBA_fnc_addEventHandler;

ADDON = true;
9 changes: 4 additions & 5 deletions addons/disposable/fnc_replaceMagazineCargo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ Description:
Replaces disposable launcher magazines with loaded disposable launchers.
Parameters:
_containerType - typeOf _container <STRING>
_container - Any object with cargo <OBJECT>
Returns:
Nothing.
Examples:
(begin example)
[typeOf _container, _container] call cba_disposable_fnc_replaceMagazineCargo
[_container] call cba_disposable_fnc_replaceMagazineCargo
(end)
Author:
Expand All @@ -24,7 +23,7 @@ Author:
if (!GVAR(replaceDisposableLauncher)) exitWith {};
if (missionNamespace getVariable [QGVAR(disableMagazineReplacement), false]) exitWith {};

params ["_containerType", "_container"];
params ["_container"];

if (!local _container) exitWith {};

Expand All @@ -48,11 +47,11 @@ private _magazines = (magazineCargo _container) select {_x in GVAR(magazines)};
if (_magazines isEqualTo []) exitWith {};

// Check if a uniform, vest, backpack or something else entirely
_containerType = if (getNumber (configOf _container >> "isBackpack") == 1) then {
private _containerType = if (getNumber (configOf _container >> "isBackpack") == 1) then {
TYPE_BACKPACK
} else {
// If uniform or vest, this config will be defined, otherwise it will default to 0
getNumber (configFile >> "CfgWeapons" >> _containerType >> "ItemInfo" >> "type")
getNumber (configFile >> "CfgWeapons" >> (typeOf _container) >> "ItemInfo" >> "type")
};

// Replace magazines with disposable launchers
Expand Down

0 comments on commit a089ba7

Please sign in to comment.