mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Initial commit fastroping
This commit is contained in:
parent
5dcb8707dd
commit
eb028c0d1b
1
addons/fastroping/$PBOPREFIX$
Normal file
1
addons/fastroping/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
|||||||
|
z\ace\addons\fastroping
|
5
addons/fastroping/CfgEventHandlers.hpp
Normal file
5
addons/fastroping/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class Extended_PreInit_EventHandlers {
|
||||||
|
class ADDON {
|
||||||
|
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||||
|
};
|
||||||
|
};
|
19
addons/fastroping/CfgMoves.hpp
Normal file
19
addons/fastroping/CfgMoves.hpp
Normal file
@ -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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
42
addons/fastroping/CfgVehicles.hpp
Normal file
42
addons/fastroping/CfgVehicles.hpp
Normal file
@ -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}};
|
||||||
|
};
|
||||||
|
};
|
13
addons/fastroping/XEH_preInit.sqf
Normal file
13
addons/fastroping/XEH_preInit.sqf
Normal file
@ -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;
|
BIN
addons/fastroping/anim/fastroping.rtm
Normal file
BIN
addons/fastroping/anim/fastroping.rtm
Normal file
Binary file not shown.
17
addons/fastroping/config.cpp
Normal file
17
addons/fastroping/config.cpp
Normal file
@ -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"
|
BIN
addons/fastroping/data/helper.p3d
Normal file
BIN
addons/fastroping/data/helper.p3d
Normal file
Binary file not shown.
26
addons/fastroping/functions/fnc_canCutRopes.sqf
Normal file
26
addons/fastroping/functions/fnc_canCutRopes.sqf
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Author: BaerMitUmlaut
|
||||||
|
* Checks if the unit can cut deployed ropes.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit occupying the helicopter <OBJECT>
|
||||||
|
* 1: The helicopter itself <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Able to cut ropes <BOOL>
|
||||||
|
*
|
||||||
|
* 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
|
26
addons/fastroping/functions/fnc_canDeployRopes.sqf
Normal file
26
addons/fastroping/functions/fnc_canDeployRopes.sqf
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Author: BaerMitUmlaut
|
||||||
|
* Checks if the unit can deploy ropes from the helicopter.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit occupying the helicopter <OBJECT>
|
||||||
|
* 1: The helicopter itself <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Able to deploy ropes <BOOL>
|
||||||
|
*
|
||||||
|
* 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
|
26
addons/fastroping/functions/fnc_canFastRope.sqf
Normal file
26
addons/fastroping/functions/fnc_canFastRope.sqf
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Author: BaerMitUmlaut
|
||||||
|
* Checks if the unit can fast rope from the helicopter.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit occupying the helicopter <OBJECT>
|
||||||
|
* 1: The helicopter itself <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Able to fast ropes <BOOL>
|
||||||
|
*
|
||||||
|
* 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
|
29
addons/fastroping/functions/fnc_cutRopes.sqf
Normal file
29
addons/fastroping/functions/fnc_cutRopes.sqf
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Author: BaerMitUmlaut
|
||||||
|
* Cut deployed ropes.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: A helicopter with deployed ropes <OBJECT>
|
||||||
|
*
|
||||||
|
* 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];
|
43
addons/fastroping/functions/fnc_deployRopes.sqf
Normal file
43
addons/fastroping/functions/fnc_deployRopes.sqf
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Author: BaerMitUmlaut
|
||||||
|
* Deploy ropes from the helicopter.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit occupying the helicopter <OBJECT>
|
||||||
|
* 1: The helicopter itself <OBJECT>
|
||||||
|
*
|
||||||
|
* 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];
|
38
addons/fastroping/functions/fnc_fastRope.sqf
Normal file
38
addons/fastroping/functions/fnc_fastRope.sqf
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Author: BaerMitUmlaut
|
||||||
|
* Lets the unit fast rope.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit occupying the helicopter <OBJECT>
|
||||||
|
* 1: The helicopter itself <OBJECT>
|
||||||
|
*
|
||||||
|
* 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;
|
59
addons/fastroping/functions/fnc_fastRopePFH.sqf
Normal file
59
addons/fastroping/functions/fnc_fastRopePFH.sqf
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Author: BaerMitUmlaut
|
||||||
|
* PerFrameHandler during fast roping.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: PFH arguments <ARRAY>
|
||||||
|
* 1: PFH handle <OBJECT>
|
||||||
|
*
|
||||||
|
* 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;
|
||||||
|
};
|
1
addons/fastroping/functions/script_component.hpp
Normal file
1
addons/fastroping/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "\z\ace\addons\fastroping\script_component.hpp"
|
12
addons/fastroping/script_component.hpp
Normal file
12
addons/fastroping/script_component.hpp
Normal file
@ -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"
|
Loading…
Reference in New Issue
Block a user