Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cut Parachute/Reserve parachute #1307

Merged
merged 21 commits into from
Jul 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions addons/parachute/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
};
};
};
36 changes: 36 additions & 0 deletions addons/parachute/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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";};
Expand Down
Binary file added addons/parachute/UI/cut_ca.paa
Binary file not shown.
4 changes: 3 additions & 1 deletion addons/parachute/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand All @@ -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);
4 changes: 3 additions & 1 deletion addons/parachute/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ PREP(handleInfoDisplayChanged);
PREP(hideAltimeter);
PREP(onEachFrame);
PREP(showAltimeter);

PREP(cutParachute);
PREP(checkCutParachute);
PREP(storeParachute);
ADDON = true;
17 changes: 17 additions & 0 deletions addons/parachute/XEH_respawn.sqf
Original file line number Diff line number Diff line change
@@ -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];
19 changes: 19 additions & 0 deletions addons/parachute/functions/fnc_checkCutParachute.sqf
Original file line number Diff line number Diff line change
@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing private

(vehicle _unit isKindOf 'ParachuteBase' && !(_unit getvariable [QGVAR(chuteIsCut),false]) && (_unit getvariable [QGVAR(hasReserve),false]))
22 changes: 22 additions & 0 deletions addons/parachute/functions/fnc_cutParachute.sqf
Original file line number Diff line number Diff line change
@@ -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];
3 changes: 2 additions & 1 deletion addons/parachute/functions/fnc_doLanding.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
30 changes: 30 additions & 0 deletions addons/parachute/functions/fnc_storeParachute.sqf
Original file line number Diff line number Diff line change
@@ -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"))];
};
};
8 changes: 8 additions & 0 deletions addons/parachute/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,13 @@
<Italian>Paracadute non manovrabile</Italian>
<Portuguese>Para-querdas não controlável</Portuguese>
</Key>
<Key ID="STR_ACE_Parachute_CutParachute">
<English>Cut Parachute</English>
<German>Fallschirm abschneiden</German>
</Key>
<Key ID="STR_ACE_Parachute_ReserveParachute">
<English>Reserve Parachute</English>
<German>Reserve Fallschirm</German>
</Key>
</Package>
</Project>
2 changes: 1 addition & 1 deletion documentation/development/ace3-events-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ PREP(onTapShoulder);
<td>"playerInventoryChanged"</td>
<td>Inventory changed</td>
<td>common</td>
<td>getAllGear-Array</td>
<td>[_player, getAllGear-Array]</td>
<td>local</td>
</tr>
</tr>
Expand Down