ACE3/addons/movement/functions/fnc_getWeight.sqf

40 lines
813 B
Plaintext
Raw Normal View History

2015-02-28 05:12:54 +00:00
/*
* Author: commy2
* Returns the weight (from the loadAbs command) in lbs/kg (based on user option)
*
* Arguments:
* 0: The Unit (usually the player) <OBJECT>
*
* Return Value:
* The return value <NUMBER>
*
* Example:
2015-04-17 20:45:00 +00:00
* [player] call ace_movement_fnc_getWeight
2015-02-28 05:12:54 +00:00
*
* Public: No
*/
2015-01-18 05:45:28 +00:00
#include "script_component.hpp"
2016-01-06 21:42:02 +00:00
params ["_unit"];
2015-01-18 05:45:28 +00:00
2016-05-10 20:32:40 +00:00
private _virtualLoad = 0;
{
_virtualLoad = _virtualLoad + (_x getVariable [QGVAR(vLoad), 0]);
} forEach [
_unit,
uniformContainer _unit,
vestContainer _unit,
backpackContainer _unit
];
private _weight = (loadAbs _unit + _virtualLoad) * 0.1;
2015-01-18 05:45:28 +00:00
2015-01-30 22:19:45 +00:00
if (GVAR(useImperial)) then {
2015-01-18 05:45:28 +00:00
_weight = format ["%1lb", (round (_weight * 100)) / 100];
} else {
_weight = format ["%1kg", (round (_weight * FACTOR_POUND_TO_KILOGRAMM * 100)) / 100];
};
_weight