diff --git a/addons/parachute/CfgEventHandlers.hpp b/addons/parachute/CfgEventHandlers.hpp index 8c7edda20f..7a1f8119ca 100644 --- a/addons/parachute/CfgEventHandlers.hpp +++ b/addons/parachute/CfgEventHandlers.hpp @@ -8,3 +8,10 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; +class Extended_Respawn_EventHandlers { + class CAManBase { + class ADDON { + respawn = QUOTE(call COMPILE_FILE(XEH_respawn)); + }; + }; +}; \ No newline at end of file diff --git a/addons/parachute/CfgVehicles.hpp b/addons/parachute/CfgVehicles.hpp index bc5ecbd60f..43bf3ecc8d 100644 --- a/addons/parachute/CfgVehicles.hpp +++ b/addons/parachute/CfgVehicles.hpp @@ -12,9 +12,35 @@ class CfgVehicles { backpack = "ACE_NonSteerableParachute"; count = 4; }; + class _xx_ACE_ReserveParachute { + backpack = "ACE_ReserveParachute"; + count = 4; + }; }; }; + 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 = QUOTE(PATHTOF(UI\cut_ca.paa)); + hotkey = "C"; // Did this realy Work? + }; + }; + }; + + class Helicopter; + class ParachuteBase: Helicopter { + ace_hasReserveParachute = 1; + ace_reserveParachute = "ACE_ReserveParachute"; + }; + class B_Parachute; class ACE_NonSteerableParachute: B_Parachute { author = ECSTRING(common,ACETeam); @@ -28,6 +54,16 @@ class CfgVehicles { mass = 100; }; + class ACE_ReserveParachute: ACE_NonSteerableParachute { + author = ECSTRING(common,ACETeam); + displayName = CSTRING(ReserveParachute); + scope = 2; + mass = 70; + ParachuteClass = "NonSteerable_Parachute_F"; + ace_reserveParachute = ""; + ace_hasReserveParachute = 0; + }; + class B_Soldier_05_f; class B_Pilot_F: B_Soldier_05_f {backpack = "ACE_NonSteerableParachute";}; class I_Soldier_04_F; class I_pilot_F: I_Soldier_04_F {backpack = "ACE_NonSteerableParachute";}; class O_helipilot_F; class O_Pilot_F: O_helipilot_F {backpack = "ACE_NonSteerableParachute";}; diff --git a/addons/parachute/UI/cut_ca.paa b/addons/parachute/UI/cut_ca.paa new file mode 100644 index 0000000000..2f5948535b Binary files /dev/null and b/addons/parachute/UI/cut_ca.paa differ diff --git a/addons/parachute/XEH_postInit.sqf b/addons/parachute/XEH_postInit.sqf index a8f83b43a3..86626882e0 100644 --- a/addons/parachute/XEH_postInit.sqf +++ b/addons/parachute/XEH_postInit.sqf @@ -23,7 +23,7 @@ if (!hasInterface) exitWith {}; 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 { - [ace_player] call FUNC(showAltimeter); + [ACE_player] call FUNC(showAltimeter); } else { call FUNC(hideAltimeter); }; @@ -42,3 +42,5 @@ GVAR(PFH) = false; // don't show speed and height when in expert mode ["infoDisplayChanged", {_this call FUNC(handleInfoDisplayChanged)}] call EFUNC(common,addEventHandler); +//[ACE_Player,([ACE_player] call EFUNC(common,getAllGear))] call FUNC(storeParachute); +["playerInventoryChanged", FUNC(storeParachute) ] call EFUNC(common,addEventHandler); diff --git a/addons/parachute/XEH_preInit.sqf b/addons/parachute/XEH_preInit.sqf index f446d955b8..7bc0823215 100644 --- a/addons/parachute/XEH_preInit.sqf +++ b/addons/parachute/XEH_preInit.sqf @@ -22,5 +22,7 @@ PREP(handleInfoDisplayChanged); PREP(hideAltimeter); PREP(onEachFrame); PREP(showAltimeter); - +PREP(cutParachute); +PREP(checkCutParachute); +PREP(storeParachute); ADDON = true; diff --git a/addons/parachute/XEH_respawn.sqf b/addons/parachute/XEH_respawn.sqf new file mode 100644 index 0000000000..31e3ff2ae2 --- /dev/null +++ b/addons/parachute/XEH_respawn.sqf @@ -0,0 +1,17 @@ +/* + * Author: joko // Jonas + * Reset the parachute system. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ +#include "script_component.hpp" +ACE_player setVariable [QGVAR(chuteIsCut), false]; \ No newline at end of file diff --git a/addons/parachute/functions/fnc_checkCutParachute.sqf b/addons/parachute/functions/fnc_checkCutParachute.sqf new file mode 100644 index 0000000000..8301007fa3 --- /dev/null +++ b/addons/parachute/functions/fnc_checkCutParachute.sqf @@ -0,0 +1,19 @@ +/* + * Author: joko // Jonas + * Reset the parachute system. + * + * Arguments: + * 0: Object + * + * Return Value: + * Boolean + * + * Example: + * [player] call FUNC(checkCutParachute); + * + * Public: No + */ +#include "script_component.hpp" +private["_unit"]; +_unit = _this select 0; +(vehicle _unit isKindOf 'ParachuteBase' && !(_unit getvariable [QGVAR(chuteIsCut),false]) && (_unit getvariable [QGVAR(hasReserve),false])) \ No newline at end of file diff --git a/addons/parachute/functions/fnc_cutParachute.sqf b/addons/parachute/functions/fnc_cutParachute.sqf new file mode 100644 index 0000000000..e8300012c3 --- /dev/null +++ b/addons/parachute/functions/fnc_cutParachute.sqf @@ -0,0 +1,22 @@ +/* + * Author: joko // Jonas + * Cut Parachute and delete Old + * + * Arguments: + * 0: Object + * + * Return Value: + * Nothing + * + * Example: + * [player] call FUNC(cutParachute); + * + * Public: No + */ +#include "script_component.hpp" +private["_unit","_vehicle"]; +_unit = _this select 0; +_vehicle = vehicle _unit; +_unit action ["GetOut", _vehicle]; +deleteVehicle _vehicle; +_unit setVariable [QGVAR(chuteIsCut), true]; \ No newline at end of file diff --git a/addons/parachute/functions/fnc_doLanding.sqf b/addons/parachute/functions/fnc_doLanding.sqf index a620c5a4ca..3582dc797f 100644 --- a/addons/parachute/functions/fnc_doLanding.sqf +++ b/addons/parachute/functions/fnc_doLanding.sqf @@ -14,10 +14,11 @@ * Public: No */ #include "script_component.hpp" -private ["_unit"]; +private["_unit"]; _unit = _this select 0; GVAR(PFH) = false; [_unit, "AmovPercMevaSrasWrflDf_AmovPknlMstpSrasWrflDnon", 2] call EFUNC(common,doAnimation); +_unit setVariable [QGVAR(chuteIsCut), false]; [{ if (ACE_time >= ((_this select 0) select 0) + 1) then { ((_this select 0) select 1) playActionNow "Crouch"; diff --git a/addons/parachute/functions/fnc_storeParachute.sqf b/addons/parachute/functions/fnc_storeParachute.sqf new file mode 100644 index 0000000000..45889b05b6 --- /dev/null +++ b/addons/parachute/functions/fnc_storeParachute.sqf @@ -0,0 +1,30 @@ +/* + * Author: joko // Jonas + * Add the Reserve Parachute to Units or Save Backpack if is a Parachute in Unit + * + * Arguments: + * None + * + * Return Value: + * 0: Unit + * 1: getAllGear-Array + * + * Example: + * None + * + * Public: No + */ + #include "script_component.hpp" + private ["_unit","_backpack"]; + _unit = _this select 0; + _backpack = (_this select 1) select 6 ; + if ((vehicle _unit) isKindOf "ParachuteBase" && backpack _unit == "" && !(_unit getVariable [QGVAR(chuteIsCut),false]) && (_unit getvariable [QGVAR(hasReserve),false])) then { + _unit addBackpack (_unit getVariable[QGVAR(backpackClass),"ACE_NonSteerableParachute"]); + } else { + if ([false,true] select (getNumber(configFile >> "CfgVehicles" >> _backpack >> "ace_hasReserveParachute"))) then { + _unit setVariable[QGVAR(backpackClass),getText(configFile >> "CfgVehicles" >> _backpack >> "ace_reserveParachute")]; + }; + if (!(_unit getVariable [QGVAR(chuteIsCut),false]) && !(animationState _unit == 'para_pilot')) then { + _unit setVariable [QGVAR(hasReserve),[false,true] select (getNumber(configFile >> "CfgVehicles" >> _backpack >> "ace_hasReserveParachute"))]; + }; + }; \ No newline at end of file diff --git a/addons/parachute/stringtable.xml b/addons/parachute/stringtable.xml index d3cdbd9a7d..b9ccad48a4 100644 --- a/addons/parachute/stringtable.xml +++ b/addons/parachute/stringtable.xml @@ -49,5 +49,13 @@ Paracadute non manovrabile Para-querdas não controlável + + Cut Parachute + Fallschirm abschneiden + + + Reserve Parachute + Reserve Fallschirm + diff --git a/documentation/development/ace3-events-system.md b/documentation/development/ace3-events-system.md index 77281c9c7c..e9618d1456 100644 --- a/documentation/development/ace3-events-system.md +++ b/documentation/development/ace3-events-system.md @@ -73,7 +73,7 @@ PREP(onTapShoulder); "playerInventoryChanged" Inventory changed common - getAllGear-Array + [_player, getAllGear-Array] local