mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Replaced spawn and sleep commands with PFHs
This commit is contained in:
parent
c1aad2a0f5
commit
31b6c97cbe
@ -15,36 +15,37 @@ if (weaponLowered ACE_player) exitWith { true };
|
||||
if (vehicle ACE_player != ACE_player) exitWith { true };
|
||||
if (currentWeapon ACE_player != primaryWeapon ACE_player) exitWith { true };
|
||||
|
||||
[] spawn {
|
||||
2 cutText ["", "PLAIN"];
|
||||
GVAR(WindInfo) = false;
|
||||
0 cutText ["", "PLAIN"];
|
||||
GVAR(Protractor) = true;
|
||||
2 cutText ["", "PLAIN"];
|
||||
GVAR(WindInfo) = false;
|
||||
0 cutText ["", "PLAIN"];
|
||||
GVAR(Protractor) = true;
|
||||
|
||||
while {GVAR(Protractor) && !(weaponLowered ACE_player) && currentWeapon ACE_player == primaryWeapon ACE_player} do {
|
||||
_refPosition = [SafeZoneX + 0.001, SafeZoneY + 0.001, 0.2, 0.2 * 4/3];
|
||||
[{
|
||||
// abort condition
|
||||
if (!(GVAR(Protractor) && !(weaponLowered ACE_player) && currentWeapon ACE_player == primaryWeapon ACE_player)) exitWith {
|
||||
GVAR(Protractor) = false;
|
||||
1 cutText ["", "PLAIN"];
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
_inclinationAngle = asin((ACE_player weaponDirection currentWeapon ACE_player) select 2);
|
||||
_inclinationAngle = -58 max _inclinationAngle min 58;
|
||||
_refPosition = [SafeZoneX + 0.001, SafeZoneY + 0.001, 0.2, 0.2 * 4/3];
|
||||
|
||||
1 cutRsc ["RscProtractor", "PLAIN", 1, false];
|
||||
_inclinationAngle = asin((ACE_player weaponDirection currentWeapon ACE_player) select 2);
|
||||
_inclinationAngle = -58 max _inclinationAngle min 58;
|
||||
|
||||
__ctrl1 ctrlSetScale 0.75;
|
||||
__ctrl1 ctrlCommit 0;
|
||||
__ctrl1 ctrlSetText QUOTE(PATHTOF(UI\protractor.paa));
|
||||
__ctrl1 ctrlSetTextColor [1, 1, 1, 1];
|
||||
1 cutRsc ["RscProtractor", "PLAIN", 1, false];
|
||||
|
||||
__ctrl2 ctrlSetScale 0.75;
|
||||
__ctrl2 ctrlSetPosition [(_refPosition select 0), (_refPosition select 1) - 0.0012 * _inclinationAngle, (_refPosition select 2), (_refPosition select 3)];
|
||||
__ctrl2 ctrlCommit 0;
|
||||
__ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa));
|
||||
__ctrl2 ctrlSetTextColor [1, 1, 1, 1];
|
||||
__ctrl1 ctrlSetScale 0.75;
|
||||
__ctrl1 ctrlCommit 0;
|
||||
__ctrl1 ctrlSetText QUOTE(PATHTOF(UI\protractor.paa));
|
||||
__ctrl1 ctrlSetTextColor [1, 1, 1, 1];
|
||||
|
||||
sleep 0.1;
|
||||
};
|
||||
__ctrl2 ctrlSetScale 0.75;
|
||||
__ctrl2 ctrlSetPosition [(_refPosition select 0), (_refPosition select 1) - 0.0012 * _inclinationAngle, (_refPosition select 2), (_refPosition select 3)];
|
||||
__ctrl2 ctrlCommit 0;
|
||||
__ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa));
|
||||
__ctrl2 ctrlSetTextColor [1, 1, 1, 1];
|
||||
|
||||
GVAR(Protractor) = false;
|
||||
1 cutText ["", "PLAIN"];
|
||||
};
|
||||
}, 0.1, _this select 0] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
true
|
||||
|
@ -13,52 +13,53 @@ if (GVAR(WindInfo)) exitWith {
|
||||
if (underwater ACE_player) exitWith { true };
|
||||
if (vehicle ACE_player != ACE_player) exitWith { true };
|
||||
|
||||
[] spawn {
|
||||
2 cutText ["", "PLAIN"];
|
||||
GVAR(Protractor) = false;
|
||||
1 cutText ["", "PLAIN"];
|
||||
GVAR(WindInfo) = true;
|
||||
2 cutText ["", "PLAIN"];
|
||||
GVAR(Protractor) = false;
|
||||
1 cutText ["", "PLAIN"];
|
||||
GVAR(WindInfo) = true;
|
||||
|
||||
while {GVAR(WindInfo) && !(underwater ACE_player) && vehicle ACE_player == ACE_player} do {
|
||||
_windIndex = 12;
|
||||
_windColor = [1, 1, 1, 1];
|
||||
[{
|
||||
// abort condition
|
||||
if (!(GVAR(WindInfo) && !(underwater ACE_player) && vehicle ACE_player == ACE_player)) exitWith {
|
||||
GVAR(WindInfo) = false;
|
||||
0 cutText ["", "PLAIN"];
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
_windSpeed = (eyePos ACE_player) call FUNC(calculateWindSpeed);
|
||||
_windIndex = 12;
|
||||
_windColor = [1, 1, 1, 1];
|
||||
|
||||
if (_windSpeed > 0.2) then {
|
||||
_playerDir = getDir ACE_player;
|
||||
_windDir = (wind select 0) atan2 (wind select 1);
|
||||
_windIndex = round(((_playerDir - _windDir + 360) % 360) / 30);
|
||||
_windIndex = _windIndex % 12;
|
||||
};
|
||||
_windSpeed = (eyePos ACE_player) call FUNC(calculateWindSpeed);
|
||||
|
||||
// Color Codes from https://en.wikipedia.org/wiki/Beaufort_scale#Modern_scale
|
||||
if (_windSpeed > 0.3) then { _windColor = [0.796, 1, 1, 1]; };
|
||||
if (_windSpeed > 1.5) then { _windColor = [0.596, 0.996, 0.796, 1]; };
|
||||
if (_windSpeed > 3.3) then { _windColor = [0.596, 0.996, 0.596, 1]; };
|
||||
if (_windSpeed > 5.4) then { _windColor = [0.6, 0.996, 0.4, 1]; };
|
||||
if (_windSpeed > 7.9) then { _windColor = [0.6, 0.996, 0.047, 1]; };
|
||||
if (_windSpeed > 10.7) then { _windColor = [0.8, 0.996, 0.059, 1]; };
|
||||
if (_windSpeed > 13.8) then { _windColor = [1, 0.996, 0.067, 1]; };
|
||||
if (_windSpeed > 17.1) then { _windColor = [1, 0.796, 0.051, 1]; };
|
||||
if (_windSpeed > 20.7) then { _windColor = [1, 0.596, 0.039, 1]; };
|
||||
if (_windSpeed > 24.4) then { _windColor = [1, 0.404, 0.031, 1]; };
|
||||
if (_windSpeed > 28.4) then { _windColor = [1, 0.22, 0.027, 1]; };
|
||||
if (_windSpeed > 32.6) then { _windColor = [1, 0.078, 0.027, 1]; };
|
||||
if (_windSpeed > 0.2) then {
|
||||
_playerDir = getDir ACE_player;
|
||||
_windDir = (wind select 0) atan2 (wind select 1);
|
||||
_windIndex = round(((_playerDir - _windDir + 360) % 360) / 30);
|
||||
_windIndex = _windIndex % 12;
|
||||
};
|
||||
|
||||
0 cutRsc ["RscWindIntuitive", "PLAIN", 1, false];
|
||||
// Color Codes from https://en.wikipedia.org/wiki/Beaufort_scale#Modern_scale
|
||||
if (_windSpeed > 0.3) then { _windColor = [0.796, 1, 1, 1]; };
|
||||
if (_windSpeed > 1.5) then { _windColor = [0.596, 0.996, 0.796, 1]; };
|
||||
if (_windSpeed > 3.3) then { _windColor = [0.596, 0.996, 0.596, 1]; };
|
||||
if (_windSpeed > 5.4) then { _windColor = [0.6, 0.996, 0.4, 1]; };
|
||||
if (_windSpeed > 7.9) then { _windColor = [0.6, 0.996, 0.047, 1]; };
|
||||
if (_windSpeed > 10.7) then { _windColor = [0.8, 0.996, 0.059, 1]; };
|
||||
if (_windSpeed > 13.8) then { _windColor = [1, 0.996, 0.067, 1]; };
|
||||
if (_windSpeed > 17.1) then { _windColor = [1, 0.796, 0.051, 1]; };
|
||||
if (_windSpeed > 20.7) then { _windColor = [1, 0.596, 0.039, 1]; };
|
||||
if (_windSpeed > 24.4) then { _windColor = [1, 0.404, 0.031, 1]; };
|
||||
if (_windSpeed > 28.4) then { _windColor = [1, 0.22, 0.027, 1]; };
|
||||
if (_windSpeed > 32.6) then { _windColor = [1, 0.078, 0.027, 1]; };
|
||||
|
||||
__ctrl ctrlSetScale 0.75;
|
||||
__ctrl ctrlCommit 0;
|
||||
0 cutRsc ["RscWindIntuitive", "PLAIN", 1, false];
|
||||
|
||||
__ctrl ctrlSetText format[QUOTE(PATHTOF(UI\wind%1.paa)), _windIndex];
|
||||
__ctrl ctrlSetTextColor _windColor;
|
||||
__ctrl ctrlSetScale 0.75;
|
||||
__ctrl ctrlCommit 0;
|
||||
|
||||
sleep 0.5;
|
||||
};
|
||||
__ctrl ctrlSetText format[QUOTE(PATHTOF(UI\wind%1.paa)), _windIndex];
|
||||
__ctrl ctrlSetTextColor _windColor;
|
||||
|
||||
GVAR(WindInfo) = false;
|
||||
0 cutText ["", "PLAIN"];
|
||||
};
|
||||
}, 0.5, _this select 0] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
true
|
||||
|
Loading…
Reference in New Issue
Block a user