diff --git a/addons/fastroping/CfgVehicles.hpp b/addons/fastroping/CfgVehicles.hpp index efd32d1ac6..6dfd06ff72 100644 --- a/addons/fastroping/CfgVehicles.hpp +++ b/addons/fastroping/CfgVehicles.hpp @@ -40,33 +40,48 @@ class CfgVehicles { class ACE_SelfActions { class ACE_prepareFRIES { displayName = CSTRING(Interaction_prepareFRIES); - condition = QUOTE([vehicle _player] call FUNC(canPrepareFRIES)); - statement = QUOTE([vehicle _player] call FUNC(prepareFRIES)); - showDisabled = 0; + condition = QUOTE([_target] call FUNC(canPrepareFRIES)); + statement = QUOTE([_target] call FUNC(prepareFRIES)); }; class ACE_stowFRIES { displayName = CSTRING(Interaction_stowFRIES); - condition = QUOTE([vehicle _player] call FUNC(canStowFRIES)); - statement = QUOTE([vehicle _player] call FUNC(stowFRIES)); - showDisabled = 0; + condition = QUOTE([_target] call FUNC(canStowFRIES)); + statement = QUOTE([_target] call FUNC(stowFRIES)); }; - class ACE_deployRopes { - displayName = CSTRING(Interaction_deployRopes); - condition = QUOTE([ARR_2(_player, vehicle _player)] call FUNC(canDeployRopes)); - statement = QUOTE([ARR_2(QUOTE(QGVAR(deployRopes)), [vehicle _player])] call CBA_fnc_serverEvent); - showDisabled = 0; + class ACE_deployRopes12 { + displayName = CSTRING(Interaction_deployRopes12); + condition = QUOTE([ARR_3(_target, _player, 'ACE_rope12')] call FUNC(canDeployRopes)); + statement = QUOTE([ARR_2(QUOTE(QGVAR(deployRopes)), [ARR_3(_target, _player, 'ACE_rope12'))]] call CBA_fnc_serverEvent); + }; + class ACE_deployRopes15 { + displayName = CSTRING(Interaction_deployRopes15); + condition = QUOTE([ARR_3(_target, _player, 'ACE_rope15')] call FUNC(canDeployRopes)); + statement = QUOTE([ARR_2(QUOTE(QGVAR(deployRopes)), [ARR_3(_target, _player, 'ACE_rope15'))]] call CBA_fnc_serverEvent); + }; + class ACE_deployRopes18 { + displayName = CSTRING(Interaction_deployRopes18); + condition = QUOTE([ARR_3(_target, _player, 'ACE_rope18')] call FUNC(canDeployRopes)); + statement = QUOTE([ARR_2(QUOTE(QGVAR(deployRopes)), [ARR_3(_target, _player, 'ACE_rope18'))]] call CBA_fnc_serverEvent); + }; + class ACE_deployRopes27 { + displayName = CSTRING(Interaction_deployRopes27); + condition = QUOTE([ARR_3(_target, _player, 'ACE_rope27')] call FUNC(canDeployRopes)); + statement = QUOTE([ARR_2(QUOTE(QGVAR(deployRopes)), [ARR_3(_target, _player, 'ACE_rope27'))]] call CBA_fnc_serverEvent); + }; + class ACE_deployRopes36 { + displayName = CSTRING(Interaction_deployRopes36); + condition = QUOTE([ARR_4(_target, _player, 'ACE_rope36', true)] call FUNC(canDeployRopes)); + statement = QUOTE([ARR_2(QUOTE(QGVAR(deployRopes)), [ARR_3(_target, _player, 'ACE_rope36'))]] call CBA_fnc_serverEvent); }; class ACE_cutRopes { displayName = CSTRING(Interaction_cutRopes); - condition = [vehicle _player] call FUNC(canCutRopes); - statement = [vehicle _player] call FUNC(cutRopes); - showDisabled = 0; + condition = [_target] call FUNC(canCutRopes); + statement = [_target] call FUNC(cutRopes); }; class ACE_fastRope { displayName = CSTRING(Interaction_fastRope); - condition = [_player, vehicle _player] call FUNC(canFastRope); - statement = [_player, vehicle _player] call FUNC(fastRope); - showDisabled = 0; + condition = [_player, _target] call FUNC(canFastRope); + statement = [_player, _target] call FUNC(fastRope); }; }; }; @@ -252,4 +267,20 @@ class CfgVehicles { }; }; }; + class NATO_Box_Base; + class ACE_fastropingSupplyCrate: NATO_Box_Base { + scope = 2; + scopeCurator = 2; + accuracy = 1000; + displayName = CSTRING(Ropesupply); + model = "\A3\Weapons_F\AmmoBoxes\Box_NATO_AmmoVeh_F.p3d"; + author = "Pokertour"; + class TransportItems { + MACRO_ADDITEM(ACE_rope12,15); + MACRO_ADDITEM(ACE_rope15,15); + MACRO_ADDITEM(ACE_rope18,15); + MACRO_ADDITEM(ACE_rope27,15); + MACRO_ADDITEM(ACE_rope36,15); + }; + }; }; diff --git a/addons/fastroping/CfgWeapons.hpp b/addons/fastroping/CfgWeapons.hpp new file mode 100644 index 0000000000..116497c6fa --- /dev/null +++ b/addons/fastroping/CfgWeapons.hpp @@ -0,0 +1,60 @@ +class CfgWeapons { + class ACE_ItemCore; + class CBA_MiscItem_ItemInfo; + + class ACE_rope12: ACE_ItemCore { + scope = 2; + GVAR(ropeLength) = 12.2; + picture = QPATHTOF(data\m_rope_ca); + model = "\A3\Structures_F_Heli\Items\Tools\Rope_01_F.p3d"; + displayName = CSTRING(Rope_12_Display); + descriptionShort = CSTRING(descriptionShort); + class ItemInfo: CBA_MiscItem_ItemInfo { + mass = 36; + }; + }; + class ACE_rope15: ACE_ItemCore { + scope = 2; + GVAR(ropeLength) = 15.2; + picture = QPATHTOF(data\m_rope_ca); + model = "\A3\Structures_F_Heli\Items\Tools\Rope_01_F.p3d"; + displayName = CSTRING(Rope_15_Display); + descriptionShort = CSTRING(descriptionShort); + class ItemInfo: CBA_MiscItem_ItemInfo { + mass = 45; + }; + }; + class ACE_rope18: ACE_ItemCore { + scope = 2; + GVAR(ropeLength) = 18.3; + picture = QPATHTOF(data\m_rope_ca); + model = "\A3\Structures_F_Heli\Items\Tools\Rope_01_F.p3d"; + displayName = CSTRING(Rope_18_Display); + descriptionShort = CSTRING(descriptionShort); + class ItemInfo: CBA_MiscItem_ItemInfo { + mass = 54; + }; + }; + class ACE_rope27: ACE_ItemCore { + scope = 2; + GVAR(ropeLength) = 27.4; + picture = QPATHTOF(data\m_rope_ca); + model = "\A3\Structures_F_Heli\Items\Tools\Rope_01_F.p3d"; + displayName = CSTRING(Rope_27_Display); + descriptionShort = CSTRING(descriptionShort); + class ItemInfo: CBA_MiscItem_ItemInfo { + mass = 81; + }; + }; + class ACE_rope36: ACE_ItemCore { + scope = 2; + GVAR(ropeLength) = 36.6; + picture = QPATHTOF(data\m_rope_ca); + model = "\A3\Structures_F_Heli\Items\Tools\Rope_01_F.p3d"; + displayName = CSTRING(Rope_36_Display); + descriptionShort = CSTRING(descriptionShort); + class ItemInfo: CBA_MiscItem_ItemInfo { + mass = 108; + }; + }; +}; diff --git a/addons/fastroping/XEH_preInit.sqf b/addons/fastroping/XEH_preInit.sqf index b47cf6628d..9361d05015 100644 --- a/addons/fastroping/XEH_preInit.sqf +++ b/addons/fastroping/XEH_preInit.sqf @@ -6,4 +6,6 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +#include "initSettings.sqf" + ADDON = true; diff --git a/addons/fastroping/config.cpp b/addons/fastroping/config.cpp index f2bf1d4a5e..98dfd26742 100644 --- a/addons/fastroping/config.cpp +++ b/addons/fastroping/config.cpp @@ -8,7 +8,7 @@ class CfgPatches { requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; author = ECSTRING(common,ACETeam); - authors[] = {"KoffeinFlummi", "BaerMitUmlaut"}; + authors[] = {"KoffeinFlummi", "BaerMitUmlaut", "Pokertour"}; url = ECSTRING(main,URL); VERSION_CONFIG; }; @@ -19,3 +19,4 @@ class CfgPatches { #include "CfgSounds.hpp" #include "CfgVehicles.hpp" #include "CfgWaypoints.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/fastroping/data/m_rope_ca.paa b/addons/fastroping/data/m_rope_ca.paa new file mode 100644 index 0000000000..b6744b8a77 Binary files /dev/null and b/addons/fastroping/data/m_rope_ca.paa differ diff --git a/addons/fastroping/functions/fnc_canDeployRopes.sqf b/addons/fastroping/functions/fnc_canDeployRopes.sqf index 5bc770c01d..26b514368b 100644 --- a/addons/fastroping/functions/fnc_canDeployRopes.sqf +++ b/addons/fastroping/functions/fnc_canDeployRopes.sqf @@ -4,27 +4,30 @@ * Checks if the unit can deploy ropes from the helicopter. * * Arguments: - * 0: Unit occupying the helicopter - * 1: The helicopter itself + * 0: The helicopter itself + * 1: Unit occupying the helicopter + * 2: Rope classname + * 3: Default (show when setting disabled) (default: false) * * Return Value: * Able to deploy ropes * * Example: - * [_player, _vehicle] call ace_fastroping_fnc_canDeployRopes + * [vehicle player, player, "ACE_rope36"] call ace_fastroping_fnc_canDeployRopes * * Public: No */ -params ["_unit", "_vehicle"]; +params ["_vehicle", "_player", "_ropeClass", ["_defaultOption", false]]; private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; -private _enabled = getNumber (_config >> QGVAR(enabled)); -private _deploymentStage = _vehicle getVariable [QGVAR(deploymentStage), 0]; -(driver _vehicle != _unit) && -{getPos _vehicle select 2 > 2} && -{_enabled == 1 || {_enabled == 2 && {!(isNull (_vehicle getVariable [QGVAR(FRIES), objNull]))}}} && -{ - (_deploymentStage == 0 && {getText (_config >> QGVAR(onPrepare)) == ""}) || - {_deploymentStage == 2 && {getText (_config >> QGVAR(onPrepare)) != ""}} +(driver _vehicle != _player) && +{getPos _vehicle select 2 > 2} && { + private _enabled = getNumber (_config >> QGVAR(enabled)); + _enabled == 1 || {_enabled == 2 && {!(isNull (_vehicle getVariable [QGVAR(FRIES), objNull]))}} +} && { + private _deploymentStage = _vehicle getVariable [QGVAR(deploymentStage), 0]; + if (getText (_config >> QGVAR(onPrepare)) == "") then { _deploymentStage == 0 } else { _deploymentStage == 2 }; +} && { + (_defaultOption && {!GVAR(requireRopeItems)}) || {(_ropeClass in (_player call EFUNC(common,uniqueItems))) || {_ropeClass in (itemCargo _vehicle)}} } diff --git a/addons/fastroping/functions/fnc_deployRopes.sqf b/addons/fastroping/functions/fnc_deployRopes.sqf index bd286fb08d..2873e5bee1 100644 --- a/addons/fastroping/functions/fnc_deployRopes.sqf +++ b/addons/fastroping/functions/fnc_deployRopes.sqf @@ -5,22 +5,36 @@ * * Arguments: * 0: The helicopter itself + * 1: The unit that called the action (may be remote) + * 2: Rope classname * * Return Value: * None * * Example: - * [_vehicle] call ace_fastroping_fnc_deployRopes + * [vehicle player, player, "ACE_rope36"] call ace_fastroping_fnc_deployRopes * * Public: No */ -params ["_vehicle"]; +params ["_vehicle", "_player", "_ropeClass"]; +TRACE_3("deployRopes",_vehicle,_player,_ropeClass); private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; private _ropeOrigins = getArray (_config >> QGVAR(ropeOrigins)); private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; private _hookAttachment = _vehicle getVariable [QGVAR(FRIES), _vehicle]; + +private _ropeLength = getNumber (configfile >> "CfgWeapons" >> _ropeClass >> QGVAR(ropeLength)); +TRACE_3("",_ropeClass,_ropeLength,GVAR(requireRopeItems)); +if (GVAR(requireRopeItems)) then { + if (_ropeClass in (items _player)) then { + _player removeItem _ropeClass; + } else { + _vehicle removeItem _ropeClass; + }; +}; + { private _ropeOrigin = _x; private _hook = QGVAR(helper) createVehicle [0, 0, 0]; @@ -39,7 +53,7 @@ private _hookAttachment = _vehicle getVariable [QGVAR(FRIES), _vehicle]; private _ropeTop = ropeCreate [_dummy, [0, 0, 0], _hook, [0, 0, 0], 0.5]; private _ropeBottom = ropeCreate [_dummy, [0, 0, 0], 1]; - ropeUnwind [_ropeBottom, 30, 34.5, false]; + ropeUnwind [_ropeBottom, 30, _ropelength, false]; _ropeTop addEventHandler ["RopeBreak", {[_this, "top"] call FUNC(onRopeBreak)}]; _ropeBottom addEventHandler ["RopeBreak", {[_this, "bottom"] call FUNC(onRopeBreak)}]; @@ -52,3 +66,4 @@ private _hookAttachment = _vehicle getVariable [QGVAR(FRIES), _vehicle]; _vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true]; _vehicle setVariable [QGVAR(deploymentStage), 3, true]; +_vehicle setVariable [QGVAR(ropeLength), _ropeLength, true]; diff --git a/addons/fastroping/functions/fnc_fastRope.sqf b/addons/fastroping/functions/fnc_fastRope.sqf index 9deb95b1a6..39f7cc38c9 100644 --- a/addons/fastroping/functions/fnc_fastRope.sqf +++ b/addons/fastroping/functions/fnc_fastRope.sqf @@ -16,6 +16,7 @@ * Public: No */ params ["_unit", "_vehicle"]; +TRACE_2("fastRope",_unit,_vehicle); //Select unoccupied rope private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; diff --git a/addons/fastroping/functions/fnc_fastRopeServerPFH.sqf b/addons/fastroping/functions/fnc_fastRopeServerPFH.sqf index ed9cad2255..16df3f3e95 100644 --- a/addons/fastroping/functions/fnc_fastRopeServerPFH.sqf +++ b/addons/fastroping/functions/fnc_fastRopeServerPFH.sqf @@ -28,8 +28,11 @@ if (isNull _hook) exitWith { [_pfhHandle] call CBA_fnc_removePerFrameHandler; }; +private _ropeLength = _vehicle getVariable [QGVAR(ropeLength), 34.5]; + //Start fast roping if (getMass _dummy != 80) exitWith { + TRACE_1("unwinding ropes",_ropeLength); //Fix for twitchyness _dummy setMass 80; _dummy setCenterOfMass [0, 0, -2]; @@ -37,7 +40,7 @@ if (getMass _dummy != 80) exitWith { _dummy setPosASL (_origin vectorAdd [0, 0, -2]); _dummy setVectorUp [0, 0, 1]; - ropeUnwind [_ropeTop, 6, 34.5]; + ropeUnwind [_ropeTop, 6, _ropeLength]; ropeUnwind [_ropeBottom, 6, 0.5]; }; @@ -59,7 +62,7 @@ _dummy setVelocity [0,0,-6]; //Check if fast rope is finished if ( ((getPos _unit select 2) < 0.2) - || {ropeLength _ropeTop == 34.5} + || {ropeLength _ropeTop == _ropeLength} || {vectorMagnitude (velocity _vehicle) > 5} || {!([_unit] call EFUNC(common,isAwake))} ) exitWith { @@ -77,7 +80,7 @@ if ( _dummy setCenterOfMass [0.000143227,0.00105986,-0.246147]; _ropeTop = ropeCreate [_dummy, [0, 0, 0], _hook, [0, 0, 0], 0.5]; - _ropeBottom = ropeCreate [_dummy, [0, 0, 0], 34.5]; + _ropeBottom = ropeCreate [_dummy, [0, 0, 0], _ropeLength]; _ropeTop addEventHandler ["RopeBreak", {[_this, "top"] call FUNC(onRopeBreak)}]; _ropeBottom addEventHandler ["RopeBreak", {[_this, "bottom"] call FUNC(onRopeBreak)}]; diff --git a/addons/fastroping/initSettings.sqf b/addons/fastroping/initSettings.sqf new file mode 100644 index 0000000000..d88a6982d0 --- /dev/null +++ b/addons/fastroping/initSettings.sqf @@ -0,0 +1,11 @@ +// CBA Settings [ADDON: ace_fastroping]: + +[ + QGVAR(requireRopeItems), "CHECKBOX", + [LSTRING(setting_requireRopeItems_displayName)], + ["ACE Uncategorized", QUOTE(COMPONENT_BEAUTIFIED)], + false, // default value + true, // isGlobal + {[QGVAR(requireRopeItems), _this] call EFUNC(common,cbaSettings_settingChanged)}, + false // needRestart +] call CBA_settings_fnc_init; diff --git a/addons/fastroping/stringtable.xml b/addons/fastroping/stringtable.xml index 5b5400cdb2..109ae2b856 100644 --- a/addons/fastroping/stringtable.xml +++ b/addons/fastroping/stringtable.xml @@ -144,5 +144,57 @@ 讓單位快速繩降 패스트 로프를 놓음 + + Deploy 12m ropes + Déployer les cordes 12m + + + Deploy 15m ropes + Déployer les cordes 15m + + + Deploy 18m ropes + Déployer les cordes 18m + + + Deploy 27m ropes + Déployer les cordes 27m + + + Deploy 36m ropes + Déployer les cordes 36m + + + [ACE] Ropes Supply crate + [ACE] Caisse de Cordes + + + Used to do deploy ropes from a compatibile helicopter + Utilisé pour déployer des cordes depuis un hélicoptère compatible + + + Rope 12.2 meters + Corde 12.2 mètres + + + Rope 15.2 meters + Corde 15.2 mètres + + + Rope 18.3 meters + Corde 18.3 mètres + + + Rope 27.4 meters + Corde 27.4 mètres + + + Rope 36.6 meters + Corde 36.6 mètres + + + Require rope item to deploy + Exiger une corde pour déployer +