mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Converted to use CBA PFH's and MACROs.
This commit is contained in:
parent
966cb6ffdf
commit
aca1c0c6cf
@ -4,27 +4,23 @@ if (!hasInterface) exitWith {};
|
||||
["ACE3", localize "STR_ACE_Parachute_showAltimeter",
|
||||
{
|
||||
if (!('ACE_Altimeter' in assignedItems ace_player)) exitWith {false};
|
||||
if (isNull (missionNamespace getVariable ['ACE_Parachute_AltimeterFnc', scriptNull])) then {
|
||||
[ace_player] call ACE_Parachute_fnc_showAltimeter
|
||||
if (!(missionNamespace getVariable [QGVAR(AltimeterActive), false])) then {
|
||||
[ace_player] call FUNC(showAltimeter);
|
||||
} else {
|
||||
call ACE_Parachute_fnc_hideAltimeter
|
||||
call FUNC(hideAltimeter);
|
||||
};
|
||||
true
|
||||
}, [24, false, false, false], false, "keydown"] call CALLSTACK(cba_fnc_registerKeybind);
|
||||
|
||||
[] spawn {
|
||||
ACE_Parachuting_PFH = false;
|
||||
while {true} do {
|
||||
sleep 1;
|
||||
// I believe this doesn't work for Zeus.
|
||||
// vehicle _player
|
||||
if (!ACE_Parachuting_PFH && {(vehicle ACE_player) isKindOf "ParachuteBase"}) then {
|
||||
ACE_Parachuting_PFH = true;
|
||||
["ACE_ParachuteFix", "OnEachFrame", {call ACE_Parachute_fnc_onEachFrame;}] call BIS_fnc_addStackedEventHandler;
|
||||
GVAR(PFH) = false;
|
||||
|
||||
[{
|
||||
if (!GVAR(PFH) && {(vehicle ACE_player) isKindOf "ParachuteBase"}) then {
|
||||
GVAR(PFH) = true;
|
||||
[FUNC(onEachFrame), 0.1, []] call CALLSTACK(cba_fnc_addPerFrameHandler);
|
||||
};
|
||||
};
|
||||
};
|
||||
}, 1, []] call CALLSTACK(cba_fnc_addPerFrameHandler);
|
||||
|
||||
// don't show speed and height when in expert mode
|
||||
["Parachute", {if (!cadetMode) then {_dlg = _this select 0; {(_dlg displayCtrl _x) ctrlShow false} forEach [121, 122, 1004, 1005, 1006, 1014];};}] call ACE_Core_fnc_addInfoDisplayEventHandler; //@todo addEventHandler infoDisplayChanged with select 1 == "Parachute"
|
||||
["Soldier", {if (!cadetMode) then {_dlg = _this select 0; {_ctrl = (_dlg displayCtrl _x); _ctrl ctrlSetPosition [0,0,0,0]; _ctrl ctrlCommit 0;} forEach [380, 382]};}] call ACE_Core_fnc_addInfoDisplayEventHandler; //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier"
|
||||
["Parachute", {if (!cadetMode) then {_dlg = _this select 0; {(_dlg displayCtrl _x) ctrlShow false} forEach [121, 122, 1004, 1005, 1006, 1014];};}] call EFUNC(common,addInfoDisplayEventHandler); //@todo addEventHandler infoDisplayChanged with select 1 == "Parachute"
|
||||
["Soldier", {if (!cadetMode) then {_dlg = _this select 0; {_ctrl = (_dlg displayCtrl _x); _ctrl ctrlSetPosition [0,0,0,0]; _ctrl ctrlCommit 0;} forEach [380, 382]};}] call EFUNC(common,addInfoDisplayEventHandler); //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier"
|
||||
|
@ -18,10 +18,11 @@
|
||||
#include "script_component.hpp"
|
||||
private ["_unit"];
|
||||
_unit = _this select 0;
|
||||
["ACE_ParachuteFix", "OnEachFrame"] call BIS_fnc_removeStackedEventHandler;
|
||||
ACE_Parachuting_PFH = false;
|
||||
[_unit, "AmovPercMevaSrasWrflDf_AmovPknlMstpSrasWrflDnon", 2] call ACE_Core_fnc_doAnimation;
|
||||
[_unit] spawn {
|
||||
sleep 1;
|
||||
(_this select 0) playActionNow "Crouch";
|
||||
};
|
||||
GVAR(PFH) = false;
|
||||
[_unit, "AmovPercMevaSrasWrflDf_AmovPknlMstpSrasWrflDnon", 2] call EFUNC(common,doAnimation);
|
||||
[{
|
||||
if (diag_tickTime >= ((_this select 0) select 0) + 1) then {
|
||||
((_this select 0) select 1) playActionNow "Crouch";
|
||||
[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);
|
||||
};
|
||||
}, 1, [diag_tickTime,_unit]] call CALLSTACK(cba_fnc_addPerFrameHandler);
|
||||
|
@ -15,5 +15,5 @@
|
||||
call ACE_Parachute_fnc_hideAltimeter
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
terminate ACE_Parachute_AltimeterFnc;
|
||||
GVAR(AltimeterActive) = false;
|
||||
(["ACE_Altimeter"] call BIS_fnc_rscLayer) cutText ["","PLAIN",0,true];
|
||||
|
@ -18,15 +18,18 @@
|
||||
#include "script_component.hpp"
|
||||
private "_player";
|
||||
_player = ACE_player;
|
||||
if (isNull _player) exitWith {["ACE_ParachuteFix", "OnEachFrame"] call BIS_fnc_removeStackedEventHandler;ACE_Parachuting_PFH = false;};
|
||||
if (!GVAR(PFH)) exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);};
|
||||
if (isNull _player) exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);GVAR(PFH) = false;};
|
||||
if !((vehicle _player) isKindOf "ParachuteBase") exitWith {};
|
||||
if (isTouchingGround _player) exitWith {};
|
||||
if (isTouchingGround _player) exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);GVAR(PFH) = false;};
|
||||
|
||||
private ["_pos", "_intersects"];
|
||||
_pos = getPosASL (Vehicle _player);
|
||||
private ["_pos"];
|
||||
_pos = getPosASL (vehicle _player);
|
||||
|
||||
if ((lineIntersects [_pos, _pos vectorAdd [0,0,-0.5], vehicle _player, _player]) || {((ASLtoATL _pos) select 2) < 0.75}) then {
|
||||
[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);
|
||||
GVAR(PFH) = false;
|
||||
// I believe this will not work for Zeus units.
|
||||
deleteVehicle (vehicle _player);
|
||||
[_player] call ACE_Parachute_fnc_doLanding;
|
||||
[_player] call FUNC(doLanding);
|
||||
};
|
||||
|
@ -21,33 +21,28 @@ _unit = _this select 0;
|
||||
(["ACE_Altimeter"] call BIS_fnc_rscLayer) cutRsc ["ACE_Altimeter", "PLAIN",0,true];
|
||||
if (isNull (uiNamespace getVariable ["ACE_Altimeter", displayNull])) exitWith {};
|
||||
|
||||
ACE_Parachute_AltimeterFnc = [uiNamespace getVariable ["ACE_Altimeter", displayNull], _unit] spawn {
|
||||
private ["_height", "_hour", "_minute", "_descentRate"];
|
||||
_unit = _this select 1;
|
||||
_height = floor ((getPosASL _unit) select 2);
|
||||
_oldHeight = _height;
|
||||
_descentRate = 0;
|
||||
GVAR(AltimeterActive) = true;
|
||||
[{
|
||||
if (!GVAR(AltimeterActive)) exitWith {[_this select 1] call CALLSTACK(cba_fnc_removePerFrameEventHandler);};
|
||||
disableSerialization;
|
||||
EXPLODE_4_PVT(_this select 0,_display,_unit,_oldHeight,_prevTime);
|
||||
if !("ACE_Altimeter" in assignedItems _unit) exitWith {[_this select 1] call CALLSTACK(cba_fnc_removePerFrameEventHandler);call FUNC(hideAltimeter);};
|
||||
|
||||
private ["_height", "_hour", "_minute", "_descentRate","_HeightText", "_DecendRate", "_TimeText", "_curTime"];
|
||||
_HeightText = _display displayCtrl 1100;
|
||||
_DecendRate = _display displayCtrl 1000;
|
||||
_TimeText = _display displayCtrl 1001;
|
||||
_hour = floor daytime;
|
||||
_minute = floor ((daytime - _hour) * 60);
|
||||
disableSerialization;
|
||||
private ["_HeightText", "_DecendRate", "_TimeText", "_prevTime", "_curTime"];
|
||||
_HeightText = (_this select 0) displayCtrl 1100;
|
||||
_DecendRate = (_this select 0) displayCtrl 1000;
|
||||
_TimeText = (_this select 0) displayCtrl 1001;
|
||||
_curTime = time;
|
||||
_prevTime = _curTime;
|
||||
while {true} do {
|
||||
_TimeText ctrlSetText (format ["%1:%2",[_hour, 2] call ACE_Core_fnc_numberToDigitsString,[_minute, 2] call ACE_Core_fnc_numberToDigitsString]);
|
||||
_HeightText ctrlSetText (format ["%1", floor(_height)]);
|
||||
_DecendRate ctrlSetText (format ["%1", _descentRate max 0]);
|
||||
sleep 0.2;
|
||||
|
||||
_height = (getPosASL _unit) select 2;
|
||||
_curTime = time;
|
||||
_descentRate = floor ((_oldHeight - _height) / (_curTime - _prevTime));
|
||||
_oldHeight = _height;
|
||||
_prevTime = _curTime;
|
||||
|
||||
// close altimeter, @todo _unit can change due to team switch, zeus!
|
||||
if !("ACE_Altimeter" in assignedItems _unit) exitWith {call ACE_Parachute_fnc_hideAltimeter};
|
||||
};
|
||||
};
|
||||
_TimeText ctrlSetText (format ["%1:%2",[_hour, 2] call EFUNC(common,numberToDigitsString),[_minute, 2] call EFUNC(common,numberToDigitsString)]);
|
||||
_HeightText ctrlSetText (format ["%1", floor(_height)]);
|
||||
_DecendRate ctrlSetText (format ["%1", _descentRate max 0]);
|
||||
|
||||
(_this select 0) set [2, _height];
|
||||
(_this select 0) set [3, _curTime];
|
||||
}, 0.2, [uiNamespace getVariable ["ACE_Altimeter", displayNull], _unit,floor ((getPosASL _unit) select 2), time]] call CALLSTACK(cba_fnc_addPerFrameEventHandler);
|
||||
|
Loading…
Reference in New Issue
Block a user