From 3745c3570f2abd913361a1735eefdfde6767e030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brostr=C3=B6m=2EA=20=7C=20Evul?= Date: Thu, 2 May 2024 16:41:22 +0000 Subject: [PATCH] Improved code quality for the the Halo and Line Jump script (#1191) --- cScripts/functions/mission/fn_addHaloJump.sqf | 16 +++++++++++++++- cScripts/functions/mission/fn_addLineJump.sqf | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/cScripts/functions/mission/fn_addHaloJump.sqf b/cScripts/functions/mission/fn_addHaloJump.sqf index e4b91368e..85f756437 100644 --- a/cScripts/functions/mission/fn_addHaloJump.sqf +++ b/cScripts/functions/mission/fn_addHaloJump.sqf @@ -24,7 +24,21 @@ params [ // Check so the options arent added twice. if (!isNil {_vehicle getVariable QEGVAR(VehicleFunc,HaloAction)}) exitWith {SHOW_WARNING_1("HaloJump", "Aircraft halo jump setting already applied for %1.", _vehicle)}; -private _conditionHoldAction = format ["((_target getCargoIndex player) != -1) && ((_target animationPhase 'ramp_bottom' > 0.64) or (_target animationPhase 'door_2_1' == 1) or (_target animationPhase 'door_2_2' == 1) or (_target animationPhase 'jumpdoor_1' == 1) or (_target animationPhase 'jumpdoor_2' == 1) or (_target animationPhase 'back_ramp_switch' == 1) or (_target animationPhase 'back_ramp_half_switch' == 1) or (_target doorPhase 'RearDoors' > 0.5) or (_target doorPhase 'Door_1_source' > 0.5) or (_target animationSourcePhase 'ramp_anim' > 0.5)) && ((getPosVisual _target) select 2 >= %1)", _minAltetude]; +private _doors = tostring { + ((_target animationPhase 'ramp_bottom' > 0.64) || // RHS_C130J + (_target animationPhase 'door_2_1' == 1) || // RHS_C130J + (_target animationPhase 'door_2_2' == 1) || // RHS_C130J + (_target animationPhase 'jumpdoor_1' == 1) || + (_target animationPhase 'jumpdoor_2' == 1) || + (_target animationPhase 'back_ramp_switch' == 1) || + (_target animationPhase 'back_ramp_half_switch' == 1) || + (_target doorPhase 'RearDoors' > 0.5) || + (_target doorPhase 'Door_1_source' > 0.5) || + (_target animationSourcePhase 'ramp_anim' > 0.5) || + (_target animationPhase 'Ramp' < 0.5)) // TF373_RAF_HC5, TF373_SOAR_MH47G_No_Rear_Guns +}; + +private _conditionHoldAction = format ["((_target getCargoIndex player) != -1) && (%1) && ((getPosVisual _target) select 2 >= %2)", _doors, _minAltetude]; // Add hold action for jump private _actionID = [ diff --git a/cScripts/functions/mission/fn_addLineJump.sqf b/cScripts/functions/mission/fn_addLineJump.sqf index f450008a9..d80c13976 100644 --- a/cScripts/functions/mission/fn_addLineJump.sqf +++ b/cScripts/functions/mission/fn_addLineJump.sqf @@ -29,7 +29,21 @@ params [ // Check so the options arent added twice. if (!isNil {_vehicle getVariable QEGVAR(VehicleFunc,JumpAction)}) exitWith {SHOW_WARNING_1("JumpAction", "Aircraft jump setting already applied for %1.", _vehicle)}; -private _conditionHoldAction = format ["((_target getCargoIndex player) != -1) && ((_target animationPhase 'ramp_bottom' > 0.64) or (_target animationPhase 'door_2_1' == 1) or (_target animationPhase 'door_2_2' == 1) or (_target animationPhase 'jumpdoor_1' == 1) or (_target animationPhase 'jumpdoor_2' == 1) or (_target animationPhase 'back_ramp_switch' == 1) or (_target animationPhase 'back_ramp_half_switch' == 1) or (_target doorPhase 'RearDoors' > 0.5) or (_target doorPhase 'Door_1_source' > 0.5) or (_target animationSourcePhase 'ramp_anim' > 0.5) or (_target animationPhase 'Ramp' < 0.5)) && ((getPosVisual _target) select 2 >= %1) && ((getPosVisual _target) select 2 <= %2) && (speed _target <= %3)", _minAltetude, _maxAltetude, _maxSpeed]; +private _doors = tostring { + ((_target animationPhase 'ramp_bottom' > 0.64) || // RHS_C130J + (_target animationPhase 'door_2_1' == 1) || // RHS_C130J + (_target animationPhase 'door_2_2' == 1) || // RHS_C130J + (_target animationPhase 'jumpdoor_1' == 1) || + (_target animationPhase 'jumpdoor_2' == 1) || + (_target animationPhase 'back_ramp_switch' == 1) || + (_target animationPhase 'back_ramp_half_switch' == 1) || + (_target doorPhase 'RearDoors' > 0.5) || + (_target doorPhase 'Door_1_source' > 0.5) || + (_target animationSourcePhase 'ramp_anim' > 0.5) || + (_target animationPhase 'Ramp' < 0.5)) // TF373_RAF_HC5, TF373_SOAR_MH47G_No_Rear_Guns +}; + +private _conditionHoldAction = format ["((_target getCargoIndex player) != -1) && (%1) && ((getPosVisual _target) select 2 >= %2) && ((getPosVisual _target) select 2 <= %3) && (speed _target <= %4)", _doors, _minAltetude, _maxAltetude, _maxSpeed]; // Add hold action for jump private _actionID = [