mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Move display update stuff to fnc_getRange
This commit is contained in:
@ -6,6 +6,7 @@
|
|||||||
* 0: Measurement Accuracy (default: 1) <NUMBER>
|
* 0: Measurement Accuracy (default: 1) <NUMBER>
|
||||||
* 1: Maximum measure distance (default: 5000) <NUMBER>
|
* 1: Maximum measure distance (default: 5000) <NUMBER>
|
||||||
* 2: Minimum measure distance (default: 0) <NUMBER>
|
* 2: Minimum measure distance (default: 0) <NUMBER>
|
||||||
|
* 3: Update display (default: true) <BOOL>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* Measured distance <NUMBER>
|
* Measured distance <NUMBER>
|
||||||
@ -14,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params [["_accuracy",1], ["_maxDistance",5000], ["_minDistance",0]];
|
params [["_accuracy",1], ["_maxDistance",5000], ["_minDistance",0],["_update",true]];
|
||||||
|
|
||||||
disableSerialization;
|
disableSerialization;
|
||||||
private _dlgRangefinder = uiNamespace getVariable ["ACE_dlgRangefinder", displayNull];
|
private _dlgRangefinder = uiNamespace getVariable ["ACE_dlgRangefinder", displayNull];
|
||||||
@ -36,4 +37,13 @@ if (_distance == 0) then {
|
|||||||
_distance = (round (_distance/_accuracy)) * _accuracy;
|
_distance = (round (_distance/_accuracy)) * _accuracy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (_update) then {
|
||||||
|
// Display the minimum or maximum distance with an * if out of bounds
|
||||||
|
if (_distance >= _maxDistance || _distance <= _minDistance) then {
|
||||||
|
(_dlgRangefinder displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber) + "*";
|
||||||
|
} else {
|
||||||
|
(_dlgRangefinder displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
_distance
|
_distance
|
||||||
|
@ -15,8 +15,14 @@
|
|||||||
|
|
||||||
params ["_vehicle", "_turret"];
|
params ["_vehicle", "_turret"];
|
||||||
|
|
||||||
private _distance = [] call FUNC(getRange);
|
private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);
|
||||||
call FUNC(updateRangeHUD);
|
|
||||||
|
private _distance = [
|
||||||
|
getNumber (_turretConfig >> QGVAR(DistanceInterval)),
|
||||||
|
getNumber (_turretConfig >> QGVAR(MaxDistance)),
|
||||||
|
getNumber (_turretConfig >> QGVAR(MinDistance))
|
||||||
|
] call FUNC(getRange);
|
||||||
|
// call FUNC(updateRangeHUD);
|
||||||
|
|
||||||
if !(!GVAR(enabled) && FUNC(canUseFCS)) exitWith {};
|
if !(!GVAR(enabled) && FUNC(canUseFCS)) exitWith {};
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ params ["_vehicle", "_turret", "_distance", ["_showHint", false], ["_playSound",
|
|||||||
|
|
||||||
private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);
|
private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);
|
||||||
|
|
||||||
call FUNC(updateRangeHUD);
|
// call FUNC(updateRangeHUD);
|
||||||
|
|
||||||
if (isNil "_distance") then {
|
if (isNil "_distance") then {
|
||||||
_distance = [
|
_distance = [
|
||||||
@ -167,10 +167,3 @@ if (_playSound) then {
|
|||||||
if (_showHint) then {
|
if (_showHint) then {
|
||||||
[format ["%1: %2", localize LSTRING(ZeroedTo), _distance]] call EFUNC(common,displayTextStructured);
|
[format ["%1: %2", localize LSTRING(ZeroedTo), _distance]] call EFUNC(common,displayTextStructured);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Display the minimum or maximum distance with an * if out of bounds
|
|
||||||
if (_distance >= getNumber (_turretConfig >> QGVAR(MaxDistance)) || _distance <= getNumber (_turretConfig >> QGVAR(MinDistance))) then {
|
|
||||||
((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber) + "*";
|
|
||||||
} else {
|
|
||||||
((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber);
|
|
||||||
};
|
|
||||||
|
Reference in New Issue
Block a user