From eb028c0d1b537d206e35b4dd83e5c9b400cbd42a Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Wed, 16 Sep 2015 23:01:01 +0200 Subject: [PATCH] Initial commit fastroping --- addons/fastroping/$PBOPREFIX$ | 1 + addons/fastroping/CfgEventHandlers.hpp | 5 ++ addons/fastroping/CfgMoves.hpp | 19 ++++++ addons/fastroping/CfgVehicles.hpp | 42 +++++++++++++ addons/fastroping/XEH_preInit.sqf | 13 ++++ addons/fastroping/anim/fastroping.rtm | Bin 0 -> 12708 bytes addons/fastroping/config.cpp | 17 +++++ addons/fastroping/data/helper.p3d | Bin 0 -> 3966 bytes .../fastroping/functions/fnc_canCutRopes.sqf | 26 ++++++++ .../functions/fnc_canDeployRopes.sqf | 26 ++++++++ .../fastroping/functions/fnc_canFastRope.sqf | 26 ++++++++ addons/fastroping/functions/fnc_cutRopes.sqf | 29 +++++++++ .../fastroping/functions/fnc_deployRopes.sqf | 43 +++++++++++++ addons/fastroping/functions/fnc_fastRope.sqf | 38 +++++++++++ .../fastroping/functions/fnc_fastRopePFH.sqf | 59 ++++++++++++++++++ .../fastroping/functions/script_component.hpp | 1 + addons/fastroping/script_component.hpp | 12 ++++ 17 files changed, 357 insertions(+) create mode 100644 addons/fastroping/$PBOPREFIX$ create mode 100644 addons/fastroping/CfgEventHandlers.hpp create mode 100644 addons/fastroping/CfgMoves.hpp create mode 100644 addons/fastroping/CfgVehicles.hpp create mode 100644 addons/fastroping/XEH_preInit.sqf create mode 100644 addons/fastroping/anim/fastroping.rtm create mode 100644 addons/fastroping/config.cpp create mode 100644 addons/fastroping/data/helper.p3d create mode 100644 addons/fastroping/functions/fnc_canCutRopes.sqf create mode 100644 addons/fastroping/functions/fnc_canDeployRopes.sqf create mode 100644 addons/fastroping/functions/fnc_canFastRope.sqf create mode 100644 addons/fastroping/functions/fnc_cutRopes.sqf create mode 100644 addons/fastroping/functions/fnc_deployRopes.sqf create mode 100644 addons/fastroping/functions/fnc_fastRope.sqf create mode 100644 addons/fastroping/functions/fnc_fastRopePFH.sqf create mode 100644 addons/fastroping/functions/script_component.hpp create mode 100644 addons/fastroping/script_component.hpp diff --git a/addons/fastroping/$PBOPREFIX$ b/addons/fastroping/$PBOPREFIX$ new file mode 100644 index 0000000000..352dc2c83a --- /dev/null +++ b/addons/fastroping/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\fastroping diff --git a/addons/fastroping/CfgEventHandlers.hpp b/addons/fastroping/CfgEventHandlers.hpp new file mode 100644 index 0000000000..b928bc2de6 --- /dev/null +++ b/addons/fastroping/CfgEventHandlers.hpp @@ -0,0 +1,5 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; diff --git a/addons/fastroping/CfgMoves.hpp b/addons/fastroping/CfgMoves.hpp new file mode 100644 index 0000000000..63e18f2c2b --- /dev/null +++ b/addons/fastroping/CfgMoves.hpp @@ -0,0 +1,19 @@ +class CfgMovesBasic { + class DefaultDie; + class ManActions { + ACE_FastRoping = "ACE_FastRoping"; + }; +}; + +class CfgMovesMaleSdr: CfgMovesBasic { + class States { + class Crew; + class ACE_FastRoping: Crew { + file = PATHTOF(anim\fastroping.rtm); + interpolateTo[] = {"Unconscious",1}; + disableWeapons = 1; + disableWeaponsLong = 1; + canReload = 0; + }; + }; +}; diff --git a/addons/fastroping/CfgVehicles.hpp b/addons/fastroping/CfgVehicles.hpp new file mode 100644 index 0000000000..04f771d8b3 --- /dev/null +++ b/addons/fastroping/CfgVehicles.hpp @@ -0,0 +1,42 @@ +class CfgVehicles { + class UAV_01_base_F; + class GVAR(helper): UAV_01_base_F { + author = "KoffeinFlummi"; + scope = 1; + model = PATHTOF(data\helper.p3d); + isUAV = 0; + }; + + class Air; + class Helicopter: Air { + class ACE_SelfActions { + class ACE_deployRopes { + displayName = "Deploy ropes"; + condition = [_player, vehicle _player] call FUNC(canDeployRopes); + statement = [_player, vehicle _player] call FUNC(deployRopes); + showDisabled = 0; + priority = 1; + }; + class ACE_cutRopes { + displayName = "Cut ropes"; + condition = [_player, vehicle _player] call FUNC(canCutRopes); + statement = [vehicle _player] call FUNC(cutRopes); + showDisabled = 0; + priority = 1; + }; + class ACE_fastRope { + displayName = "Fast rope"; + condition = [_player, vehicle _player] call FUNC(canFastRope); + statement = [_player, vehicle _player] call FUNC(fastRope); + showDisabled = 0; + priority = 1; + }; + }; + }; + + class Helicopter_Base_H; + class Heli_Transport_01_base_F: Helicopter_Base_H { + GVAR(enabled) = 1; + GVAR(ropeOrigins[]) = {{1.1, 2.5, 0.25}, {-1.1, 2.5, 0.25}}; + }; +}; diff --git a/addons/fastroping/XEH_preInit.sqf b/addons/fastroping/XEH_preInit.sqf new file mode 100644 index 0000000000..c425670c06 --- /dev/null +++ b/addons/fastroping/XEH_preInit.sqf @@ -0,0 +1,13 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(canCutRopes); +PREP(canDeployRopes); +PREP(canFastRope); +PREP(cutRopes); +PREP(deployRopes); +PREP(fastRope); +PREP(fastRopePFH); + +ADDON = true; diff --git a/addons/fastroping/anim/fastroping.rtm b/addons/fastroping/anim/fastroping.rtm new file mode 100644 index 0000000000000000000000000000000000000000..9742732a565365ec3061de847df87732f676ca36 GIT binary patch literal 12708 zcmeI2hgXxy*T*9u*s!691sfn>2NY5A%oQwH=%Tw~K_H<>ld7NuP(&6`aIFZ|6p(@=`==aTjGrG)PBma`|O7_+1 za{DTECHpFMCHsx^8H)l#g*?UdRO=Qz`Sexmmd)r^>UC$KZxF8;olPvY?>|N8Es&(z zx9~LbC(W-J0b$X>0$~LELY4Vv7ZJj1M*kK*)#E3JMF=Gfb^LF-l%XpBr+9}7co88@ z>Qh4n!X@lVs2eZUEt}D;)ay=x0zt6QLM>mWTQ;Lxsny*BL;ZQergaN86V%O5GTyQo z-Kq)QH83P@VlRBvMaJOZLae45}(^(OdIy)j>MJ}A=HN42g6PymxsSeon3x)x_o;! zsk7m4Qg4DU-=6Bm%eQCK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rmY{p6tSGGccps^=+xXt`2qA#w4%kce16&Z19e*LAU;if=PQieeX|259I5w z!*G{&BIvW|74z$irF6`xUE(3f?MUmJ45_jEjD50V!IF$Bo@wR)w(b)ZJb5|9^%v#6 zn6AIbBe~awNNY+giQHy}G!IA7)YS!yRzw^XPP8W%ry7ED+Y8XTX7u+w6+JAAsmDlR zM;%hpIt2b47(#zHL1@Rde4>9{lVsb+(ll%zQ$pR)+|99Tvi#fxeBU+&D1I9 zZJ|-HKXox3xpX@R4A(HInYWD>fJFyGv8DIIla6VlNQfb+|(75S{L$JZ&X6|F9q3+s>7 z^A9Ya3jr5-(C5V(X37m~#wshGc{@IV`s~g{R%ZjCgGRbo9$)$6jq5LYLL%vKO8_Yj zgp_x9hNf6PKs&-Gf`OGMxOg1m_b6>mtBnSrKacyu!yiIWb3Md;PkW)G{XB5&v1L%Y zZ~?g9sY4E@|G~nlC#36XZz$^fg7G<=#oWq>fmSI9Kp~1Zjndf8==e53c_RW|1CYr??2aV=~1@yC|i1z4WFxX z&%l-*WlN8;rAOKDy$SCAXz5Y5^e9_;l!{AwOOLXpN7>S&Z0S)-zGf)vqjGxMEj`MX Z9%W09vf(3JZavx3qipF>{(tUK{vV){j_Uvb literal 0 HcmV?d00001 diff --git a/addons/fastroping/config.cpp b/addons/fastroping/config.cpp new file mode 100644 index 0000000000..a53d75163a --- /dev/null +++ b/addons/fastroping/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"KoffeinFlummi", "BaerMitUmlaut"}; + authorUrl = ""; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgMoves.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/fastroping/data/helper.p3d b/addons/fastroping/data/helper.p3d new file mode 100644 index 0000000000000000000000000000000000000000..e473e619e88b5021d99e2e2b638376ebff733f6f GIT binary patch literal 3966 zcmeHKJ8u&~5Z>bv9tLCc41yxk@dF?e%dM%&$KydYX!TNf3iyZdbNwAm{&N>vJ=fpCqJZb&{I!pT{#UamEUpjXO&rp5tiimEL+iP`jTvAsFYUhE{B6uQ zPd6WTU5UA$9THDm2EGuy-+cySFhv3Qy?&64B{WfR$Y9(vKDj6We~>UgfMJs)M1ls< zENOVLCFP_c$6aIMJPQKj8Ij<5B$gU z*N(rg^@mH3Iy21&;kvKxA&?>L2_#j+dXOPQ%s5@>fH7ld;H7@h!v}Jy1bFDZn`^6` zwRYIO&AArEvr0ub7>qmh)YN96M;Ps4_Ds*6V+l zODtJi;tLi%;^XMjuP4R6ZoKI2Y!~UDqTpx6^Ykxs U?0LE3>II8F+kfRZjh}aa1N8#aqW}N^ literal 0 HcmV?d00001 diff --git a/addons/fastroping/functions/fnc_canCutRopes.sqf b/addons/fastroping/functions/fnc_canCutRopes.sqf new file mode 100644 index 0000000000..2fa33dec93 --- /dev/null +++ b/addons/fastroping/functions/fnc_canCutRopes.sqf @@ -0,0 +1,26 @@ +/* + * Author: BaerMitUmlaut + * Checks if the unit can cut deployed ropes. + * + * Arguments: + * 0: Unit occupying the helicopter + * 1: The helicopter itself + * + * Return Value: + * Able to cut ropes + * + * Example: + * [_player, _vehicle] call ace_fastroping_canCutRopes + * + * Public: No + */ + +#include "script_component.hpp" +params ["_unit", "_vehicle"]; +private ["_deployedRopes"]; + +_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; +if ((driver _vehicle != _unit) && + {!(_deployedRopes isEqualTo [])} && + {{_x select 5} count (_deployedRopes) == 0}) exitWith {true}; +false diff --git a/addons/fastroping/functions/fnc_canDeployRopes.sqf b/addons/fastroping/functions/fnc_canDeployRopes.sqf new file mode 100644 index 0000000000..4db45cff24 --- /dev/null +++ b/addons/fastroping/functions/fnc_canDeployRopes.sqf @@ -0,0 +1,26 @@ +/* + * Author: BaerMitUmlaut + * Checks if the unit can deploy ropes from the helicopter. + * + * Arguments: + * 0: Unit occupying the helicopter + * 1: The helicopter itself + * + * Return Value: + * Able to deploy ropes + * + * Example: + * [_player, _vehicle] call ace_fastroping_canDeployRopes + * + * Public: No + */ + +#include "script_component.hpp" +params ["_unit", "_vehicle"]; +private ["_deployedRopes"]; + +_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; +if (isNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(enabled)) && + {getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(enabled)) == 1} && + {_deployedRopes isEqualTo []}) exitWith {true}; +false diff --git a/addons/fastroping/functions/fnc_canFastRope.sqf b/addons/fastroping/functions/fnc_canFastRope.sqf new file mode 100644 index 0000000000..910d3cccc9 --- /dev/null +++ b/addons/fastroping/functions/fnc_canFastRope.sqf @@ -0,0 +1,26 @@ +/* + * Author: BaerMitUmlaut + * Checks if the unit can fast rope from the helicopter. + * + * Arguments: + * 0: Unit occupying the helicopter + * 1: The helicopter itself + * + * Return Value: + * Able to fast ropes + * + * Example: + * [_player, _vehicle] call ace_fastroping_canDeployRopes + * + * Public: No + */ + +#include "script_component.hpp" +params ["_unit", "_vehicle"]; +private ["_deployedRopes"]; + +_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; +if ((driver _vehicle != _unit) && + {!(_deployedRopes isEqualTo [])} && + {{!(_x select 5)} count (_deployedRopes) > 0}) exitWith {true}; +false diff --git a/addons/fastroping/functions/fnc_cutRopes.sqf b/addons/fastroping/functions/fnc_cutRopes.sqf new file mode 100644 index 0000000000..9ec88da7c0 --- /dev/null +++ b/addons/fastroping/functions/fnc_cutRopes.sqf @@ -0,0 +1,29 @@ +/* + * Author: BaerMitUmlaut + * Cut deployed ropes. + * + * Arguments: + * 0: A helicopter with deployed ropes + * + * Return Value: + * None + * + * Example: + * [_vehicle] call ace_fastroping_cutRopes + * + * Public: No + */ + +#include "script_component.hpp" +params ["_vehicle"]; +private ["_deployedRopes"]; + +_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; +{ + _x params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_anchor", "_occupied"]; + + deleteVehicle _ropeTop; + [{{deleteVehicle _x} count _this}, [_dummy, _anchor, _ropeBottom], 60] call EFUNC(common,waitAndExecute); +} count _deployedRopes; + +_vehicle setVariable [QGVAR(deployedRopes), [], true]; diff --git a/addons/fastroping/functions/fnc_deployRopes.sqf b/addons/fastroping/functions/fnc_deployRopes.sqf new file mode 100644 index 0000000000..6cdf71c868 --- /dev/null +++ b/addons/fastroping/functions/fnc_deployRopes.sqf @@ -0,0 +1,43 @@ +/* + * Author: BaerMitUmlaut + * Deploy ropes from the helicopter. + * + * Arguments: + * 0: Unit occupying the helicopter + * 1: The helicopter itself + * + * Return Value: + * None + * + * Example: + * [_player, _vehicle] call ace_fastroping_deployRopes + * + * Public: No + */ + +#include "script_component.hpp" +params ["_unit", "_vehicle"]; +private ["_ropeOrigins", "_deployedRopes", "_origin", "_dummy", "_anchor", "_ropeTop", "_ropeBottom"]; + +_ropeOrigins = getArray (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(ropeOrigins)); +_deployedRopes = []; +{ + _origin = AGLtoASL (_vehicle modelToWorld _x); + + _dummy = QGVAR(helper) createVehicle [0, 0, 0]; + _dummy allowDamage false; + _dummy setPosASL (_origin vectorAdd [0, 0, -2]); + + _anchor = QGVAR(helper) createVehicle [0, 0, 0]; + _anchor allowDamage false; + _anchor setPosASL (_origin vectorAdd [0, 0, -2.5]); + + _ropeTop = ropeCreate [_vehicle, _x, _dummy, [0, 0, 0], 2]; + _ropeBottom = ropeCreate [_dummy, [0, 0, 0], _anchor, [0, 0, 0], 33]; + + //deployedRopes format: attachment point, top part of the rope, bottom part of the rope, attachTo helper object, anchor helper object, occupied + _deployedRopes pushBack [_x, _ropeTop, _ropeBottom, _dummy, _anchor, false]; + false +} count _ropeOrigins; + +_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true]; diff --git a/addons/fastroping/functions/fnc_fastRope.sqf b/addons/fastroping/functions/fnc_fastRope.sqf new file mode 100644 index 0000000000..69043b3cf8 --- /dev/null +++ b/addons/fastroping/functions/fnc_fastRope.sqf @@ -0,0 +1,38 @@ +/* + * Author: BaerMitUmlaut + * Lets the unit fast rope. + * + * Arguments: + * 0: Unit occupying the helicopter + * 1: The helicopter itself + * + * Return Value: + * None + * + * Example: + * [_player, _vehicle] call ace_fastroping_fastRope + * + * Public: No + */ + +#include "script_component.hpp" +params ["_unit", "_vehicle"]; +private ["_deployedRopes", "_usableRope", "_usableRopeIndex"]; + +//Select unoccupied rope +_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; +_usableRope = _deployedRopes select 0; +_usableRopeIndex = 0; +{ + if !(_x select 5) exitWith { + _usableRope = _x; + _usableRopeIndex = _forEachIndex; + }; +} forEach _deployedRopes; + +_usableRope set [5, true]; +_deployedRopes set [_usableRopeIndex, _usableRope]; +_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true]; + +moveOut _unit; +[FUNC(fastRopePFH), 0, [_unit, _vehicle, _usableRope, _usableRopeIndex]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/fastroping/functions/fnc_fastRopePFH.sqf b/addons/fastroping/functions/fnc_fastRopePFH.sqf new file mode 100644 index 0000000000..9afd7568a0 --- /dev/null +++ b/addons/fastroping/functions/fnc_fastRopePFH.sqf @@ -0,0 +1,59 @@ +/* + * Author: BaerMitUmlaut + * PerFrameHandler during fast roping. + * + * Arguments: + * 0: PFH arguments + * 1: PFH handle + * + * Return Value: + * None + * + * Example: + * [[_unit, _vehicle, _rope, _ropeIndex], 0] call ace_fastroping_fastRopePFH + * + * Public: No + */ + +#include "script_component.hpp" +params ["_arguments", "_pfhHandle"]; +_arguments params ["_unit", "_vehicle", "_rope", "_ropeIndex"]; +_rope params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_anchor", "_occupied"]; +private ["_origin"]; + +//Wait until the unit is actually outside of the helicopter +if (vehicle _unit != _unit) exitWith {}; + +//Start fast roping +if (isNull attachedTo _unit) exitWith { + _dummy setVectorUp [0, 0, 1]; + _unit attachTo [_dummy, [0, 0, -1.2]]; + [_unit, "ACE_FastRoping", 2] call EFUNC(common,doAnimation); + systemChat str _ropeTop; + systemChat str _ropeBottom; + ropeUnwind [_ropeTop, 6, 35]; + ropeUnwind [_ropeBottom, 6, 0]; +}; + +//Check if fast rope is finished +if (((getPos _unit select 2) < 0.5) || {ropeUnwound _ropeTop} || {vectorMagnitude (velocity _vehicle) > 5}) exitWith { + detach _unit; + [_unit, "", 2] call EFUNC(common,doAnimation); + + //Reset rope + deleteVehicle _ropeTop; + deleteVehicle _ropeBottom; + + _origin = AGLtoASL (_vehicle modelToWorld _attachmentPoint); + _dummy setPosASL (_origin vectorAdd [0, 0, -2]); + + _ropeTop = ropeCreate [_vehicle, _attachmentPoint, _dummy, [0, 0, 0], 2]; + _ropeBottom = ropeCreate [_dummy, [0, 0, 0], _anchor, [0, 0, 0], 33]; + + //Update deployedRopes array + _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; + _deployedRopes set [_ropeIndex, [_attachmentPoint, _ropeTop, _ropeBottom, _dummy, _anchor, false]]; + _vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true]; + + [_pfhHandle] call CBA_fnc_removePerFrameHandler; +}; diff --git a/addons/fastroping/functions/script_component.hpp b/addons/fastroping/functions/script_component.hpp new file mode 100644 index 0000000000..00e1b5bb76 --- /dev/null +++ b/addons/fastroping/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\fastroping\script_component.hpp" diff --git a/addons/fastroping/script_component.hpp b/addons/fastroping/script_component.hpp new file mode 100644 index 0000000000..661de4b703 --- /dev/null +++ b/addons/fastroping/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT fastroping +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_BLANK + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_BLANK + #define DEBUG_SETTINGS DEBUG_SETTINGS_BLANK +#endif + +#include "\z\ace\addons\main\script_macros.hpp"