From 4a5b5113cd7c739ff85b6621c4a40d671ce39688 Mon Sep 17 00:00:00 2001 From: pokertour Date: Sat, 12 Jan 2019 04:05:25 +0100 Subject: [PATCH] FastRoping - Add rope items which deploy at lengths (#6498) * Update stringtable.xml * Update config.cpp * New CFGWeapon * Update CfgVehicles.hpp * Update fnc_deployRopes.sqf * Update CfgVehicles.hpp * Update CfgWeapons.hpp * Update CfgVehicles.hpp cheapest check before others * Update fnc_deployRopes.sqf Corrected the double remove. * Cleanup PR Add setting, move rope len to config, simplify strings, add rope image, fix rope unwind length * Add setting name to stringtable * Update stringtable.xml French translation for settings --- addons/fastroping/CfgVehicles.hpp | 65 +++++++++++++----- addons/fastroping/CfgWeapons.hpp | 60 ++++++++++++++++ addons/fastroping/XEH_preInit.sqf | 2 + addons/fastroping/config.cpp | 3 +- addons/fastroping/data/m_rope_ca.paa | Bin 0 -> 22016 bytes .../functions/fnc_canDeployRopes.sqf | 27 ++++---- .../fastroping/functions/fnc_deployRopes.sqf | 21 +++++- addons/fastroping/functions/fnc_fastRope.sqf | 1 + .../functions/fnc_fastRopeServerPFH.sqf | 9 ++- addons/fastroping/initSettings.sqf | 11 +++ addons/fastroping/stringtable.xml | 52 ++++++++++++++ 11 files changed, 215 insertions(+), 36 deletions(-) create mode 100644 addons/fastroping/CfgWeapons.hpp create mode 100644 addons/fastroping/data/m_rope_ca.paa create mode 100644 addons/fastroping/initSettings.sqf 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 0000000000000000000000000000000000000000..b6744b8a77bd102d8b3847978494a94574c13e21 GIT binary patch literal 22016 zcmeHO4P2AgxjzJ`0m@e=mY>@CRzw081$Rq}-AbY@HLi7n1dxh`*jgGZxUg0mwFH76 zgHG(C!}%E~Xb3@Q4Us7bVpFXe#m*p;8WBP88>+~Mg!euta1Pd=+ugmtZFl!B?@vtr zdCuqab)Iw1^E$I{zA1>A^=7QV2_dvRV~5Cw;{|VH%)*25n}W9@F?N7IjORy2{*n*h z74WwKzHFL@(AF4)c8UBu@a_F&*UL>MhN;?L={MY;_a{Q%Xd6VID z_7dJri;A?9Zv&1TWSeYQ+s`85?^=Om!`u5Gt{*h~_IqqB>64qoEej5!}zkT6P79Q_~tQxY4(R<93r3Y0Yb<9I5;{wK8kJfkGK8OI>shn zA7?ayzX{9hfEl56Xk@&4(+4?myE7DIyk>K|yhw}U2=2bb2}M&oDE2lU=O+@y zx}p+QSt4Gz{a5bdw4O2I>#=7S^sf4xASSVZSvrgxSEF$-M@J`0ugt1g{D9!j zDqfCqDY`i>PFmUNylg)3K=TO63uPbM;E$)MjNP z!JG9H!(UN*UL^Q#RR%9U)Aa_y<@%$%ip>2~-=d8iLHnj4I^MJTq6J8yq4M#n=7e`# zj&LLORi-7v3e+-#;4q6s$ZCt}_|BVzIfpzHR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b514368b 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 +