DT_fnc_localize = { params [ ['_string','',['',[]]], ['_default','',['',[]]] ]; if (_string isEqualTo '') exitWith {'BAD_STRING'}; private _return = switch (true) do { case (_string isEqualType ''): { if (isLocalized _string) then {localize _string} else {_default}; }; case (_string isEqualType []): { _string params ['_stringclass']; if !(_stringclass isEqualType '') exitWith {'BAD_STRING_FORMAT'}; _string set [0,localize _stringclass]; if (isLocalized _stringclass) then {format _string} else { if (_default isEqualType []) then {format _default} else {_default}; }; }; default {'BAD_STRING_TYPE'}; }; _return }; publicVariable 'DT_fnc_localize'; DT_fnc_numberText = { params [ ['_number',0,[0]], ['_splitBy',3,[0]], ['_splitChar',',',['']] ]; private _numberText = ''; private _digits = (_number call bis_fnc_numberDigits) apply {str _x}; private _count = count _digits - 1; private _modulo = _count % _splitBy; { _numberText = _numberText + _x; if (((_foreachindex - _modulo) % _splitBy isEqualTo 0) AND {!(_foreachindex isEqualTo _count)}) then { _numberText = _numberText + _splitChar; }; } forEach _digits; _numberText }; publicVariable "DT_fnc_numberText"; DT_fnc_ambientAnim = { params [ ['_object',objNull,[objNull]], ['_animSet','STAND',['']] ]; if (isNull _object) exitWith {}; if !(local _object) exitWith {}; detach _object; _object disableAI 'ALL'; private _animSetParams = _animSet call BIS_fnc_ambientAnimGetParams; _animSetParams params ['_animations','_azimutDiff','_attachSnap','_attachOffset','_noBackpack','_noWeapon','','_canInterpolate']; if (_noBackpack) then {removeBackpack _object}; if (_noWeapon) then { {_object removeWeapon _x} forEach [primaryWeapon _object,secondaryWeapon _object,handgunWeapon _object]; }; private _logic = 'Logic' createVehicleLocal (position _object); _logic setPosASL (getPosASL _object); _logic setDir ((getDir _object) + _azimutDiff); _object attachTo [_logic, [0,0,_attachOffset]]; _object removeAllEventHandlers 'AnimDone'; _object removeAllEventHandlers 'Killed'; _object setVariable ['ambientAnim_canInterpolate',_canInterpolate]; _object setVariable ['ambientAnim_animations',_animations]; _object switchMove (selectRandom _animations); _object addEventHandler ['AnimDone',{ params ['_object','_currentAnimation']; private _animationsPool = _object getVariable ['ambientAnim_animations',[]]; if (_animationsPool isEqualTo []) exitWith {}; private _canInterpolate = _object getVariable ['ambientAnim_canInterpolate',false]; private _nextAnimation = selectRandom _animationsPool; if (alive _object) then { if (_canInterpolate) then {_object playMoveNow _anim} else {_object switchMove _anim}; }; }]; _object addEventHandler ['Killed',{ params ['_object']; _object removeAllEventHandlers 'AnimDone'; _object removeAllEventHandlers 'Killed'; }]; }; publicVariable 'DT_fnc_ambientAnim'; DT_fnc_ExtendedUI = { disableSerialization; params [ ['_ctrl',controlNull,[controlNull]], ['_group',controlNull,[controlNull]], ['_memoryVariable','NONE',['']] ]; if (isNull _ctrl) exitWith {}; if (isNull _group) then {_group = _ctrl}; private _display = ctrlParent _group; _group setVariable ['EUIDefaultCoords',[ctrlPosition _group,ctrlAngle _group]]; _group setVariable ['EUIMemoryVariable',_memoryVariable]; _ctrl ctrlEnable true; private _isControlsGroup = ctrlClassName _group in [ 'RscControlsGroup', 'RscControlsGroupNoScrollbars', 'RscControlsGroupNoHScrollbars', 'RscControlsGroupNoVScrollbars' ]; _group setVariable ['EUIControlsGroup',_isControlsGroup]; private _DT_fnc_ExtendedUISave = { params ['_activeElement',['_forcedPosition',[]]]; if (canSuspend) then {waitUntil {ctrlCommitted _activeElement}}; private _memoryVariable = _activeElement getVariable ['EUIMemoryVariable','NONE']; if (_memoryVariable isEqualTo 'NONE') exitWith {}; private _angleData = ctrlAngle _activeElement; private _position = if (_forcedPosition isEqualTo []) then {ctrlPosition _activeElement} else {_forcedPosition}; if (isNil '_angleData') then {_angleData = [0,0.5,0.5]}; switch (true) do { case (_activeElement getVariable ['EUIMinimized',false]): { private _maximizeSize = _activeElement getVariable ['EUIMaximizeSize',[]]; profileNamespace setVariable [_memoryVariable,[_position,_angleData,_maximizeSize]]; }; default {profileNamespace setVariable [_memoryVariable,[_position,_angleData]]}; }; }; uiNamespace setVariable ['DT_fnc_ExtendedUISave',_DT_fnc_ExtendedUISave]; private _DT_fnc_ExtendedUINormalizePos = { params ['_xP','_yP','_wP','_hP']; _xP = _xP min (safeZoneWAbs + safeZoneX - _wP) max (safeZoneXAbs); _yP = _yP min (1 * safezoneH + safezoneY - _hP) max (0 * safezoneH + safezoneY); [_xP,_yP,_wP,_hP] }; uiNamespace setVariable ['DT_fnc_ExtendedUINormalizePos',_DT_fnc_ExtendedUINormalizePos]; if !(_memoryVariable isEqualTo 'NONE') then { private _memoryData = profileNamespace getVariable [_memoryVariable,[]]; private _DT_fnc_ExtendedUINormalizePos = uiNamespace getVariable ['DT_fnc_ExtendedUINormalizePos',{}]; if !(_memoryData isEqualTo []) then { _memoryData params ['_memoryPosition',['_angleData',[]],['_maximizeSize',[]]]; _memoryPosition params ['_gX','_gY','_gW','_gH']; _angleData params [['_angle',0],['_xCenter',0.5],['_yCenter',0.5]]; _group ctrlSetPosition ([_gX,_gY,_gW,_gH] call _DT_fnc_ExtendedUINormalizePos); _group ctrlCommit 0; _group ctrlSetAngle [_angle,_xCenter,_yCenter,true]; _group setVariable ['EUIMaximizeSize',_maximizeSize]; if !(_maximizeSize isEqualTo []) then { _group setVariable ['EUIMinimized',true]; }; }; }; _ctrl ctrlAddEventHandler ['MouseButtonDown',{ params ['_ctrl','_button','_offsetX','_offsetY']; private _display = ctrlParent _ctrl; private _activeElement = _ctrl getVariable ['EUISelectedControl',controlNull]; switch (_button) do { case 0: { switch (true) do { case (_activeElement getVariable ['EUIControlsGroup',false]): { _display setVariable ['EUISelectedControlOffsets',[_offsetX,_offsetY]]; }; case (!isNull (ctrlParentControlsGroup _activeElement)): { _display setVariable ['EUISelectedControlOffsets',[0,0]]; }; default {_display setVariable ['EUISelectedControlOffsets',[0,0]]}; }; }; case 1: { if (_activeElement getVariable ['EUIControlPinned',false]) then { _activeElement setVariable ['EUIControlPinned',false]; _ctrl ctrlSetTooltip ''; } else { _activeElement setVariable ['EUIControlPinned',true]; _ctrl ctrlSetTooltip 'Pinned to display'; }; }; }; _display setVariable ['EUISelectedControl',_activeElement]; }]; _ctrl ctrlAddEventHandler ['MouseButtonUp',{ params ['_ctrl','_button']; private _display = ctrlParent _ctrl; _display setVariable ['EUISelectedControl',controlNull]; }]; if (_isControlsGroup) then { _ctrl ctrlAddEventHandler ['MouseButtonDblClick',{ params ['_ctrl']; private _display = ctrlParent _ctrl; private _activeElement = _ctrl getVariable ['EUISelectedControl',controlNull]; if (_activeElement isEqualTo _ctrl) exitWith {}; private _DT_fnc_ExtendedUINormalizePos = uiNamespace getVariable ['DT_fnc_ExtendedUINormalizePos',{}]; private _animationEndSize = []; switch (true) do { case !(_activeElement getVariable ['EUIMinimized',false]): { (ctrlPosition _ctrl) params ['','','_cW','_cH']; (ctrlPosition _activeElement) params ['_cX','_cY','','']; private _maximizeSize = ctrlPosition _activeElement; _animationEndSize = ([_cX,_cY,_cW,_cH] call _DT_fnc_ExtendedUINormalizePos); _activeElement setVariable ['EUIMaximizeSize',_maximizeSize]; _activeElement setVariable ['EUIMinimized',true]; _activeElement ctrlSetPosition _animationEndSize; }; case (_activeElement getVariable ['EUIMinimized',false]): { private _maximizeSize = _activeElement getVariable ['EUIMaximizeSize',[]]; _maximizeSize params ['','','_aW','_aH']; (ctrlPosition _activeElement) params ['_aX','_aY','','']; _animationEndSize = ([_aX,_aY,_aW,_aH] call _DT_fnc_ExtendedUINormalizePos); _activeElement setVariable ['EUIMinimized',false]; _activeElement ctrlSetPosition _animationEndSize; }; }; _activeElement ctrlCommit 0.25; private _DT_fnc_ExtendedUISave = uiNamespace getVariable ['DT_fnc_ExtendedUISave',{}]; [_activeElement,_animationEndSize] call _DT_fnc_ExtendedUISave; }]; }; _ctrl setVariable ['EUISelectedControl',_group]; if (_display getVariable ['EUIDisplayInit',false]) exitWith {}; _display setVariable ['EUIDisplayInit',true]; _display displayAddEventHandler ['KeyDown',{ params ['_display','_code','_shift','_control','_alt']; private _activeElement =_display getVariable ['EUISelectedControl',controlNull]; private _DT_fnc_ExtendedUINormalizePos = uiNamespace getVariable ['DT_fnc_ExtendedUINormalizePos',{}]; if (_control) then { switch (_code) do { case 44: { if (isNull _activeElement) exitWith {}; private _defaultCoords = _activeElement getVariable ['EUIDefaultCoords',[]]; _defaultCoords params ['_scriptedPosition',['_angleData',[]]]; _angleData params [['_angle',0],['_xCenter',0.5],['_yCenter',0.5]]; if (_defaultCoords isEqualTo []) exitWith {}; _activeElement ctrlSetPosition (_scriptedPosition call _DT_fnc_ExtendedUINormalizePos); _activeElement ctrlSetAngle [_angle,_xCenter,_yCenter]; _activeElement ctrlCommit 0; _activeElement setVariable ['EUIMinimized',false]; private _DT_fnc_ExtendedUISave = uiNamespace getVariable ['DT_fnc_ExtendedUISave',{}]; [_activeElement] call _DT_fnc_ExtendedUISave; }; }; }; false }]; _display displayAddEventHandler ['MouseMoving',{ params ['_display','_dOffsetX','_dOffsetY']; private _activeElement = _display getVariable ['EUISelectedControl',controlNull]; if (isNull _activeElement) exitWith {}; if (_activeElement getVariable ['EUIControlPinned',false]) exitWith {}; private _DT_fnc_ExtendedUINormalizePos = uiNamespace getVariable ['DT_fnc_ExtendedUINormalizePos',{}]; (ctrlPosition _activeElement) params ['_dX','_dY','_dW','_dH']; switch (true) do { case (_activeElement getVariable ['EUIControlsGroup',false]): { private _ctrlOffsets = _display getVariable ['EUISelectedControlOffsets',[]]; _ctrlOffsets params ['_offsetX','_offsetY']; private _mousePosition = getMousePosition; _mousePosition params ['_dX','_dY']; _activeElement ctrlSetPosition ([_dX - _offsetX,_dY - _offsetY,_dW,_dH] call _DT_fnc_ExtendedUINormalizePos); }; case (!isNull (ctrlParentControlsGroup _activeElement)): { private _mousePosition = getMousePosition; private _controlGroup = ctrlParentControlsGroup _activeElement; (ctrlPosition _controlGroup) params ['_gX','_gY','_gW','_gH']; _mousePosition params ['_dX','_dY']; _activeElement ctrlSetPosition [ (_dX - _gX) min (_gW - _dW), (_dY - _gY) min (_gH - _dH), _dW, _dH ]; }; default { private _mousePosition = getMousePosition; _mousePosition params ['_dX','_dY']; _activeElement ctrlSetPosition ([_dX,_dY,_dW,_dH] call _DT_fnc_ExtendedUINormalizePos); }; }; _activeElement ctrlCommit 0; private _DT_fnc_ExtendedUISave = uiNamespace getVariable ['DT_fnc_ExtendedUISave',{}]; [_activeElement] call _DT_fnc_ExtendedUISave; }]; }; publicVariable "DT_fnc_ExtendedUI"; DT_fnc_prompt = { disableSerialization; params ['_displayParent',['_action',{}],'_title','_text',['_hasOK',true],['_closeParent',false]]; if (!isNull (uiNamespace getVariable ['promptDisplay',displayNull])) exitWith {}; private _display = _displayParent createDisplay "RscDisplayEmpty"; uiNamespace setVariable ['promptDisplay',_display]; _display setVariable ['statusCode',-1]; private _fontH = "PuristaLight"; private _pW = parseNumber (((pixelW * 5) * 1) toFixed 3); private _pH = parseNumber (((pixelH * 5) * 1) toFixed 3); private _group = _display ctrlCreate ['RscControlsGroupNoScrollbars',-1]; _group ctrlSetPosition [0 * safezoneW + safezoneX, 0 * safezoneH + safezoneY, 1 * safezoneW, 1 * safeZoneH]; _group ctrlCommit 0; (ctrlPosition _group) params ['_gX','_gY','_gW','_gH']; private _background = _display ctrlCreate ['RscText',-1,_group]; _background ctrlSetPosition [0,0,_gW,_gH]; _background ctrlSetBackgroundColor [0,0,0,0.5]; _background ctrlCommit 0; _background ctrlEnable false; private _titleCtrl = _display ctrlCreate ['RscStructuredText',-1,_group]; _titleCtrl ctrlSetBackgroundColor [0.03,0.03,0.03,1]; _titleCtrl ctrlSetPosition [0,_gH/2 - (20 * _pH),_gW,8 * _pH]; _titleCtrl ctrlSetStructuredText parseText format[call compile tostring[34,60,116,32,97,108,105,103,110,61,39,99,101,110,116,101,114,39,32,102,111,110,116,61,39,37,50,39,32,115,105,122,101,61,39,37,51,39,62,37,49,60,47,116,62,34],_title,"PuristaBold",190 * _pH]; _titleCtrl ctrlCommit 0; _titleCtrl ctrlEnable false; private _textCtrl = _display ctrlCreate ['RscStructuredText',-1,_group]; _textCtrl ctrlSetBackgroundColor [0,0,0,1]; _textCtrl ctrlSetPosition [0,_gH/2 - (12 * _pH),_gW,18 * _pH]; _textCtrl ctrlSetStructuredText parseText format[call compile tostring[34,60,98,114,47,62,60,116,32,97,108,105,103,110,61,39,99,101,110,116,101,114,39,32,102,111,110,116,61,39,37,50,39,32,115,105,122,101,61,39,37,51,39,62,37,49,60,47,116,62,34],_text,_fontH,140 * _pH]; _textCtrl ctrlCommit 0; private _buttonBg = _display ctrlCreate ['RscStructuredText',-1,_group]; _buttonBg ctrlSetBackgroundColor [0,0,0,1]; _buttonBg ctrlSetPosition [0,_gH/2 + (4 * _pH),_gW,10 * _pH]; _buttonBg ctrlCommit 0; _buttonBg ctrlEnable false; private _buttonOK = if (_hasOK) then { private _buttonOK = _display ctrlCreate ['RscStructuredText',-1,_group]; _buttonOK ctrlSetBackgroundColor [0.03,0.03,0.03,1]; _buttonOK ctrlSetPosition [_gW/2 - (38 * _pW),_gH/2 + (6 * _pH),36 * _pW,6 * _pH]; _buttonOK ctrlSetStructuredText parseText format[call compile tostring[34,60,116,32,97,108,105,103,110,61,39,99,101,110,116,101,114,39,32,102,111,110,116,61,39,37,50,39,32,115,105,122,101,61,39,37,51,39,62,37,49,60,47,116,62,34],toUpper localize "STR_DISP_OK",_fontH,140 * _pH]; _buttonOK ctrlCommit 0; _buttonOK } else { controlNull }; private _cancelPositionX = if (isNull _buttonOK) then {_gW/2 - 36 * _pW} else {_gW/2 + (2 * _pW)}; private _cancelPositionW = if (isNull _buttonOK) then {72 * _pW} else {36 * _pW}; private _buttonCancel = _display ctrlCreate ['RscStructuredText',-1,_group]; _buttonCancel ctrlSetBackgroundColor [0.03,0.03,0.03,1]; _buttonCancel ctrlSetPosition [_cancelPositionX,_gH/2 + (6 * _pH),_cancelPositionW,6 * _pH]; _buttonCancel ctrlSetStructuredText parseText format[call compile tostring[34,60,116,32,97,108,105,103,110,61,39,99,101,110,116,101,114,39,32,102,111,110,116,61,39,37,50,39,32,115,105,122,101,61,39,37,51,39,62,37,49,60,47,116,62,34],toUpper localize "STR_DISP_CANCEL",_fontH,140 * _pH]; _buttonCancel ctrlCommit 0; { _x ctrlEnable true; _x ctrlAddEventHandler ['MouseEnter',{ playSound 'ReadoutHideClick1'; params ['_ctrl']; private _backgroundColor = [1,1,1,0.75]; _ctrl ctrlSetBackgroundColor _backgroundColor; _ctrl ctrlSetTextColor [0,0,0,1]; }]; _x ctrlAddEventHandler ['MouseExit',{ params ['_ctrl']; _ctrl ctrlSetBackgroundColor [0.03,0.03,0.03,1]; _ctrl ctrlSetTextColor [1,1,1,1]; }]; } forEach [_buttonOK,_buttonCancel]; _buttonOK ctrlAddEventHandler ['MouseButtonDown',{ playSound 'readoutClick'; params ['_ctrl']; (ctrlParent _ctrl) setVariable ['statusCode',1]; }]; _buttonCancel ctrlAddEventHandler ['MouseButtonDown',{ playSound 'readoutClick'; params ['_ctrl']; (ctrlParent _ctrl) setVariable ['statusCode',2]; }]; private _keyID = _display displayAddEventHandler ['KeyDown',{ params ['_display','_code']; private _handled = true; if (_code in [0x01,0x1C,0x9C]) then {_handled = false}; switch (_code) do { case 0x01: {_display setVariable ['statusCode',2]}; case 0x1C: {_display setVariable ['statusCode',1]}; case 0x9C: {_display setVariable ['statusCode',1]}; }; _handled }]; waitUntil {_display getVariable ['statusCode',-1] > -1}; private _statusCode = _display getVariable ['statusCode',-1]; if (_statusCode isEqualTo 2) exitWith { _display closeDisplay 0; if (_closeParent) then {_displayParent closeDisplay 0}; }; _display closeDisplay 0; call _action; }; publicVariable "DT_fnc_prompt"; DT_fnc_holdActionAdd = { params [ ["_target",objNull,[objNull]], ["_title","MISSING TITLE",[""]], ["_iconIdle","\A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa",[""]], ["_iconProgress","\A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa",[""]], ["_condShow","true",[""]], ["_condProgress","true",[""]], ["_codeStart",{},[{}]], ["_codeProgress",{},[{}]], ["_codeCompleted",{},[{}]], ["_codeInterrupted",{},[{}]], ["_arguments",[],[[]]], ["_duration",10,[0,{}]], ["_priority",1000,[0]], ["_removeCompleted",true,[true]], ["_showUnconscious",false,[true]], ["_showWindow",true,[true]] ]; private _keyNameRaw = actionKeysNames ["Action",1,"Keyboard"]; private _keyName = _keyNameRaw select [1,count _keyNameRaw - 2]; private _keyNameColored = call compile tostring[102,111,114,109,97,116,91,34,60,116,32,99,111,108,111,114,61,39,35,102,102,97,101,48,48,39,62,37,49,60,47,116,62,34,44,95,107,101,121,78,97,109,101,93,59]; private _hint = format[localize "STR_A3_HoldKeyTo",_keyNameColored,_title]; _hint = call compile tostring[102,111,114,109,97,116,91,34,60,116,32,102,111,110,116,61,39,82,111,98,111,116,111,67,111,110,100,101,110,115,101,100,66,111,108,100,39,62,37,49,60,47,116,62,34,44,95,104,105,110,116,93,59]; _title = call compile tostring[102,111,114,109,97,116,91,34,60,116,32,99,111,108,111,114,61,39,35,70,70,70,70,70,70,39,32,97,108,105,103,110,61,39,108,101,102,116,39,62,37,49,60,47,116,62,60,116,32,99,111,108,111,114,61,39,35,56,51,102,102,102,102,102,102,39,32,97,108,105,103,110,61,39,114,105,103,104,116,39,62,37,50,60,47,116,62,34,44,95,116,105,116,108,101,44,95,107,101,121,78,97,109,101,93,59]; _iconIdle = call compile tostring[102,111,114,109,97,116,91,34,60,105,109,103,32,115,105,122,101,61,39,51,39,32,99,111,108,111,114,61,39,35,102,102,102,102,102,102,39,32,105,109,97,103,101,61,39,37,49,39,47,62,34,44,95,105,99,111,110,73,100,108,101,93,59]; _iconProgress = call compile tostring[102,111,114,109,97,116,91,34,60,105,109,103,32,115,105,122,101,61,39,51,39,32,99,111,108,111,114,61,39,35,102,102,102,102,102,102,39,32,105,109,97,103,101,61,39,37,49,39,47,62,34,44,95,105,99,111,110,80,114,111,103,114,101,115,115,93,59]; if !(uiNamespace getVariable ['holdAction_set',false]) then { private _texturesProgress = []; private _texturesIdle = []; private _texturesIn = []; for "_i" from 0 to 24 do {_texturesProgress pushBack (call compile tostring[102,111,114,109,97,116,91,34,60,105,109,103,32,115,105,122,101,61,39,51,39,32,115,104,97,100,111,119,61,39,48,39,32,99,111,108,111,114,61,39,35,102,102,102,102,102,102,102,102,39,32,105,109,97,103,101,61,39,92,65,51,92,85,105,95,102,92,100,97,116,97,92,73,71,85,73,92,67,102,103,92,72,111,108,100,65,99,116,105,111,110,115,92,112,114,111,103,114,101,115,115,92,112,114,111,103,114,101,115,115,95,37,49,95,99,97,46,112,97,97,39,47,62,34,44,95,105,93])}; for "_i" from 0 to 11 do { private _alpha = (sin((_i / 11) * 360) * 0.25) + 0.75; private _color = [1, 1, 1, _alpha] call bis_fnc_colorRGBAtoHTML; _texturesIdle pushBack(call compile tostring[102,111,114,109,97,116,91,34,60,105,109,103,32,115,105,122,101,61,39,51,39,32,115,104,97,100,111,119,61,39,48,39,32,99,111,108,111,114,61,39,37,50,39,32,105,109,97,103,101,61,39,92,65,51,92,85,105,95,102,92,100,97,116,97,92,73,71,85,73,92,67,102,103,92,72,111,108,100,65,99,116,105,111,110,115,92,105,110,92,105,110,95,48,95,99,97,46,112,97,97,39,47,62,34,44,32,95,105,44,32,95,99,111,108,111,114,93]); }; for "_i" from 0 to 3 do { _texturesIn pushBack(call compile tostring[102,111,114,109,97,116,91,34,60,105,109,103,32,115,105,122,101,61,39,51,39,32,115,104,97,100,111,119,61,39,48,39,32,99,111,108,111,114,61,39,35,102,102,102,102,102,102,102,102,39,32,105,109,97,103,101,61,39,92,65,51,92,85,105,95,102,92,100,97,116,97,92,73,71,85,73,92,67,102,103,92,72,111,108,100,65,99,116,105,111,110,115,92,105,110,92,105,110,95,37,49,95,99,97,46,112,97,97,39,47,62,34,44,32,95,105,93]); }; uiNamespace setVariable ['holdAction_texturesProgress',_texturesProgress]; uiNamespace setVariable ['holdAction_texturesIdle',_texturesIdle]; uiNamespace setVariable ['holdAction_texturesIn',_texturesIn]; uiNamespace setVariable ['holdAction_set',true]; }; _arguments resize 10; _arguments = _arguments + [_target,_title,_iconIdle,_iconProgress,_condShow,_condProgress,_codeStart,_codeProgress,_codeCompleted,_codeInterrupted,_duration,_removeCompleted,_hint]; DT_fnc_haIconChangeState = { params [ ["_target",objNull,[objNull]], ["_actionID",0,[0]], ["_title","",[""]], ["_icon","",[""]], ["_texSet",uiNamespace getVariable ['holdAction_texturesIdle',[]],[[]]], ["_frame",0,[0]], ["_hint","",[""]], ["_isTimer",false,[false]] ]; if (_isTimer) then { _target setUserActionText [_actionID,_title,_texSet select _frame,(call compile tostring[34,60,98,114,47,62,34]) + _hint]; } else { _target setUserActionText [_actionID,_title,_texSet select _frame,_icon + (call compile tostring[34,60,98,114,47,62,60,98,114,47,62,34]) + _hint]; }; }; DT_fnc_haAnimationState = { if (diag_tickTime > (missionNamespace getVariable ["bis_fnc_holdAction_animationIdleTime",-1]) && {_eval}) then { bis_fnc_holdAction_animationIdleTime = diag_tickTime + 0.065; bis_fnc_holdAction_animationIdleFrame = (bis_fnc_holdAction_animationIdleFrame + 1) % 12; if (isNil "holdAction_scriptHandle" && {scriptDone holdAction_scriptHandle}) then { params ["_title","_iconIdle","_hint"]; [_originalTarget,_actionID,_title,_iconIdle,nil,bis_fnc_holdAction_animationIdleFrame,_hint] call DT_fnc_haIconChangeState; }; }; }; private _codeInit = { if (!isNil "holdAction_scriptHandle" && {!scriptDone holdAction_scriptHandle}) exitWith {}; holdAction_scriptHandle = _this spawn { params [ ["_target",objNull,[objNull]], ["_caller",objNull,[objNull]], ["_actionID",0,[0]], ["_arguments",[],[[]]] ]; _arguments params ["_a0","_a1","_a2","_a3","_a4","_a5","_a6","_a7","_a8","_a9","_target","_title","_iconIdle","_iconProgress","_condShow","_condProgress","_codeStart","_codeProgress","_codeCompleted","_codeInterrupted","_duration","_removeCompleted","_hint"]; private _condProgressCode = compile _condProgress; private _object = cursorObject; for "_i" from 0 to 3 do { sleep 0.05; [_target,_actionID,_title,_iconIdle,uiNamespace getVariable ['holdAction_texturesIn',[]],_i] call DT_fnc_haIconChangeState; }; [_target,_caller,_actionID,_arguments] call _codeStart; private _frame = 0; private _timeStart = diag_tickTime; private _timeNextStep = diag_tickTime; if (_duration isEqualType {}) then {_duration = call _duration}; private _stepDuration = _duration / 24; while {call _condProgressCode && {_frame < 24}} do { _timeNextStep = _timeStart + (_frame * _stepDuration); private _timeDiff = round(((_duration - (diag_tickTime - _timeStart)) max 0)); waitUntil {diag_tickTime >= _timeNextStep || {(inputAction "Action" < 0.5 && {inputAction "ActionContext" < 0.5}) || {isNil {call _condProgressCode}} || {visibleMap || {!(call _condProgressCode)}}}}; if (diag_tickTime < _timeNextStep) exitWith {}; _frame = _frame + 1; [_target,_actionID,_title,_iconProgress,uiNamespace getVariable ['holdAction_texturesProgress',[]],_frame,(call compile tostring[102,111,114,109,97,116,91,34,60,116,32,115,105,122,101,32,61,39,49,39,62,37,49,60,47,116,62,60,98,114,47,62,60,98,114,47,62,60,98,114,47,62,37,50,34,44,95,116,105,109,101,68,105,102,102,44,95,104,105,110,116,93]),true] call DT_fnc_haIconChangeState; [_target,_caller,_actionID,_arguments,_frame,24] call _codeProgress; }; if (_frame == 24) then { sleep _stepDuration; if (_removeCompleted) then {_target removeAction _actionID}; [_target,_caller,_actionID,_arguments] call _codeCompleted; } else {[_target,_caller,_actionID,_arguments] call _codeInterrupted}; [_target,_actionID,_title,_iconIdle,uiNamespace getVariable ['holdAction_texturesIdle',[]],0,_hint] call DT_fnc_haIconChangeState; }; }; _condShow = format ["_target = _originalTarget; _eval = %1; [""%2"",""%3"",""%4""] call DT_fnc_haAnimationState; _eval",_condShow,_title,_iconIdle,_hint]; private _actionID = _target addAction [_title, _codeInit, _arguments, _priority, _showWindow, false,"", _condShow,15, _showUnconscious,""]; [_target,_actionID,_title,_iconIdle,uiNamespace getVariable ['holdAction_texturesIdle',[]],0,_hint] call DT_fnc_haIconChangeState; _actionID }; publicVariable "DT_fnc_holdActionAdd"; DT_fnc_UIParallax = { params [ ['_controlsGroup',controlNull], ['_camera',objNull], ['_offsetPower',0.75], ['_useBlur',true,[true]] ]; private _display = ctrlParent _controlsGroup; if (isNull _display) exitWith {}; if (_display getVariable ['parallaxInited',false]) exitWith {systemChat "ERROR: Parallax is overlapping with exisiting one."}; _controlsGroup setVariable ['initialPosition',ctrlPosition _controlsGroup]; _display setVariable ['camInitialPosition',getPosASL _camera]; _display setVariable ['parallaxInited',true]; _display setVariable ['camera',_camera]; _display setVariable ['parallaxGroup',_controlsGroup]; _display setVariable ['offsetPower',_offsetPower]; private _DT_fnc_doOffset = { params ['_display']; getMousePosition params ['_xPos','_yPos']; private _controlsGroup = _display getVariable ['parallaxGroup',controlNull]; private _controlsGroupDefaultPos = _controlsGroup getVariable ['initialPosition',[]]; private _offsetPower = _display getVariable ['offsetPower',0]; private _camera = _display getVariable ['camera',objNull]; (_controlsGroupDefaultPos) params ['_gX','_gY','_gW','_gH']; _xPos = [safeZoneXAbs * safeZoneW,_xPos * _offsetPower,abs (safezoneXabs * (safeZoneW + safezoneXAbs))] call BIS_fnc_lerp; _yPos = [safeZoneY * safeZoneH,_yPos * _offsetPower,safeZoneH + safeZoneY] call BIS_fnc_lerp; _controlsGroup ctrlSetPosition [_gX + (_xPos * pixelW * pixelGrid * 2),_gY + (_yPos * pixelH * pixelGrid * 2),_gW,_gH]; _controlsGroup ctrlCommit 0; if (!isNull _camera) then { (_display getVariable "camInitialPosition") params ['_vX','_vY','_vZ']; _yPosInt = linearConversion [2,1,_yPos,0,_offsetPower/10]; _xPosInt = linearConversion [2,1,_xPos,0,_offsetPower/10]; _camera setPosASL [_vX + _xPosInt,_vY - _xPosInt,_vZ + _yPosInt]; }; }; _display setVariable ['DT_fnc_doOffset',_DT_fnc_doOffset]; _display call _DT_fnc_doOffset; _display displayAddEventHandler ['MouseMoving',{ params ['_display']; _display call (_display getVariable "DT_fnc_doOffset") }]; if (_useBlur) then { private _blurEffect = ppEffectCreate ["DynamicBlur",777]; _blurEffect ppEffectAdjust [2]; _blurEffect ppEffectForceInNVG true; _blurEffect ppEffectEnable true; _blurEffect ppEffectCommit 0; _display setVariable ['blurEffect',_blurEffect]; _display displayAddEventHandler ['unload',{ params ['_display']; private _blurEffect = _display getVariable ['blureffect',[]]; ppEffectDestroy _blurEffect; }]; }; if (!isNull _camera) then { _display displayAddEventHandler ['unload',{ params ['_display']; private _camera = _display getVariable ['camera',objNull]; _camera setPosASL (_display getVariable 'camInitialPosition'); }]; }; }; publicVariable "DT_fnc_UIParallax"; addMissionEventHandler ['PlayerConnected', { params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"]; comment "CONFIRMED CHEATERS"; private _cheatersArray = [ "76561198130826030", "76561198060975714", "76561198166114251" ]; if (_uid in _cheatersArray) then { [[],{ waitUntil {!isNull (findDisplay 46)}; (findDisplay 46) closeDisplay 0; }] remoteExec ['spawn',_owner]; }; }];