Dragging - Remove weight calculation workaround (#10117)

* loadAbs has been fixed

* Update fnc_getWeight.sqf
This commit is contained in:
johnb432 2024-07-19 19:13:44 +02:00 committed by GitHub
parent 37d7c4c544
commit 68738316c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,7 +11,7 @@
* Weight <NUMBER>
*
* Example:
* [cursorTarget] call ace_dragging_fnc_getWeight
* cursorTarget call ace_dragging_fnc_getWeight
*
* Public: No
*/
@ -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)