Remove parachute landing animation (#5794)

* Remove parachute landing animation

The vanilla animation has since been reworked and is an improvement.

* Optimise altimeter code

* Fix reserve chute handling and cutting action

* Fix cut parachute action

* Fix cut parachute action further

- Prevent potential for action to be present when reserve is not
available
- Move cut parachute action to the parachute self actions rather than
the player's

* Revert number to string conversion
This commit is contained in:
SilentSpike 2017-12-02 17:02:16 +00:00 committed by PabstMirror
parent 24b58fbb21
commit ec09c2beda
13 changed files with 84 additions and 194 deletions

View File

@ -16,11 +16,3 @@ class Extended_PostInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_Respawn_EventHandlers {
class CAManBase {
class ADDON {
respawn = QUOTE(call FUNC(handleRespawn));
};
};
};

View File

@ -9,23 +9,18 @@ class CfgVehicles {
};
};
class Man;
class CAManBase: Man {
class ACE_SelfActions {
class ACE_CutParachute {
displayName = CSTRING(CutParachute);
exceptions[] = {"isNotInside"};
condition = QUOTE([_player] call FUNC(checkCutParachute));
statement = QUOTE([_player] call FUNC(cutParachute));
showDisabled = 0;
priority = 2.9;
icon = QPATHTOF(UI\cut_ca.paa);
};
};
};
class Helicopter;
class ParachuteBase: Helicopter {
class ACE_SelfActions {
class ACE_CutParachute {
displayName = CSTRING(CutParachute);
condition = QUOTE(_target getVariable [ARR_2(QQGVAR(canCut),false)]);
statement = QUOTE([ARR_2(_player,_target)] call FUNC(cutParachute));
showDisabled = 0;
priority = 2.9;
icon = QPATHTOF(UI\cut_ca.paa);
};
};
MACRO_HASRESERVE
};
class ParachuteWest: ParachuteBase {
@ -43,13 +38,13 @@ class CfgVehicles {
class NonSteerable_Parachute_F: Parachute {
MACRO_HASRESERVE
};
class Paraglide: ParachuteWest{
class Paraglide: ParachuteWest {
MACRO_HASRESERVE
};
class Steerable_Parachute_F: Paraglide{
class Steerable_Parachute_F: Paraglide {
MACRO_HASRESERVE
};
class Parachute_02_base_F: parachuteBase {
class Parachute_02_base_F: ParachuteBase {
MACRO_HASRESERVE
};
class B_Parachute_02_F: Parachute_02_base_F {
@ -98,7 +93,7 @@ class CfgVehicles {
ace_reserveParachute = "";
ace_hasReserveParachute = 0;
};
class ACE_NonSteerableReserveParachute: ACE_ReserveParachute {
ParachuteClass = "NonSteerable_Parachute_F";
};

View File

@ -1,10 +1,5 @@
PREP(doLanding);
PREP(handleInfoDisplayChanged);
PREP(handleRespawn);
PREP(hideAltimeter);
PREP(onEachFrame);
PREP(showAltimeter);
PREP(cutParachute);
PREP(checkCutParachute);
PREP(storeParachute);
PREP(handleInfoDisplayChanged);
PREP(handleReserve);
PREP(hideAltimeter);
PREP(showAltimeter);

View File

@ -19,25 +19,22 @@ if (!hasInterface) exitWith {};
["ACE3 Equipment", QGVAR(showAltimeter), localize LSTRING(showAltimeter), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
if (!('ACE_Altimeter' in assignedItems ace_player)) exitWith {false};
if (!(missionNamespace getVariable [QGVAR(AltimeterActive), false])) then {
if (
!([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call EFUNC(common,canInteractWith)) ||
{!('ACE_Altimeter' in assignedItems ACE_player)}
) exitWith { false };
if !(GETMVAR(GVAR(AltimeterActive),false)) then {
[ACE_player] call FUNC(showAltimeter);
} else {
call FUNC(hideAltimeter);
};
true
}, {false}, [24, [false, false, false]], false] call CBA_fnc_addKeybind;
GVAR(PFH) = false;
["vehicle",{
if (!GVAR(PFH) && {(vehicle ACE_player) isKindOf "ParachuteBase"}) then {
GVAR(PFH) = true;
[FUNC(onEachFrame), 0.1, []] call CALLSTACK(CBA_fnc_addPerFrameHandler);
};
}] call CBA_fnc_addPlayerEventHandler;
// Handle reserve chute based on current backpack (fires when parachute opens too)
["loadout", FUNC(handleReserve), true] call CBA_fnc_addPlayerEventHandler;
// don't show speed and height when in expert mode
// Don't show vanilla speed and height when in expert mode
["ace_infoDisplayChanged", {_this call FUNC(handleInfoDisplayChanged)}] call CBA_fnc_addEventHandler;
["loadout", FUNC(storeParachute)] call CBA_fnc_addPlayerEventHandler;

View File

@ -1,18 +0,0 @@
/*
* Author: joko // Jonas
* Reset the parachute system.
*
* Arguments:
* 0: Object <OBJECT>
*
* Return Value:
* Boolean <BOOL>
*
* Example:
* [player] call FUNC(checkCutParachute);
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
(vehicle _unit isKindOf 'ParachuteBase' && !(_unit getVariable [QGVAR(chuteIsCut),false]) && (_unit getVariable [QGVAR(hasReserve),false]))

View File

@ -1,6 +1,6 @@
/*
* Author: joko // Jonas
* Cut Parachute and delete Old
* Author: joko, Jonas, SilentSpike
* Perform the cut parachute action (move unit out and delete)
*
* Arguments:
* 0: Object <OBJECT>
@ -9,13 +9,11 @@
* None
*
* Example:
* [player] call FUNC(cutParachute);
* [player, vehicle player] call FUNC(cutParachute);
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
private _vehicle = vehicle _unit;
_unit action ["GetOut", _vehicle];
deleteVehicle _vehicle;
_unit setVariable [QGVAR(chuteIsCut), true, true];
params ["_unit", "_parachute"];
_unit action ["GetOut", _parachute];
deleteVehicle _parachute;

View File

@ -1,33 +0,0 @@
/*
* Author: Garth 'L-H' de Wet
* Performs the landing animation fix
*
* Arguments:
* 0: unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player] call ACE_Parachute_fnc_doLanding;
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
GVAR(PFH) = false;
[_unit, "AmovPercMevaSrasWrflDf_AmovPknlMstpSrasWrflDnon", 2] call EFUNC(common,doAnimation);
_unit setVariable [QGVAR(chuteIsCut), false, true];
[{
(_this select 0) params ["_time", "_unit"];
if (CBA_missionTime > _time + 1) then {
[_unit, "Crouch"] call EFUNC(common,doGesture);
[_this select 1] call CALLSTACK(CBA_fnc_removePerFrameHandler);
};
}, 1, [CBA_missionTime, _unit]] call CALLSTACK(CBA_fnc_addPerFrameHandler);

View File

@ -0,0 +1,42 @@
/*
* Author: joko, Jonas, SilentSpike
* Cache reserve parachute on player unit when their inventory changes and add it when they open their parachute
*
* Arguments:
* None
*
* Return Value:
* 0: Unit <OBJECT>
*
* Example:
* [player] call ace_parachute_fnc_handleReserve
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
private _backpack = backpack _unit;
if (
_backpack == "" &&
{(vehicle _unit) isKindOf "ParachuteBase"} &&
{GETVAR(_unit,GVAR(hasReserve),false)}
) then {
// Case where unit has just opened parachute and reserve should be added
_unit addBackpackGlobal (GETVAR(_unit,GVAR(backpackClass),"ACE_NonSteerableReserveParachute"));
SETVAR(vehicle _unit,GVAR(canCut),true); // Mark the parachute cuttable since reserve is present
} else {
// Case where inventory has changed otherwise (including when reserve is added)
private _backpackCfg = configFile >> "CfgVehicles" >> _backpack;
private _hasReserve = getNumber (_backpackCfg >> "ace_hasReserveParachute") == 1;
// Cache reserve parachute state and class when backpack changes
SETVAR(_unit,GVAR(hasReserve),_hasReserve);
if (_hasReserve) then {
SETVAR(_unit,GVAR(backpackClass),getText (_backpackCfg >> "ace_reserveParachute"));
} else {
SETVAR(_unit,GVAR(backpackClass),"");
};
};

View File

@ -1,17 +0,0 @@
/*
* Author: joko // Jonas
* Reset the parachute system.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_parachute_fnc_handleRespawn
*
* Public: No
*/
#include "script_component.hpp"
ACE_player setVariable [QGVAR(chuteIsCut), false];

View File

@ -15,4 +15,4 @@
*/
#include "script_component.hpp"
GVAR(AltimeterActive) = false;
(["ACE_Altimeter"] call BIS_fnc_rscLayer) cutText ["","PLAIN",0,true];
"ACE_Altimeter" cutText ["","PLAIN",0,true];

View File

@ -1,31 +0,0 @@
/*
* Author: Garth 'L-H' de Wet
* Checks whether the unit should preform landing.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ACE_Parachute_fnc_onEachFrame;
*
* Public: No
*/
#include "script_component.hpp"
private _player = ACE_player;
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 {[(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler);GVAR(PFH) = false;};
if (isTouchingGround _player) exitWith {[(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler);GVAR(PFH) = false;};
private _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 FUNC(doLanding);
};

View File

@ -17,32 +17,33 @@
params ["_unit"];
(["ACE_Altimeter"] call BIS_fnc_rscLayer) cutRsc ["ACE_Altimeter", "PLAIN", 0, true];
"ACE_Altimeter" cutRsc ["ACE_Altimeter", "PLAIN", 0, true];
if (isNull (uiNamespace getVariable ["ACE_Altimeter", displayNull])) exitWith {};
GVAR(AltimeterActive) = true;
[{
if (!GVAR(AltimeterActive)) exitWith {[_this select 1] call CALLSTACK(CBA_fnc_removePerFrameEventHandler)};
if (!GVAR(AltimeterActive)) exitWith {[_this select 1] call CBA_fnc_removePerFrameEventHandler};
disableSerialization;
(_this select 0) params ["_display", "_unit", "_oldHeight", "_prevTime"];
if !("ACE_Altimeter" in assignedItems _unit) exitWith {[_this select 1] call CALLSTACK(CBA_fnc_removePerFrameEventHandler); call FUNC(hideAltimeter)};
if !("ACE_Altimeter" in assignedItems _unit) exitWith {[_this select 1] call CBA_fnc_removePerFrameEventHandler; call FUNC(hideAltimeter)};
private _HeightText = _display displayCtrl 1100;
private _DecendRate = _display displayCtrl 1000;
private _TimeText = _display displayCtrl 1001;
private _hour = floor daytime;
private _minute = floor ((daytime - _hour) * 60);
private _height = ((getPosASL _unit) select 2) + EGVAR(common,mapAltitude);
private _curTime = CBA_missionTime;
private _timeDiff = _curTime - _prevTime;
private _descentRate = if(_timeDiff > 0) then {floor((_oldHeight - _height) / _timeDiff)} else {0};
private _descentRate = if (_timeDiff > 0) then {floor((_oldHeight - _height) / _timeDiff)} else {0};
_TimeText ctrlSetText (format ["%1:%2",[_hour, 2] call EFUNC(common,numberToDigitsString),[_minute, 2] call EFUNC(common,numberToDigitsString)]);
_HeightText ctrlSetText (format ["%1", floor(_height)]);
_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), CBA_missionTime]] call CALLSTACK(CBA_fnc_addPerFrameHandler);
}, 0.2, [uiNamespace getVariable ["ACE_Altimeter", displayNull], _unit, floor ((getPosASL _unit) select 2), CBA_missionTime]] call CBA_fnc_addPerFrameHandler;

View File

@ -1,31 +0,0 @@
/*
* Author: joko // Jonas
* Add the Reserve Parachute to Units or Save Backpack if is a Parachute in Unit
*
* Arguments:
* None
*
* Return Value:
* 0: Unit <OBJECT>
*
* Example:
* call ace_parachute_fnc_storeParachute
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
private _backpack = backpack _unit;
if ((vehicle _unit) isKindOf "ParachuteBase" && {backpack _unit == ""} && {!(_unit getVariable [QGVAR(chuteIsCut),false])} && {_unit getVariable [QGVAR(hasReserve),false]}) then {
_unit addBackpackGlobal (_unit getVariable[QGVAR(backpackClass),"ACE_NonSteerableParachute"]);
} else {
if ((getNumber(configFile >> "CfgVehicles" >> _backpack >> "ace_hasReserveParachute")) == 1) then {
_unit setVariable[QGVAR(backpackClass),getText(configFile >> "CfgVehicles" >> _backpack >> "ace_reserveParachute"),true];
};
if (!(_unit getVariable [QGVAR(chuteIsCut),false]) && {!(animationState _unit == 'para_pilot')}) then {
_unit setVariable [QGVAR(hasReserve),[false,true] select (getNumber(configFile >> "CfgVehicles" >> _backpack >> "ace_hasReserveParachute")),true];
};
};