Skip to content

Commit

Permalink
Flags - Fix losing mass when carrying flag (#10704)
Browse files Browse the repository at this point in the history
  • Loading branch information
Timi007 authored Feb 3, 2025
1 parent bb81c56 commit ca6f029
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion addons/flags/functions/fnc_carryFlag.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@
params ["_unit", "_item"];
TRACE_2("Carry flag",_unit,_item);

(GVAR(flagItemCache) get _item) params ["", "_texture"];
(GVAR(flagItemCache) get _item) params ["", "_texture", "", "", "", "_mass"];
_unit forceFlagTexture _texture;

_unit setVariable [QGVAR(carryingFlag), _item, true];
_unit removeItem _item;

if ("ace_movement" call EFUNC(common,isModLoaded)) then {
[_unit, _unit, _mass] call EFUNC(movement,addLoadToUnitContainer);
};
5 changes: 5 additions & 0 deletions addons/flags/functions/fnc_furlFlag.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ _unit setVariable [QGVAR(carryingFlag), nil, true];
_unit forceFlagTexture ""; // Remove flag

[_unit, _item] call EFUNC(common,addToInventory);

if ("ace_movement" call EFUNC(common,isModLoaded)) then {
private _mass = (GVAR(flagItemCache) get _item) select 5;
[_unit, _unit, -_mass] call EFUNC(movement,addLoadToUnitContainer);
};
3 changes: 2 additions & 1 deletion addons/flags/functions/fnc_scanConfig.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ private _carrierItemMapping = createHashMap;
private _carrier = getText (_x >> QGVAR(carrier));
private _actionIconPlace = getText (_x >> QGVAR(actionIconPlace));
private _actionIconCarry = getText (_x >> QGVAR(actionIconCarry));
private _mass = getNumber (_x >> "ItemInfo" >> "mass");

_flagItemCache set [_name, [_displayName, _texture, _carrier, _actionIconPlace, _actionIconCarry]];
_flagItemCache set [_name, [_displayName, _texture, _carrier, _actionIconPlace, _actionIconCarry, _mass]];
_carrierItemMapping set [_carrier, _name];
} forEach _flagItems;

Expand Down

0 comments on commit ca6f029

Please sign in to comment.