mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add zeus defend, patrol and search modules
Using a shared `radius` attribute for all of these displays so a generalized method of initializing and retrieving the value associated that was implemented.
This commit is contained in:
48
addons/zeus/functions/fnc_ui_attributeRadius.sqf
Normal file
48
addons/zeus/functions/fnc_ui_attributeRadius.sqf
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Author: SilentSpike
|
||||
* Initalises the `radius` zeus module attribute
|
||||
*
|
||||
* Arguments:
|
||||
* 0: radius controls group <CONTROL>
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
disableSerialization;
|
||||
|
||||
//Generic Init:
|
||||
params ["_control"];
|
||||
private _display = ctrlParent _control;
|
||||
|
||||
_control ctrlRemoveAllEventHandlers "setFocus";
|
||||
|
||||
//Specific on-load stuff:
|
||||
private _edit = _control controlsGroupCtrl 26467;
|
||||
|
||||
_edit ctrlSetText "50";
|
||||
|
||||
private _fnc_onKeyUp = {
|
||||
params ["_display"];
|
||||
|
||||
private _edit = _display displayCtrl 26467;
|
||||
private _radius = parseNumber (ctrlText _edit);
|
||||
|
||||
// Handle invalid radius (non-numerical input)
|
||||
if (_radius == 0) then {
|
||||
_edit ctrlSetTooltip (localize LSTRING(AttributeRadiusInvalid));
|
||||
_edit ctrlSetTextColor [1,0,0,1];
|
||||
SETVAR(_display,GVAR(radius),50);
|
||||
} else {
|
||||
_edit ctrlSetTooltip "";
|
||||
_edit ctrlSetTextColor [1,1,1,1];
|
||||
SETVAR(_display,GVAR(radius),_radius);
|
||||
};
|
||||
};
|
||||
|
||||
[_display] call _fnc_onKeyUp;
|
||||
_display displayAddEventHandler ["keyUp", _fnc_onKeyUp];
|
Reference in New Issue
Block a user