mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
display carried weight in SI and imperial (#5918)
This commit is contained in:
parent
7bc396ba24
commit
0eccca6174
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The Unit (usually the player) <OBJECT>
|
||||
* 0: Force a return type <SCALAR> (0: useImperial setting; 1: Metric; 2: Imperial)
|
||||
* 1: Force a return type <SCALAR, BOOLEAN>
|
||||
*
|
||||
* Return Value:
|
||||
* The return value <NUMBER>
|
||||
@ -16,10 +16,9 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", ["_returnFormat", 0, [0]]];
|
||||
params ["_unit", ["_useImperial", false, [false, 0]]];
|
||||
|
||||
private _virtualLoad = 0;
|
||||
private _useImperial = (!isNil QEGVAR(movement,useImperial) && {EGVAR(movement,useImperial)});
|
||||
|
||||
{
|
||||
_virtualLoad = _virtualLoad + (_x getVariable [QEGVAR(movement,vLoad), 0]);
|
||||
@ -33,7 +32,7 @@ private _useImperial = (!isNil QEGVAR(movement,useImperial) && {EGVAR(movement,u
|
||||
private _weight = (loadAbs _unit + _virtualLoad) * 0.1;
|
||||
|
||||
//Return
|
||||
if ([_useImperial, (_returnFormat == 1)] select (_returnFormat != 0)) then {
|
||||
if (_useImperial in [true, 1]) then {
|
||||
format ["%1lb", (round (_weight * 100)) / 100]
|
||||
} else {
|
||||
format ["%1kg", (round (_weight * (1/2.2046) * 100)) / 100]
|
||||
|
@ -1,8 +0,0 @@
|
||||
class ACE_Settings {
|
||||
class GVAR(useImperial) {
|
||||
value = 0;
|
||||
typeName = "BOOL";
|
||||
isClientSettable = 1;
|
||||
displayName = CSTRING(UseImperial);
|
||||
};
|
||||
};
|
@ -1,4 +1,3 @@
|
||||
|
||||
class Extended_PreStart_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preStart));
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
PREP(addLoadToUnitContainer);
|
||||
PREP(canClimb);
|
||||
PREP(climb);
|
||||
|
@ -18,4 +18,3 @@ class CfgPatches {
|
||||
#include "CfgFatigue.hpp"
|
||||
#include "CfgMoves.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "ACE_Settings.hpp"
|
||||
|
@ -13,17 +13,23 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
#include "script_component.hpp"
|
||||
|
||||
disableSerialization;
|
||||
params ["_display"];
|
||||
|
||||
[{
|
||||
disableSerialization;
|
||||
params ["_dialog"];
|
||||
private _fnc_update = {
|
||||
params ["_display"];
|
||||
private _control = _display displayCtrl 111;
|
||||
|
||||
if (isNull _dialog) exitWith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
_control ctrlSetText format ["%1 - %2 %3 (%4)",
|
||||
[ACE_player, false, true] call EFUNC(common,getName),
|
||||
localize ELSTRING(common,Weight),
|
||||
[ACE_player] call EFUNC(common,getWeight),
|
||||
[ACE_player, true] call EFUNC(common,getWeight)
|
||||
];
|
||||
};
|
||||
|
||||
(_dialog displayCtrl 111) ctrlSetText format ["%1 - %2 %3", [ACE_player, false, true] call EFUNC(common,getName), localize ELSTRING(common,Weight), [ACE_player] call EFUNC(common,getWeight)];
|
||||
}, 0, _this select 0] call CBA_fnc_addPerFrameHandler;
|
||||
_display displayAddEventHandler ["MouseMoving", _fnc_update];
|
||||
_display displayAddEventHandler ["MouseHolding", _fnc_update];
|
||||
|
||||
_display call _fnc_update;
|
||||
|
Loading…
Reference in New Issue
Block a user