mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added FRIES object, FRIES module, debugging code
This commit is contained in:
parent
12779b03bf
commit
3ec9369a9e
@ -8,6 +8,64 @@ class CfgVehicles {
|
||||
displayName = "";
|
||||
};
|
||||
|
||||
class Building;
|
||||
class NonStrategic: Building {
|
||||
class AnimationSources;
|
||||
};
|
||||
class ACE_friesBar: NonStrategic {
|
||||
author = "BaerMitUmlaut";
|
||||
scope = 1;
|
||||
model = PATHTOF(data\friesBar.p3d);
|
||||
destrType = "DestructNo";
|
||||
displayName = "";
|
||||
animated = 1;
|
||||
class AnimationSources: AnimationSources {
|
||||
class extendHookRight {
|
||||
source = "user";
|
||||
initPhase = 0;
|
||||
animPeriod = 1.5;
|
||||
};
|
||||
class extendHookLeft {
|
||||
source = "user";
|
||||
initPhase = 0;
|
||||
animPeriod = 1.5;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Logic;
|
||||
class Module_F: Logic {
|
||||
class ArgumentsBaseUnits {};
|
||||
class ModuleDescription {
|
||||
class AnyVehicle {};
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_Module;
|
||||
class ACE_moduleEquipFRIES: ACE_Module {
|
||||
scope = 2;
|
||||
displayName = CSTRING(Module_FRIES_DisplayName);
|
||||
icon = QUOTE(PATHTOF(UI\Icon_Module_FRIES_ca.paa));
|
||||
category = "ACE";
|
||||
function = QUOTE(FUNC(moduleEquipFRIES));
|
||||
functionPriority = 10;
|
||||
isGlobal = 0;
|
||||
isTriggerActivated = 0;
|
||||
isDisposable = 0;
|
||||
author = "BaerMitUmlaut";
|
||||
|
||||
class ModuleDescription {
|
||||
description = CSTRING(Module_FRIES_Description);
|
||||
sync[] = {"AnyVehicle"};
|
||||
class AnyVehicle {
|
||||
position = 0;
|
||||
direction = 0;
|
||||
optional = 0;
|
||||
duplicate = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Air;
|
||||
class Helicopter: Air {
|
||||
class ACE_SelfActions {
|
||||
@ -45,8 +103,13 @@ class CfgVehicles {
|
||||
GVAR(ropeOrigins[]) = {{1.25, 1.5, -0.6}, {-1.1, 1.5, -0.6}};
|
||||
};
|
||||
class Heli_Transport_01_base_F: Helicopter_Base_H {
|
||||
GVAR(enabled) = 1;
|
||||
GVAR(ropeOrigins[]) = {{1.08, 2.43, 0.2}, {-0.95, 2.43, 0.2}};
|
||||
GVAR(enabled) = 2;
|
||||
GVAR(ropeOrigins[]) = {"hookRight", "hookLeft"};
|
||||
GVAR(friesType) = "ace_friesBar";
|
||||
GVAR(friesAttachmentPoint[]) = {0, 2.2, -0.15};
|
||||
|
||||
GVAR(onDeploy) = QFUNC(onDeployRopesCommon);
|
||||
GVAR(onCut) = QFUNC(onCutRopesCommon);
|
||||
};
|
||||
class Heli_Transport_02_base_F: Helicopter_Base_H {
|
||||
GVAR(enabled) = 1;
|
||||
|
BIN
addons/fastroping/UI/Icon_Module_FRIES_ca.paa
Normal file
BIN
addons/fastroping/UI/Icon_Module_FRIES_ca.paa
Normal file
Binary file not shown.
@ -9,5 +9,8 @@ PREP(cutRopes);
|
||||
PREP(deployRopes);
|
||||
PREP(fastRope);
|
||||
PREP(fastRopePFH);
|
||||
PREP(moduleEquipFRIES);
|
||||
PREP(onCutRopesCommon);
|
||||
PREP(onDeployRopesCommon);
|
||||
|
||||
ADDON = true;
|
||||
|
BIN
addons/fastroping/data/friesBar.p3d
Normal file
BIN
addons/fastroping/data/friesBar.p3d
Normal file
Binary file not shown.
47
addons/fastroping/data/model.cfg
Normal file
47
addons/fastroping/data/model.cfg
Normal file
@ -0,0 +1,47 @@
|
||||
class CfgSkeletons {
|
||||
class Default {
|
||||
isDiscrete = 1;
|
||||
skeletonInherit = "";
|
||||
skeletonBones[] = {};
|
||||
};
|
||||
class ace_friesBar_skeleton: Default {
|
||||
isDiscrete = 1;
|
||||
skeletonInherit = "Default";
|
||||
skeletonBones[] = {
|
||||
"tubeRight", "",
|
||||
"tubeLeft", ""
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class CfgModels {
|
||||
class Default {
|
||||
sectionsInherit = "";
|
||||
sections[] = {""};
|
||||
skeletonName = "";
|
||||
};
|
||||
class friesBar: Default {
|
||||
skeletonName = "ace_friesBar_skeleton";
|
||||
sectionsInherit = "";
|
||||
sections[] = {"hookRight", "hookLeft"};
|
||||
class animations {
|
||||
class extendHookRight {
|
||||
type = "translation";
|
||||
source = "";
|
||||
selection = "tubeRight";
|
||||
axis = "slideAxis";
|
||||
animPeriod = 0;
|
||||
minValue = 0;
|
||||
maxValue = 1;
|
||||
minPhase = 0;
|
||||
maxPhase = 1;
|
||||
offset0 = 0;
|
||||
offset1 = -0.5;
|
||||
};
|
||||
class extendHookLeft: extendHookRight {
|
||||
selection = "tubeLeft";
|
||||
offset1 = 0.5;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -17,11 +17,12 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
params ["_unit", "_vehicle"];
|
||||
private ["_deployedRopes"];
|
||||
private ["_deployedRopes", "_config"];
|
||||
|
||||
_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
|
||||
if (isNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(enabled)) &&
|
||||
{getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(enabled)) == 1} &&
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||
if (isNumber (_config >> QGVAR(enabled)) &&
|
||||
{(getNumber (_config >> QGVAR(enabled)) == 1) || {!(isNull (_vehicle getVariable [QGVAR(FRIES), objNull]))}} &&
|
||||
{_deployedRopes isEqualTo []} &&
|
||||
{getPos _vehicle select 2 > 2}) exitWith {true};
|
||||
false
|
||||
|
@ -17,35 +17,47 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
params ["_unit", "_vehicle"];
|
||||
private ["_ropeOrigins", "_deployedRopes", "_origin", "_dummy", "_anchor", "_hook", "_ropeTop", "_ropeBottom"];
|
||||
private ["_config", "_waitTime"];
|
||||
|
||||
_ropeOrigins = getArray (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(ropeOrigins));
|
||||
_deployedRopes = [];
|
||||
{
|
||||
_origin = AGLtoASL (_vehicle modelToWorld _x);
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||
_waitTime = 0;
|
||||
if (isText (_config >> QGVAR(onDeploy))) then {
|
||||
_waitTime = [_vehicle] call (missionNamespace getVariable (getText (_config >> QGVAR(onDeploy))));
|
||||
};
|
||||
|
||||
_dummy = QGVAR(helper) createVehicle [0, 0, 0];
|
||||
_dummy allowDamage false;
|
||||
_dummy setPosASL (_origin vectorAdd [0, 0, -1]);
|
||||
[{
|
||||
params ["_vehicle", "_config"];
|
||||
private ["_ropeOrigins", "_deployedRopes", "_hookAttachment", "_origin", "_dummy", "_anchor", "_hook", "_ropeTop", "_ropeBottom"];
|
||||
|
||||
_anchor = QGVAR(helper) createVehicle [0, 0, 0];
|
||||
_anchor allowDamage false;
|
||||
_anchor setPosASL (_origin vectorAdd [0, 0, -2.5]);
|
||||
_ropeOrigins = getArray (_config >> QGVAR(ropeOrigins));
|
||||
_deployedRopes = [];
|
||||
_hookAttachment = _vehicle getVariable [QGVAR(FRIES), _vehicle];
|
||||
{
|
||||
_hook = QGVAR(helper) createVehicle [0, 0, 0];
|
||||
_hook allowDamage false;
|
||||
if (typeName _x == "ARRAY") then {
|
||||
_hook attachTo [_hookAttachment, _x];
|
||||
} else {
|
||||
_hook attachTo [_hookAttachment, [0, 0, 0], _x];
|
||||
};
|
||||
|
||||
_hook = QGVAR(helper) createVehicle [0, 0, 0];
|
||||
_hook allowDamage false;
|
||||
if (typeName _x == "ARRAY") then {
|
||||
_hook attachTo [_vehicle, _x];
|
||||
} else {
|
||||
_hook attachTo [_vehicle, [0,0,0], _x];
|
||||
};
|
||||
_origin = getPosASL _hook;
|
||||
|
||||
_ropeTop = ropeCreate [_dummy, [0, 0, 0], _hook, [0, 0, 0], 2];
|
||||
_ropeBottom = ropeCreate [_dummy, [0, 0, 0], _anchor, [0, 0, 0], 33];
|
||||
_dummy = QGVAR(helper) createVehicle [0, 0, 0];
|
||||
_dummy allowDamage false;
|
||||
_dummy setPosASL (_origin vectorAdd [0, 0, -1]);
|
||||
|
||||
//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, _hook, false];
|
||||
true
|
||||
} count _ropeOrigins;
|
||||
_anchor = QGVAR(helper) createVehicle [0, 0, 0];
|
||||
_anchor allowDamage false;
|
||||
_anchor setPosASL (_origin vectorAdd [0, 0, -2.5]);
|
||||
|
||||
_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true];
|
||||
_ropeTop = ropeCreate [_dummy, [0, 0, 0], _hook, [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, _hook, false];
|
||||
true
|
||||
} count _ropeOrigins;
|
||||
|
||||
_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true];
|
||||
}, [_vehicle, _config], _waitTime] call EFUNC(common,waitAndExecute);
|
||||
|
@ -19,31 +19,36 @@
|
||||
params ["_arguments", "_pfhHandle"];
|
||||
_arguments params ["_unit", "_vehicle", "_rope", "_ropeIndex"];
|
||||
_rope params ["_attachmentPoint", "_ropeTop", "_ropeBottom", "_dummy", "_anchor", "_hook", "_occupied"];
|
||||
private ["_origin"];
|
||||
private ["_vectorUp", "_vectorDir", "_origin"];
|
||||
|
||||
//Wait until the unit is actually outside of the helicopter
|
||||
if (vehicle _unit != _unit) exitWith {};
|
||||
|
||||
_unit setVectorUp [0, 0, 1];
|
||||
|
||||
//Start fast roping
|
||||
if (isNull attachedTo _unit) exitWith {
|
||||
if (animationState _unit != "ACE_FastRoping") exitWith {
|
||||
_unit attachTo [_dummy, [0, 0, -1.2]];
|
||||
[_unit, "ACE_FastRoping", 2] call EFUNC(common,doAnimation);
|
||||
ropeUnwind [_ropeTop, 6, 35];
|
||||
ropeUnwind [_ropeBottom, 6, 0];
|
||||
_dummy setMass (_vehicle getVariable ["mass", 50]);
|
||||
_dummy setCenterOfMass (_vehicle getVariable ["cofmass", [0,0,-2]]);
|
||||
};
|
||||
|
||||
drawLine3D [getPos _dummy, (getPos _dummy) vectorAdd (vectorDir _dummy), [0,0,1,1]];
|
||||
drawLine3D [getPos _dummy, (getPos _dummy) vectorAdd (vectorUp _dummy), [1,0,0,1]];
|
||||
drawIcon3D ["", [0,1,0,1], getPos _dummy, 0, 0, 0, (str (getMass _dummy)) + " | " + (str (getCenterOfMass _dummy)), 1, 0.05, "PuristaMedium"];
|
||||
|
||||
//Check if fast rope is finished
|
||||
if (((getPos _unit select 2) < 0.2) || {ropeUnwound _ropeTop} || {vectorMagnitude (velocity _vehicle) > 5}) exitWith {
|
||||
detach _unit;
|
||||
[_unit, "", 2] call EFUNC(common,doAnimation);
|
||||
_unit setVectorUp [0, 0, 1];
|
||||
|
||||
//Reset rope
|
||||
deleteVehicle _ropeTop;
|
||||
deleteVehicle _ropeBottom;
|
||||
|
||||
_origin = AGLtoASL (_vehicle modelToWorld _attachmentPoint);
|
||||
_origin = getPosASL _hook;
|
||||
_dummy setPosASL (_origin vectorAdd [0, 0, -2]);
|
||||
|
||||
_ropeTop = ropeCreate [_dummy, [0, 0, 0], _hook, [0, 0, 0], 2];
|
||||
@ -54,5 +59,7 @@ if (((getPos _unit select 2) < 0.2) || {ropeUnwound _ropeTop} || {vectorMagnitud
|
||||
_deployedRopes set [_ropeIndex, [_attachmentPoint, _ropeTop, _ropeBottom, _dummy, _anchor, _hook, false]];
|
||||
_vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true];
|
||||
|
||||
[FUNC(fastRope), [_unit, _vehicle], 1] call EFUNC(common,waitAndExecute);
|
||||
|
||||
[_pfhHandle] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
39
addons/fastroping/functions/fnc_moduleEquipFRIES.sqf
Normal file
39
addons/fastroping/functions/fnc_moduleEquipFRIES.sqf
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Equips synched helicopters with a FRIES.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Module <LOGIC>
|
||||
* 1: Units <ARRAY>
|
||||
* 2: Activated <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_vehicle] call ace_fastroping_cutRopes
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
params ["_module"];
|
||||
private ["_synchedUnits", "_config", "_fries"];
|
||||
|
||||
_synchedUnits = synchronizedObjects _module;
|
||||
{
|
||||
if (_x isKindOf "CAManBase") then {
|
||||
_x = vehicle _x;
|
||||
};
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _x;
|
||||
if !(isNumber (_config >> QGVAR(enabled))) then {
|
||||
["%1 has not been configured for ACE_Fastroping.", getText (_config >> "DisplayName")] call BIS_fnc_error;
|
||||
} else {
|
||||
if (getNumber (_config >> QGVAR(enabled)) == 2) then {
|
||||
_fries = (getText (_config >> QGVAR(friesType))) createVehicle [0, 0, 0];
|
||||
_fries attachTo [_x, (getArray (_config >> QGVAR(friesAttachmentPoint)))];
|
||||
_x setVariable [QGVAR(FRIES), _fries, true];
|
||||
};
|
||||
};
|
||||
false
|
||||
} count _synchedUnits;
|
30
addons/fastroping/functions/fnc_onCutRopesCommon.sqf
Normal file
30
addons/fastroping/functions/fnc_onCutRopesCommon.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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 cutting ropes.
|
||||
*
|
||||
* Example:
|
||||
* [_vehicle] call ace_fastroping_onCutRopesCommon
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
params ["_vehicle"];
|
||||
private ["_fries"];
|
||||
|
||||
_vehicle animateDoor ["door_R", 0];
|
||||
_vehicle animateDoor ["door_L", 0];
|
||||
|
||||
_fries = _vehicle getVariable [QGVAR(FRIES), objNull];
|
||||
if !(isNull _fries) then {
|
||||
_fries animate ["extendHookRight", 0];
|
||||
_fries animate ["extendHookLeft", 0];
|
||||
};
|
||||
|
||||
0
|
39
addons/fastroping/functions/fnc_onDeployRopesCommon.sqf
Normal file
39
addons/fastroping/functions/fnc_onDeployRopesCommon.sqf
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Function for closing doors and retracting the hook for most vanilla helos.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Helicopter <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Amount of time to wait before deploying ropes.
|
||||
*
|
||||
* Example:
|
||||
* [_vehicle] call ace_fastroping_onDeployRopesCommon
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
params ["_vehicle"];
|
||||
private ["_fries"];
|
||||
|
||||
_vehicle animateDoor ["door_R", 1];
|
||||
_vehicle animateDoor ["door_L", 1];
|
||||
|
||||
/*_fries = _vehicle getVariable [QGVAR(FRIES), objNull];
|
||||
if !(isNull _fries) then {
|
||||
[{
|
||||
_this animate ["extendHookRight", 1];
|
||||
_this animate ["extendHookLeft", 1];
|
||||
}, _fries, 2] call EFUNC(common,waitAndExecute);
|
||||
};*/
|
||||
|
||||
[{
|
||||
private ["_fries"];
|
||||
_fries = _this getVariable [QGVAR(FRIES), objNull];
|
||||
_fries animate ["extendHookRight", 1];
|
||||
_fries animate ["extendHookLeft", 1];
|
||||
}, _vehicle, 2] call EFUNC(common,waitAndExecute);
|
||||
|
||||
4
|
13
addons/fastroping/stringtable.xml
Normal file
13
addons/fastroping/stringtable.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project name="ACE">
|
||||
<Package name="Fastroping">
|
||||
<Key ID="STR_ACE_Fastroping_Module_FRIES_DisplayName">
|
||||
<English>Equip FRIES</English>
|
||||
<German>Rüste FRIES aus</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Fastroping_Module_FRIES_Description">
|
||||
<English>Equips compatible helicopters with a Fast Rope Insertion Extraction System.</English>
|
||||
<German>Rüstet kompatible Helikopter mit einem Fast Rope Insertion Extraction System aus.</German>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user