Skip to content

Commit

Permalink
Improved code quality for the the Halo and Line Jump script (#1191)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBrostrom authored May 2, 2024
1 parent 95883fa commit 3745c35
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
16 changes: 15 additions & 1 deletion cScripts/functions/mission/fn_addHaloJump.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
16 changes: 15 additions & 1 deletion cScripts/functions/mission/fn_addLineJump.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit 3745c35

Please sign in to comment.