Skip to content

Commit

Permalink
Dragging - Remove weight calculation workaround (#10117)
Browse files Browse the repository at this point in the history
* loadAbs has been fixed

* Update fnc_getWeight.sqf
  • Loading branch information
johnb432 authored Jul 19, 2024
1 parent 37d7c4c commit 6873831
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions addons/dragging/functions/fnc_getWeight.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Weight <NUMBER>
*
* Example:
* [cursorTarget] call ace_dragging_fnc_getWeight
* cursorTarget call ace_dragging_fnc_getWeight
*
* Public: No
*/
Expand All @@ -23,19 +23,20 @@ if (GVAR(weightCoefficient) == 0) exitWith {0};

private _weight = loadAbs _object;

if !(GVAR(skipContainerWeight)) then {
if (!GVAR(skipContainerWeight)) then {
// Add the mass of the object itself
// getMass handles PhysX mass, this should be 0 for SupplyX containers and WeaponHolders
// Use originalMass in case we're checking weight for a carried object
_weight = _weight + ((_object getVariable [QGVAR(originalMass), getMass _object]));
_weight = _weight + (_object getVariable [QGVAR(originalMass), getMass _object]);
};

// Contents of backpacks get counted twice (https://github.com/acemod/ACE3/pull/8457#issuecomment-1062522447 and https://feedback.bistudio.com/T167469)
// This is a workaround until that is fixed on BI's end
{
_x params ["", "_container"];
_weight = _weight - (loadAbs _container);
} forEach (everyContainer _object);
// Fixed in https://feedback.bistudio.com/T167469 on 2.16 profiling branch and for 2.18 stable
if ((productVersion select 3) < 152017) then {
{
_x params ["", "_container"];
_weight = _weight - (loadAbs _container);
} forEach (everyContainer _object);
};

// Mass in Arma isn't an exact amount but rather a volume/weight value
// This attempts to work around that by making it a usable value (sort of)
Expand Down

0 comments on commit 6873831

Please sign in to comment.