Add RHSGREF UH-1H fastroping capability (#8748)

This commit is contained in:
Whigital 2022-03-06 20:33:42 +01:00 committed by GitHub
parent f54278c9fc
commit e7a827b875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 214 additions and 1 deletions

View File

@ -0,0 +1,11 @@
class Extended_PreStart_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_preStart));
};
};
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
};
};

View File

@ -1,3 +1,16 @@
#define EQUIP_FRIES_ATTRIBUTE class Attributes { \
class EGVAR(fastroping,equipFRIES) { \
property = QEGVAR(fastroping,equipFRIES); \
control = "Checkbox"; \
displayName = ECSTRING(fastroping,Eden_equipFRIES); \
tooltip = ECSTRING(fastroping,Eden_equipFRIES_Tooltip); \
expression = QUOTE([_this] call EFUNC(fastroping,equipFRIES)); \
typeName = "BOOL"; \
condition = "objectVehicle"; \
defaultValue = false; \
}; \
}
class CfgVehicles {
class Rubber_duck_base_F;
class rhsgref_canoe_base: Rubber_duck_base_F {
@ -37,6 +50,62 @@ class CfgVehicles {
};
};
class Helicopter_Base_H;
class rhs_uh1h_base: Helicopter_Base_H {
EGVAR(fastroping,enabled) = 2;
EGVAR(fastroping,friesType) = "ACE_friesAnchorBar";
EGVAR(fastroping,friesAttachmentPoint)[] = {0, 1.95, -0.26};
EGVAR(fastroping,onCut) = QFUNC(onCut);
EGVAR(fastroping,onPrepare) = QFUNC(onPrepare);
EGVAR(fastroping,ropeOrigins)[] = {"ropeOriginLeft", "ropeOriginRight"};
};
class rhs_uh1h_hidf: rhs_uh1h_base {
EQUIP_FRIES_ATTRIBUTE;
};
class rhs_uh1h_hidf_unarmed: rhs_uh1h_hidf {
EGVAR(fastroping,friesAttachmentPoint)[] = {0, 1.8, -0.27};
class UserActions {
class Open_Side_Doors;
class Close_Side_Doors: Open_Side_Doors {
condition = QUOTE([ARR_2(this,'close_cargo_doors')] call FUNC(canCloseDoor));
};
};
EQUIP_FRIES_ATTRIBUTE;
};
class rhs_uh1h_idap: rhs_uh1h_base {
EGVAR(fastroping,friesAttachmentPoint)[] = {0, 1.8, -0.27};
class UserActions {
class Open_Side_Doors;
class Close_Side_Doors: Open_Side_Doors {
condition = QUOTE([ARR_2(this,'close_cargo_doors')] call FUNC(canCloseDoor));
};
};
EQUIP_FRIES_ATTRIBUTE;
};
class rhs_uh1h_un: rhs_uh1h_base {
EGVAR(fastroping,friesAttachmentPoint)[] = {0, 1.8, -0.27};
class UserActions {
class Open_Side_Doors;
class Close_Side_Doors: Open_Side_Doors {
condition = QUOTE([ARR_2(this,'close_cargo_doors')] call FUNC(canCloseDoor));
};
};
EQUIP_FRIES_ATTRIBUTE;
};
// ACE Explosives
class Items_base_F;
class ACE_Explosives_Place: Items_base_F {

View File

@ -0,0 +1,3 @@
PREP(canCloseDoor);
PREP(onCut);
PREP(onPrepare);

View File

@ -0,0 +1,9 @@
#include "script_component.hpp"
ADDON = false;
PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
ADDON = true;

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
#include "XEH_PREP.hpp"

View File

@ -7,7 +7,7 @@ class CfgPatches {
units[] = {};
weapons[] = {QGVAR(dshkm_carry)};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_explosives", "ace_csw", "rhsgref_main_loadorder"};
requiredAddons[] = {"ace_fastroping", "ace_explosives", "ace_csw", "rhsgref_main_loadorder"};
author = ECSTRING(common,ACETeam);
authors[] = {"PabstMirror", "Ruthberg", "Anton"};
url = ECSTRING(main,URL);
@ -16,6 +16,7 @@ class CfgPatches {
};
#include "CfgAmmo.hpp"
#include "CfgEventHandlers.hpp"
#include "CfgMagazines.hpp"
#include "CfgWeapons.hpp"
#include "CfgVehicles.hpp"

View File

@ -0,0 +1,34 @@
#include "script_component.hpp"
/*
* Author: BaerMitUmlaut
* Checks if the door can be closed.
*
* Arguments:
* 0: Helicopter <OBJECT>
* 1: Door <STRING>
*
* Return Value:
* Door can be closed <BOOL>
*
* Example:
* [_vehicle, "DoorLB"] call ace_compat_rhs_gref3_fnc_canCloseDoor
*
* Public: No
*/
params ["_vehicle", "_door"];
(alive _vehicle) &&
{!(_vehicle getVariable [QEGVAR(fastroping,doorsLocked),false])} &&
{
switch (true) do {
case (_vehicle isKindOf "rhs_uh1h_base"): {
((_vehicle doorPhase _door) == 0) &&
{ACE_player in _vehicle}
};
default {
((_vehicle doorPhase _door) > 0) &&
{ACE_player in _vehicle}
};
}
}

View File

@ -0,0 +1,41 @@
#include "script_component.hpp"
/*
* Author: BaerMitUmlaut
* Function for closing doors and retracting the hooks for RHS USF helos.
*
* Arguments:
* 0: Helicopter <OBJECT>
*
* Return Value:
* Amount of time to wait before cutting ropes <NUMBER>
*
* Example:
* [_vehicle] call ace_compat_rhs_gref3_fnc_onCut
*
* Public: No
*/
params ["_vehicle"];
_vehicle setVariable [QEGVAR(fastroping,doorsLocked), false, true];
private _fries = _vehicle getVariable [QEGVAR(fastroping,FRIES), objNull];
if !(isNull _fries) then {
_fries animate ["extendHookRight", 0];
_fries animate ["extendHookLeft", 0];
[{
_this animateDoor ["doorRB", 0];
_this animateDoor ["doorLB", 0];
_this animate ["doorHandler_R",0];
_this animate ["doorHandler_L",0];
_this animateDoor ["close_cargo_doors", 1];
}, _vehicle, 2] call CBA_fnc_waitAndExecute;
4
} else {
_vehicle animateDoor ["ramp_anim", 0];
_vehicle animate ["ramp_bottom",0];
_vehicle animate ["ramp_top",0];
2
};

View File

@ -0,0 +1,41 @@
#include "script_component.hpp"
/*
* Author: BaerMitUmlaut
* Function for opening doors and extending the hook for most vanilla helos.
*
* Arguments:
* 0: Helicopter <OBJECT>
*
* Return Value:
* Amount of time to wait before deploying ropes <NUMBER>
*
* Example:
* [_vehicle] call ace_compat_rhs_gref3_fnc_onPrepare
*
* Public: No
*/
params ["_vehicle"];
_vehicle setVariable [QEGVAR(fastroping,doorsLocked), true, true];
private _waitTime = 2;
_vehicle animateDoor ["doorRB", 1];
_vehicle animateDoor ["doorLB", 1];
_vehicle animate ["doorHandler_R",1];
_vehicle animate ["doorHandler_L",1];
_vehicle animateDoor ["ramp_anim", 1];
_vehicle animate ["ramp_bottom",0.56];
_vehicle animate ["ramp_top",1];
_vehicle animateDoor ["close_cargo_doors", 0];
private _fries = _vehicle getVariable [QEGVAR(fastroping,FRIES), objNull];
if !(isNull _fries) then {
[{
_this animate ["extendHookRight", 1];
_this animate ["extendHookLeft", 1];
}, _fries, 2] call CBA_fnc_waitAndExecute;
_waitTime = 4;
};
_waitTime

View File

@ -0,0 +1 @@
#include "\z\ace\addons\compat_rhs_gref3\script_component.hpp"