From c12d85d17c2f58ea55567f851c8ff22d5f125cf4 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sun, 24 Sep 2023 01:03:34 +0200 Subject: [PATCH 01/37] Rope handler --- addons/sys_core/XEH_PREP.hpp | 1 + addons/sys_core/XEH_preInit.sqf | 3 ++ addons/sys_core/fnc_handleConnectorRope.sqf | 39 +++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 addons/sys_core/fnc_handleConnectorRope.sqf diff --git a/addons/sys_core/XEH_PREP.hpp b/addons/sys_core/XEH_PREP.hpp index ad378e033..b2220f32e 100644 --- a/addons/sys_core/XEH_PREP.hpp +++ b/addons/sys_core/XEH_PREP.hpp @@ -18,6 +18,7 @@ PREP(getLanguageName); PREP(getPlayersInVehicle); PREP(getSpeakingLanguageId); PREP(getSpokenLanguages); +PREP(handleConnectorRope); PREP(handleGetClientID); PREP(handleGetHeadVector); PREP(handleGetPluginVersion); diff --git a/addons/sys_core/XEH_preInit.sqf b/addons/sys_core/XEH_preInit.sqf index e85653d18..b2e8a4b9f 100644 --- a/addons/sys_core/XEH_preInit.sqf +++ b/addons/sys_core/XEH_preInit.sqf @@ -46,6 +46,9 @@ DGVAR(pttKeyDown) = false; DGVAR(speaking_cache_valid) = false; +DGVAR(connectorRope) = objNull; +DGVAR(connectorRopeHelper) = objNull; + DVAR(ACRE_SPIT_VERSION) = false; DVAR(ACRE_IS_SYNCING) = false; DVAR(ACRE_SPECTATORS_LIST) = []; diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf new file mode 100644 index 000000000..d884c2958 --- /dev/null +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -0,0 +1,39 @@ +#include "script_component.hpp" +/* + * Author: mrschick + * Handles Phys-X Ropes to represent "connector wires" for infantry phone, GSA, radio sharing, etc. + * + * Arguments: + * 0: State: true to create rope, false to remove + * 1: Vehicle or object the rope starts from (default: objNull) + * 2: Unit the rope should be attached to (default: objNull) + * 3: Relative position offset for where the rope starts from (default: [0,0,0]) + * + * Return Value: + * None + * + * Example: + * [true, _vehicle, _player, _infantryPhonePosition] call acre_sys_intercom_fnc_handleConnectorRope + * [false] call acre_sys_intercom_fnc_handleConnectorRope + * + * Public: No + */ + +params ["_state", ["_fromObject", objNull], ["_toObject", objNull], ["_fromPoint", [0, 0, 0]]]; + +if (_state) then { + // Create rope + GVAR(connectorRope) = ropeCreate [_fromObject, _fromPoint, 1.5]; + GVAR(connectorRopeHelper) = "Land_Can_V2_F" createVehicle position _toObject; + [GVAR(connectorRopeHelper), [0, 0, 0]] ropeAttachTo GVAR(connectorRope); + GVAR(connectorRopeHelper) attachTo [_toObject, [-0.1, 0.1, 0.25], "Pelvis"]; + hideObjectGlobal GVAR(connectorRopeHelper); + systemChat "created rope"; +} else { + // Destroy rope + deleteVehicle GVAR(connectorRopeHelper); + GVAR(connectorRopeHelper) = objNull; + ropeDestroy GVAR(connectorRope); + GVAR(connectorRope) = objNull; + systemChat "deleted rope"; +}; From c88a534a5a68d1a01903507997cae50789cadd6d Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sun, 24 Sep 2023 01:03:49 +0200 Subject: [PATCH 02/37] Infantry phone uses rope --- .../fnc_infantryPhoneChildrenActions.sqf | 25 ++++++++++++++++--- addons/sys_intercom/fnc_intercomPFH.sqf | 2 ++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf b/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf index aef13cf96..526053e60 100644 --- a/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf +++ b/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf @@ -47,6 +47,17 @@ if (_target isKindOf "CAManBase") then { } else { if (vehicle acre_player != _target) then { // Pointing at a vehicle. Get or return the infantry telephone + + // Get Infantry phone position (copied fnc_infantryPhoneAction.sqf, probably a better way to pass position info) + private _positionConfig = configFile >> "CfgVehicles" >> (typeOf _target) >> "acre_infantryPhonePosition"; + private _position = [0, 0, 0]; // Default to main action point + if (isText _positionConfig) then { + _position = _target selectionPosition (getText _positionConfig); // Convert to coordinates for sys_core intercomPFH checks + }; + if (isArray _positionConfig) then { + _position = getArray _positionConfig; + }; + if (isNull _vehicleInfantryPhone) then { { private _action = [ @@ -55,8 +66,11 @@ if (_target isKindOf "CAManBase") then { "", { params ["_target", "_player", "_params"]; - _params params ["_intercomNetwork"]; - [_target, _player, 1, _intercomNetwork] call FUNC(updateInfantryPhoneStatus) + _params params ["_intercomNetwork", "_position"]; + [_target, _player, 1, _intercomNetwork] call FUNC(updateInfantryPhoneStatus); + + // Create connector rope + [true, _target, _player, _position] call EFUNC(sys_core,handleConnectorRope); }, { params ["_target", "_player", "_params"]; @@ -65,7 +79,7 @@ if (_target isKindOf "CAManBase") then { !(_isCalling select 0) || ((_isCalling select 0) && ((_isCalling select 1) == _intercomNetwork)) }, {}, - _forEachIndex + [_forEachIndex, _position] ] call ace_interact_menu_fnc_createAction; _actions pushBack [_action, [], _target]; } forEach (_intercomNames select {_x in (_target getVariable [QGVAR(infantryPhoneIntercom), []])}); @@ -79,7 +93,10 @@ if (_target isKindOf "CAManBase") then { { params ["_target", "_player", ""]; //USES_VARIABLES ["_target", "_player"]; - [_target, _player, 0, INTERCOM_DISCONNECTED] call FUNC(updateInfantryPhoneStatus) + [_target, _player, 0, INTERCOM_DISCONNECTED] call FUNC(updateInfantryPhoneStatus); + + // Destroy connector rope + [false] call EFUNC(sys_core,handleConnectorRope); }, {true}, {}, diff --git a/addons/sys_intercom/fnc_intercomPFH.sqf b/addons/sys_intercom/fnc_intercomPFH.sqf index 6f3ca76fc..066fd4b4d 100644 --- a/addons/sys_intercom/fnc_intercomPFH.sqf +++ b/addons/sys_intercom/fnc_intercomPFH.sqf @@ -45,6 +45,8 @@ for "_i" from 0 to ((count _intercoms) - 1) do { if (_playerPosition distance _infantryPhonePosition >= _infantryPhoneMaxDistance + 1 || {vehicle _player == _vehicle} || {!alive _player} || {captive _player}) then { [_vehicle, _player, 0, _i] call FUNC(updateInfantryPhoneStatus); _intercomUnits = []; + // Destroy connector rope + [false] call EFUNC(sys_core,handleConnectorRope); } else { // Infantry phones are receive and transmit positions _connectionStatus = INTERCOM_RX_AND_TX; From 5be06e5964adf9c40bd0dfe14db7d91ed156f9b6 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Tue, 26 Sep 2023 18:41:27 +0200 Subject: [PATCH 03/37] Overhauled handler Working better on Infantry Phone, not working on GSA, implemented but not tested for Shared Radios. --- addons/sys_core/XEH_preInit.sqf | 2 +- addons/sys_core/fnc_handleConnectorRope.sqf | 77 +++++++++++++++---- .../fnc_startUsingExternalRadio.sqf | 5 ++ addons/sys_gsa/fnc_connect.sqf | 1 + addons/sys_gsa/fnc_disconnect.sqf | 1 + .../fnc_infantryPhoneChildrenActions.sqf | 2 +- 6 files changed, 72 insertions(+), 16 deletions(-) diff --git a/addons/sys_core/XEH_preInit.sqf b/addons/sys_core/XEH_preInit.sqf index b2e8a4b9f..b5210106c 100644 --- a/addons/sys_core/XEH_preInit.sqf +++ b/addons/sys_core/XEH_preInit.sqf @@ -47,7 +47,7 @@ DGVAR(pttKeyDown) = false; DGVAR(speaking_cache_valid) = false; DGVAR(connectorRope) = objNull; -DGVAR(connectorRopeHelper) = objNull; +DGVAR(connectorRopeHelpers) = []; DVAR(ACRE_SPIT_VERSION) = false; DVAR(ACRE_IS_SYNCING) = false; diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index d884c2958..13af3d8d2 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -1,13 +1,14 @@ #include "script_component.hpp" /* * Author: mrschick - * Handles Phys-X Ropes to represent "connector wires" for infantry phone, GSA, radio sharing, etc. + * Handles PhysX Ropes to represent "connector wires" for infantry phone, GSA, radio sharing, etc. * * Arguments: * 0: State: true to create rope, false to remove - * 1: Vehicle or object the rope starts from (default: objNull) - * 2: Unit the rope should be attached to (default: objNull) - * 3: Relative position offset for where the rope starts from (default: [0,0,0]) + * 1: Type of object to connect to: 0 = Infantry Phone, 1 = GSA, 2 = Shared radio (default: 0) + * 2: Vehicle or object the rope starts from (default: objNull) + * 3: Unit the rope should be attached to (default: objNull) + * 4: Relative position offset for where the rope starts from (default: [0,0,0]) * * Return Value: * None @@ -19,21 +20,69 @@ * Public: No */ -params ["_state", ["_fromObject", objNull], ["_toObject", objNull], ["_fromPoint", [0, 0, 0]]]; +params ["_state", ["_type", 0], ["_fromObject", objNull], ["_toObject", objNull], ["_fromPoint", [0, 0, 0]]]; if (_state) then { - // Create rope - GVAR(connectorRope) = ropeCreate [_fromObject, _fromPoint, 1.5]; - GVAR(connectorRopeHelper) = "Land_Can_V2_F" createVehicle position _toObject; - [GVAR(connectorRopeHelper), [0, 0, 0]] ropeAttachTo GVAR(connectorRope); - GVAR(connectorRopeHelper) attachTo [_toObject, [-0.1, 0.1, 0.25], "Pelvis"]; - hideObjectGlobal GVAR(connectorRopeHelper); - systemChat "created rope"; + switch (_type) do { + case 0: { // Connect rope to Infantry Phone + // Adjust Rope start position to not interfere with interaction + _fromPoint set [2, (_fromPoint select 2) - 0.2]; // Lower Z coordinate by 20cm + + // Create Rope + GVAR(connectorRope) = ropeCreate [_fromObject, _fromPoint, 2]; + + // Create helper object on player pelvis + GVAR(connectorRopeHelpers) set [0, "Land_Can_V2_F" createVehicle position _toObject]; + [GVAR(connectorRopeHelpers) select 0, [0, 0, 0]] ropeAttachTo GVAR(connectorRope); + (GVAR(connectorRopeHelpers) select 0) attachTo [_toObject, [-0.1, 0.1, 0.25], "Pelvis"]; + hideObjectGlobal (GVAR(connectorRopeHelpers) select 0); + systemChat "created rope"; + }; + case 1: { // Connect rope to Ground Spike Antenna + // Adjust Rope start position to not interfere with interaction + if (typeOf _fromObject == "vhf30108spike") then { + _fromPoint set [2, (_fromPoint select 2) + 0.2]; // Raise Z coordinate by 20cm + } else { + _fromPoint set [2, (_fromPoint select 2) - 1]; // Lower Z coordinate by 1m + }; + + // Create helper object on GSA + GVAR(connectorRopeHelpers) set [0, "RoadCone_L_F" createVehicle position _fromObject]; + (GVAR(connectorRopeHelpers) select 0) attachTo [_fromObject, [0,0,0]]; + hideObject (GVAR(connectorRopeHelpers) select 0); + + // Create helper object on player pelvis + GVAR(connectorRopeHelpers) set [1, "Land_Can_V2_F" createVehicle position player]; + (GVAR(connectorRopeHelpers) select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; + hideObject (GVAR(connectorRopeHelpers) select 1); + + // Create Rope between helper objects + GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 6]; + [(GVAR(connectorRopeHelpers) select 1), [0, 0, 0]] ropeAttachTo _rope; + systemChat "created rope"; + }; + case 2: { // Connect rope to shared backpack radio owner + // Create helper object on radio owner + GVAR(connectorRopeHelpers) set [0, "RoadCone_L_F" createVehicle position _fromObject]; + (GVAR(connectorRopeHelpers) select 0) attachTo [_fromObject, [-0.1, 0.1, 0.15], "Pelvis"]; + hideObject (GVAR(connectorRopeHelpers) select 0); + + // Create helper object on player pelvis + GVAR(connectorRopeHelpers) set [1, "Land_Can_V2_F" createVehicle position player]; + (GVAR(connectorRopeHelpers) select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; + hideObject (GVAR(connectorRopeHelpers) select 1); + + // Create Rope between helper objects + _rope = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 0.5]; + [GVAR(connectorRopeHelpers) select 1, [0, 0, 0]] ropeAttachTo _rope; + systemChat "created rope"; + }; + }; } else { // Destroy rope - deleteVehicle GVAR(connectorRopeHelper); - GVAR(connectorRopeHelper) = objNull; ropeDestroy GVAR(connectorRope); GVAR(connectorRope) = objNull; + { deleteVehicle _x } forEach GVAR(connectorRopeHelpers); + GVAR(connectorRopeHelpers) = [objNull, objNull]; systemChat "deleted rope"; }; diff --git a/addons/sys_external/fnc_startUsingExternalRadio.sqf b/addons/sys_external/fnc_startUsingExternalRadio.sqf index aa9d76abf..9aa5105e1 100644 --- a/addons/sys_external/fnc_startUsingExternalRadio.sqf +++ b/addons/sys_external/fnc_startUsingExternalRadio.sqf @@ -37,4 +37,9 @@ ACRE_ACTIVE_EXTERNAL_RADIOS pushBackUnique _radioId; // Set it as active radio. [_radioId] call EFUNC(api,setCurrentRadio); +// If it's a manpack radio, visualize the connection with a connector rope +if ([_radio] call EFUNC(sys_radio,isManpackRadio)) then { + [true, 2, _owner, player] call EFUNC(sys_core,handleConnectorRope); +}; + [[ICON_RADIO_CALL], [format [localize LSTRING(hintTake), _displayName, name _owner]], true] call CBA_fnc_notify; diff --git a/addons/sys_gsa/fnc_connect.sqf b/addons/sys_gsa/fnc_connect.sqf index c13183e09..6b8bdf504 100644 --- a/addons/sys_gsa/fnc_connect.sqf +++ b/addons/sys_gsa/fnc_connect.sqf @@ -20,3 +20,4 @@ params ["_gsa", "_radioId"]; // Fire the event [QGVAR(connectGsa), [_gsa, _radioId, acre_player]] call CBA_fnc_serverEvent; +[true, 1, _gsa, player] call EFUNC(sys_core,handleConnectorRope); diff --git a/addons/sys_gsa/fnc_disconnect.sqf b/addons/sys_gsa/fnc_disconnect.sqf index e4ac486e6..96d92b359 100644 --- a/addons/sys_gsa/fnc_disconnect.sqf +++ b/addons/sys_gsa/fnc_disconnect.sqf @@ -20,3 +20,4 @@ params ["_unit", "_gsa"]; // Fire the event [QGVAR(disconnectGsa), [_gsa, _unit]] call CBA_fnc_serverEvent; +[false] call EFUNC(sys_core,handleConnectorRope); diff --git a/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf b/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf index 526053e60..f8fb508ce 100644 --- a/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf +++ b/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf @@ -70,7 +70,7 @@ if (_target isKindOf "CAManBase") then { [_target, _player, 1, _intercomNetwork] call FUNC(updateInfantryPhoneStatus); // Create connector rope - [true, _target, _player, _position] call EFUNC(sys_core,handleConnectorRope); + [true, 0, _target, _player, _position] call EFUNC(sys_core,handleConnectorRope); }, { params ["_target", "_player", "_params"]; From bfd7313e59c4dd9467e7b7f3064a27e7d49825b6 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Mon, 2 Oct 2023 09:40:55 +0200 Subject: [PATCH 04/37] Fixed oversight from a variable renaming --- addons/sys_core/fnc_handleConnectorRope.sqf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index 13af3d8d2..67ca50401 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -57,8 +57,8 @@ if (_state) then { hideObject (GVAR(connectorRopeHelpers) select 1); // Create Rope between helper objects - GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 6]; - [(GVAR(connectorRopeHelpers) select 1), [0, 0, 0]] ropeAttachTo _rope; + GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 2.5]; + [(GVAR(connectorRopeHelpers) select 1), [0, 0, 0]] ropeAttachTo GVAR(connectorRope); systemChat "created rope"; }; case 2: { // Connect rope to shared backpack radio owner @@ -73,8 +73,8 @@ if (_state) then { hideObject (GVAR(connectorRopeHelpers) select 1); // Create Rope between helper objects - _rope = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 0.5]; - [GVAR(connectorRopeHelpers) select 1, [0, 0, 0]] ropeAttachTo _rope; + GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 0.5]; + [GVAR(connectorRopeHelpers) select 1, [0, 0, 0]] ropeAttachTo GVAR(connectorRope); systemChat "created rope"; }; }; From efd0a701be4276a876e91fb6d6770527d6aee597 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Mon, 2 Oct 2023 09:47:51 +0200 Subject: [PATCH 05/37] Changed attach method for GSA rope Using a smaller "PaperCar" object instead of bulky "RoadCone". Disabling collisions and moving the "PaperCar" helper on the GSA instead of attachTo-ing resolves the issue of the rope not attaching to the player's helper. --- addons/sys_core/fnc_handleConnectorRope.sqf | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index 67ca50401..dbf16ca3a 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -39,16 +39,10 @@ if (_state) then { systemChat "created rope"; }; case 1: { // Connect rope to Ground Spike Antenna - // Adjust Rope start position to not interfere with interaction - if (typeOf _fromObject == "vhf30108spike") then { - _fromPoint set [2, (_fromPoint select 2) + 0.2]; // Raise Z coordinate by 20cm - } else { - _fromPoint set [2, (_fromPoint select 2) - 1]; // Lower Z coordinate by 1m - }; - // Create helper object on GSA - GVAR(connectorRopeHelpers) set [0, "RoadCone_L_F" createVehicle position _fromObject]; - (GVAR(connectorRopeHelpers) select 0) attachTo [_fromObject, [0,0,0]]; + GVAR(connectorRopeHelpers) set [0, "PaperCar" createVehicle position _fromObject]; + (GVAR(connectorRopeHelpers) select 0) disableCollisionWith _fromObject; + (GVAR(connectorRopeHelpers) select 0) setPos (position _fromObject); hideObject (GVAR(connectorRopeHelpers) select 0); // Create helper object on player pelvis @@ -63,7 +57,7 @@ if (_state) then { }; case 2: { // Connect rope to shared backpack radio owner // Create helper object on radio owner - GVAR(connectorRopeHelpers) set [0, "RoadCone_L_F" createVehicle position _fromObject]; + GVAR(connectorRopeHelpers) set [0, "PaperCar" createVehicle position _fromObject]; (GVAR(connectorRopeHelpers) select 0) attachTo [_fromObject, [-0.1, 0.1, 0.15], "Pelvis"]; hideObject (GVAR(connectorRopeHelpers) select 0); From fb156bac6481ca011001693c1feb079f5edec845 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Tue, 3 Oct 2023 16:21:48 +0200 Subject: [PATCH 06/37] Break rope on GSA max distance disconnect --- addons/sys_gsa/fnc_externalAntennaPFH.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/sys_gsa/fnc_externalAntennaPFH.sqf b/addons/sys_gsa/fnc_externalAntennaPFH.sqf index ef247c3d8..edb169804 100644 --- a/addons/sys_gsa/fnc_externalAntennaPFH.sqf +++ b/addons/sys_gsa/fnc_externalAntennaPFH.sqf @@ -35,4 +35,5 @@ if ( || {(_unit distance _gsa) > ANTENNA_MAXDISTANCE} ) then { [QGVAR(disconnectGsa), [_gsa, _unit, _radioId]] call CBA_fnc_localEvent; + [false] call EFUNC(sys_core,handleConnectorRope); }; From 210f01b31469959f67d4bbd36ff04ffd6083bf80 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Wed, 4 Oct 2023 12:08:43 +0200 Subject: [PATCH 07/37] Use ACE Refueling Hose as connector rope --- addons/sys_core/CfgVehicles.hpp | 18 ++++++++++++++++++ addons/sys_core/config.cpp | 1 + addons/sys_core/data/wire.cfg | 7 +++++++ addons/sys_core/data/wire.p3d | Bin 0 -> 13867 bytes addons/sys_core/fnc_handleConnectorRope.sqf | 6 +++--- 5 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 addons/sys_core/CfgVehicles.hpp create mode 100644 addons/sys_core/data/wire.cfg create mode 100644 addons/sys_core/data/wire.p3d diff --git a/addons/sys_core/CfgVehicles.hpp b/addons/sys_core/CfgVehicles.hpp new file mode 100644 index 000000000..bd8ba523f --- /dev/null +++ b/addons/sys_core/CfgVehicles.hpp @@ -0,0 +1,18 @@ +class CfgNonAIVehicles { + class GVAR(connectorWireSegment) { + scope = 2; + displayName = "Connector Wire"; + simulation = "ropesegment"; + autocenter = 0; + animated = 0; + model = QPATHTOF(data\wire.p3d); + }; +}; + +class CfgVehicles { + class Rope; + class GVAR(connectorWire): Rope { + segmentType = QGVAR(connectorWireSegment); + model = QPATHTOF(data\wire.p3d); + }; +}; diff --git a/addons/sys_core/config.cpp b/addons/sys_core/config.cpp index ece4e535f..bcb54e52c 100644 --- a/addons/sys_core/config.cpp +++ b/addons/sys_core/config.cpp @@ -14,6 +14,7 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" #include "CfgSounds.hpp" +#include "CfgVehicles.hpp" class CfgAcreWorlds { diff --git a/addons/sys_core/data/wire.cfg b/addons/sys_core/data/wire.cfg new file mode 100644 index 000000000..65ae22011 --- /dev/null +++ b/addons/sys_core/data/wire.cfg @@ -0,0 +1,7 @@ +class CfgModels { + class wire { + sectionsInherit = ""; + sections[] = {"rope"}; + skeletonName = ""; + }; +}; \ No newline at end of file diff --git a/addons/sys_core/data/wire.p3d b/addons/sys_core/data/wire.p3d new file mode 100644 index 0000000000000000000000000000000000000000..cc233eacf611c2a83d3dd80d42f1213458ee30c7 GIT binary patch literal 13867 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 T6YZ~q9E(yrH2v(s(fj`kG7!pD literal 0 HcmV?d00001 diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index dbf16ca3a..9923d684a 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -29,7 +29,7 @@ if (_state) then { _fromPoint set [2, (_fromPoint select 2) - 0.2]; // Lower Z coordinate by 20cm // Create Rope - GVAR(connectorRope) = ropeCreate [_fromObject, _fromPoint, 2]; + GVAR(connectorRope) = ropeCreate [_fromObject, _fromPoint, 2, nil, nil, QGVAR(connectorWire)]; // Create helper object on player pelvis GVAR(connectorRopeHelpers) set [0, "Land_Can_V2_F" createVehicle position _toObject]; @@ -51,7 +51,7 @@ if (_state) then { hideObject (GVAR(connectorRopeHelpers) select 1); // Create Rope between helper objects - GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 2.5]; + GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 2.5, nil, nil, QGVAR(connectorWire)]; [(GVAR(connectorRopeHelpers) select 1), [0, 0, 0]] ropeAttachTo GVAR(connectorRope); systemChat "created rope"; }; @@ -67,7 +67,7 @@ if (_state) then { hideObject (GVAR(connectorRopeHelpers) select 1); // Create Rope between helper objects - GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 0.5]; + GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 0.5, nil, nil, QGVAR(connectorWire)]; [GVAR(connectorRopeHelpers) select 1, [0, 0, 0]] ropeAttachTo GVAR(connectorRope); systemChat "created rope"; }; From d9860cbcd170af00f5fee924a8015cb6f09684eb Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Wed, 4 Oct 2023 12:10:11 +0200 Subject: [PATCH 08/37] Possible fix for rope blocking disconnect interaction --- addons/sys_core/fnc_handleConnectorRope.sqf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index 9923d684a..1b4d84755 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -26,7 +26,7 @@ if (_state) then { switch (_type) do { case 0: { // Connect rope to Infantry Phone // Adjust Rope start position to not interfere with interaction - _fromPoint set [2, (_fromPoint select 2) - 0.2]; // Lower Z coordinate by 20cm + //_fromPoint set [2, (_fromPoint select 2) - 0.3]; // Lower Z coordinate by 30cm ---------------------- CHECK IF NEEDED // Create Rope GVAR(connectorRope) = ropeCreate [_fromObject, _fromPoint, 2, nil, nil, QGVAR(connectorWire)]; @@ -39,6 +39,11 @@ if (_state) then { systemChat "created rope"; }; case 1: { // Connect rope to Ground Spike Antenna + // Adjust Rope start position to not interfere with interaction + /*if (typeOf _fromObject == "vhf30108spike") then { + _fromPoint set [1, (_fromPoint select 1) - 0.2]; // Shift Y coordinate by 20cm ---------------------- CHECK IF NEEDED + };*/ + // Create helper object on GSA GVAR(connectorRopeHelpers) set [0, "PaperCar" createVehicle position _fromObject]; (GVAR(connectorRopeHelpers) select 0) disableCollisionWith _fromObject; From 9c1a375ae506cc1d063b260e68f7e366f1562999 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:06:07 +0200 Subject: [PATCH 09/37] Add CBA Setting under sys_gestures --- addons/sys_core/fnc_handleConnectorRope.sqf | 2 ++ addons/sys_gestures/initSettings.inc.sqf | 11 +++++++++++ addons/sys_gestures/stringtable.xml | 10 ++++++++++ 3 files changed, 23 insertions(+) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index 1b4d84755..ac775154b 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -22,6 +22,8 @@ params ["_state", ["_type", 0], ["_fromObject", objNull], ["_toObject", objNull], ["_fromPoint", [0, 0, 0]]]; +if (!EGVAR(sys_gestures,showConnectorRopes)) exitWith {}; + if (_state) then { switch (_type) do { case 0: { // Connect rope to Infantry Phone diff --git a/addons/sys_gestures/initSettings.inc.sqf b/addons/sys_gestures/initSettings.inc.sqf index 4aa798eea..2a9e9510d 100644 --- a/addons/sys_gestures/initSettings.inc.sqf +++ b/addons/sys_gestures/initSettings.inc.sqf @@ -19,3 +19,14 @@ {}, true ] call CBA_fnc_addSetting; + +[ + QGVAR(showConnectorRopes), + "CHECKBOX", + [LLSTRING(showConnectorRopes), LLSTRING(showConnectorRopes_description)], + LLSTRING(category), + true, + true, + {}, + true +] call CBA_fnc_addSetting; diff --git a/addons/sys_gestures/stringtable.xml b/addons/sys_gestures/stringtable.xml index cb47bf264..e5bce8293 100644 --- a/addons/sys_gestures/stringtable.xml +++ b/addons/sys_gestures/stringtable.xml @@ -46,5 +46,15 @@ Telsiz kullanırken nişan almayı engeller Usar rádios irá impedir a mira + + Show connector wires + Zeige verbindungskabel + Mostra cavi di collegamento + + + Connections to infantry phones, GSAs and shared radios will be visualized with connector wires. + Verbindungen zu Gegensprechanlage, BBA und Geteilten Funkgeräten werden mit Kabeln visualisiert. + Connessioni a telefoni di fanteria, antenne a pavimento e radio condivise verranno visualizzate con cavi. + From 9f2c84a29ebd4ef0baf1afe2ccd44fc4efbc23ea Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sat, 7 Oct 2023 15:19:02 +0200 Subject: [PATCH 10/37] Gave rope some slack at usual connection distances --- addons/sys_core/fnc_handleConnectorRope.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index ac775154b..58f85b422 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -31,7 +31,7 @@ if (_state) then { //_fromPoint set [2, (_fromPoint select 2) - 0.3]; // Lower Z coordinate by 30cm ---------------------- CHECK IF NEEDED // Create Rope - GVAR(connectorRope) = ropeCreate [_fromObject, _fromPoint, 2, nil, nil, QGVAR(connectorWire)]; + GVAR(connectorRope) = ropeCreate [_fromObject, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; // Create helper object on player pelvis GVAR(connectorRopeHelpers) set [0, "Land_Can_V2_F" createVehicle position _toObject]; @@ -58,7 +58,7 @@ if (_state) then { hideObject (GVAR(connectorRopeHelpers) select 1); // Create Rope between helper objects - GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 2.5, nil, nil, QGVAR(connectorWire)]; + GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 5, nil, nil, QGVAR(connectorWire)]; [(GVAR(connectorRopeHelpers) select 1), [0, 0, 0]] ropeAttachTo GVAR(connectorRope); systemChat "created rope"; }; @@ -74,7 +74,7 @@ if (_state) then { hideObject (GVAR(connectorRopeHelpers) select 1); // Create Rope between helper objects - GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 0.5, nil, nil, QGVAR(connectorWire)]; + GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; [GVAR(connectorRopeHelpers) select 1, [0, 0, 0]] ropeAttachTo GVAR(connectorRope); systemChat "created rope"; }; From cfe2085385317c5875eb5646759356e4421386c9 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sat, 7 Oct 2023 15:19:56 +0200 Subject: [PATCH 11/37] Made hose->wire model thinner --- addons/sys_core/data/wire.p3d | Bin 13867 -> 13867 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/addons/sys_core/data/wire.p3d b/addons/sys_core/data/wire.p3d index cc233eacf611c2a83d3dd80d42f1213458ee30c7..920f10c891af107f6508640b3a864e9127d556c9 100644 GIT binary patch literal 13867 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 T6YZ~q9E(yrH2v(s(fj`kG7!pD From 47839cb5c6333935fdcb73928a971a413411c5dc Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Thu, 2 Nov 2023 21:03:32 +0100 Subject: [PATCH 12/37] Find rope start position more efficiently By fully using the passed parameters instead of fetching it from config again --- .../fnc_infantryPhoneChildrenActions.sqf | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf b/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf index f8fb508ce..5b4950902 100644 --- a/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf +++ b/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf @@ -15,7 +15,7 @@ * Public: No */ -params ["_target"]; +params ["_target", "_unit", "_position"]; private _actions = []; @@ -47,17 +47,6 @@ if (_target isKindOf "CAManBase") then { } else { if (vehicle acre_player != _target) then { // Pointing at a vehicle. Get or return the infantry telephone - - // Get Infantry phone position (copied fnc_infantryPhoneAction.sqf, probably a better way to pass position info) - private _positionConfig = configFile >> "CfgVehicles" >> (typeOf _target) >> "acre_infantryPhonePosition"; - private _position = [0, 0, 0]; // Default to main action point - if (isText _positionConfig) then { - _position = _target selectionPosition (getText _positionConfig); // Convert to coordinates for sys_core intercomPFH checks - }; - if (isArray _positionConfig) then { - _position = getArray _positionConfig; - }; - if (isNull _vehicleInfantryPhone) then { { private _action = [ From a3ad3a9cc69db5f241d6588d307450ba3e4b40c4 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Fri, 3 Nov 2023 00:37:38 +0100 Subject: [PATCH 13/37] Prevent taking infantry phone that is being used --- .../fnc_infantryPhoneChildrenActions.sqf | 15 ++++++++++++++- addons/sys_intercom/stringtable.xml | 5 +++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf b/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf index 5b4950902..0200ecb9a 100644 --- a/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf +++ b/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf @@ -20,6 +20,7 @@ params ["_target", "_unit", "_position"]; private _actions = []; (acre_player getVariable [QGVAR(vehicleInfantryPhone), [objNull, INTERCOM_DISCONNECTED]]) params ["_vehicleInfantryPhone", "_infantryPhoneNetwork"]; +(_target getVariable [QGVAR(unitInfantryPhone), [objNull, INTERCOM_DISCONNECTED]]) params ["_unitInfantryPhone", "_unitInfantryPhoneNetwork"]; private _intercomNames = _target getVariable [QGVAR(intercomNames), []]; @@ -47,7 +48,7 @@ if (_target isKindOf "CAManBase") then { } else { if (vehicle acre_player != _target) then { // Pointing at a vehicle. Get or return the infantry telephone - if (isNull _vehicleInfantryPhone) then { + if (isNull _vehicleInfantryPhone && (isNull _unitInfantryPhone)) then { { private _action = [ format [QGVAR(takeInfantryPhone_%1), _x], @@ -117,6 +118,18 @@ if (_target isKindOf "CAManBase") then { ] call ace_interact_menu_fnc_createAction; _actions pushBack [_action, [], _target]; } forEach (_intercomNames select {_x in (_target getVariable [QGVAR(infantryPhoneIntercom), []])}); + } else { + // Generate empty action to show that the infantry phone is being used by someone else + private _action = [ + QGVAR(infantryPhoneUnavailable), + format [localize LSTRING(infantryPhoneUnavailable)], + "", + {true}, + {true}, + {}, + {} + ] call ace_interact_menu_fnc_createAction; + _actions pushBack [_action, [], _target]; }; }; } else { diff --git a/addons/sys_intercom/stringtable.xml b/addons/sys_intercom/stringtable.xml index 7d27b4a25..4dd80b585 100644 --- a/addons/sys_intercom/stringtable.xml +++ b/addons/sys_intercom/stringtable.xml @@ -151,6 +151,11 @@ Téléphone d'infanterie reçu %1 Piyade Telefonu Alındı %1 + + Infantry Phone used by someone else + Hörer wird gerade benutzt + Telefono fanteria preso da qualcuno + Intercom Intercom From 2db6cc0066e1625f9b1cbd774546122979d98133 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Fri, 3 Nov 2023 14:37:49 +0100 Subject: [PATCH 14/37] Concentrate intercom wire handling in "updateInfantryPhoneStatus" --- addons/sys_intercom/XEH_postInit.sqf | 4 ++-- .../fnc_infantryPhoneChildrenActions.sqf | 10 ++-------- addons/sys_intercom/fnc_intercomPFH.sqf | 2 -- .../sys_intercom/fnc_updateInfantryPhoneStatus.sqf | 13 +++++++++++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/addons/sys_intercom/XEH_postInit.sqf b/addons/sys_intercom/XEH_postInit.sqf index f3d781baa..9286737d5 100644 --- a/addons/sys_intercom/XEH_postInit.sqf +++ b/addons/sys_intercom/XEH_postInit.sqf @@ -69,9 +69,9 @@ if (!hasInterface) exitWith {}; }, true] call CBA_fnc_addPlayerEventHandler; [QGVAR(giveInfantryPhone), { - params ["_vehicle", "_unit", "_action", "_message", ["_intercomNetwork", INTERCOM_DISCONNECTED]]; + params ["_vehicle", "_unit", "_action", "_message", ["_intercomNetwork", INTERCOM_DISCONNECTED], ["_position", objNull]]; [[ICON_RADIO_CALL], [_message]] call CBA_fnc_notify; - [_vehicle, _unit, _action, _intercomNetwork] call FUNC(updateInfantryPhoneStatus); + [_vehicle, _unit, _action, _intercomNetwork, objNull, _position] call FUNC(updateInfantryPhoneStatus); }] call CBA_fnc_addEventHandler; #ifdef DRAW_INFANTRYPHONE_INFO diff --git a/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf b/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf index 0200ecb9a..ca6618e4c 100644 --- a/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf +++ b/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf @@ -37,7 +37,7 @@ if (_target isKindOf "CAManBase") then { _params params ["_intercomNetwork"]; //USES_VARIABLES ["_target", "_player"]; - [_player getVariable [QGVAR(vehicleInfantryPhone), [objNull, INTERCOM_DISCONNECTED]] select 0, _target, 2, _intercomNetwork, _player] call FUNC(updateInfantryPhoneStatus) + [_player getVariable [QGVAR(vehicleInfantryPhone), [objNull, INTERCOM_DISCONNECTED]] select 0, _target, 2, _intercomNetwork, _player, _position] call FUNC(updateInfantryPhoneStatus) }, {true}, {}, @@ -57,10 +57,7 @@ if (_target isKindOf "CAManBase") then { { params ["_target", "_player", "_params"]; _params params ["_intercomNetwork", "_position"]; - [_target, _player, 1, _intercomNetwork] call FUNC(updateInfantryPhoneStatus); - - // Create connector rope - [true, 0, _target, _player, _position] call EFUNC(sys_core,handleConnectorRope); + [_target, _player, 1, _intercomNetwork, objNull, _position] call FUNC(updateInfantryPhoneStatus); }, { params ["_target", "_player", "_params"]; @@ -84,9 +81,6 @@ if (_target isKindOf "CAManBase") then { params ["_target", "_player", ""]; //USES_VARIABLES ["_target", "_player"]; [_target, _player, 0, INTERCOM_DISCONNECTED] call FUNC(updateInfantryPhoneStatus); - - // Destroy connector rope - [false] call EFUNC(sys_core,handleConnectorRope); }, {true}, {}, diff --git a/addons/sys_intercom/fnc_intercomPFH.sqf b/addons/sys_intercom/fnc_intercomPFH.sqf index 066fd4b4d..6f3ca76fc 100644 --- a/addons/sys_intercom/fnc_intercomPFH.sqf +++ b/addons/sys_intercom/fnc_intercomPFH.sqf @@ -45,8 +45,6 @@ for "_i" from 0 to ((count _intercoms) - 1) do { if (_playerPosition distance _infantryPhonePosition >= _infantryPhoneMaxDistance + 1 || {vehicle _player == _vehicle} || {!alive _player} || {captive _player}) then { [_vehicle, _player, 0, _i] call FUNC(updateInfantryPhoneStatus); _intercomUnits = []; - // Destroy connector rope - [false] call EFUNC(sys_core,handleConnectorRope); } else { // Infantry phones are receive and transmit positions _connectionStatus = INTERCOM_RX_AND_TX; diff --git a/addons/sys_intercom/fnc_updateInfantryPhoneStatus.sqf b/addons/sys_intercom/fnc_updateInfantryPhoneStatus.sqf index 935dac577..a26ed46a2 100644 --- a/addons/sys_intercom/fnc_updateInfantryPhoneStatus.sqf +++ b/addons/sys_intercom/fnc_updateInfantryPhoneStatus.sqf @@ -20,7 +20,7 @@ * Public: No */ -params ["_vehicle", "_unit", "_action", "_intercomNetwork", ["_givingUnit", objNull, [objNull]]]; +params ["_vehicle", "_unit", "_action", "_intercomNetwork", ["_givingUnit", objNull, [objNull]], ["_position", objNull]]; private _intercomName = ((_vehicle getVariable [QGVAR(intercomNames), []]) select _intercomNetwork) select 1; private _intercomText = format ["( %1 )", _intercomName]; @@ -31,6 +31,9 @@ switch (_action) do { _vehicle setVariable [QGVAR(unitInfantryPhone), nil, true]; _unit setVariable [QGVAR(vehicleInfantryPhone), nil, true]; + // Destroy connector rope + [false] call EFUNC(sys_core,handleConnectorRope); + ACRE_PLAYER_INTERCOM = []; [[ICON_RADIO_CALL], [format [localize LSTRING(infantryPhoneDisconnected), _intercomText]], true] call CBA_fnc_notify; [GVAR(intercomPFH)] call CBA_fnc_removePerFrameHandler; @@ -40,6 +43,9 @@ switch (_action) do { _vehicle setVariable [QGVAR(unitInfantryPhone), [_unit, _intercomNetwork], true]; _unit setVariable [QGVAR(vehicleInfantryPhone), [_vehicle, _intercomNetwork], true]; + // Create connector rope + [true, 0, _vehicle, _unit, _position] call EFUNC(sys_core,handleConnectorRope); + [[ICON_RADIO_CALL], [format [localize LSTRING(infantryPhoneConnected), _intercomText]], true] call CBA_fnc_notify; GVAR(intercomPFH) = [DFUNC(intercomPFH), 1.1, [acre_player, _vehicle]] call CBA_fnc_addPerFrameHandler; }; @@ -48,8 +54,11 @@ switch (_action) do { _givingUnit setVariable [QGVAR(vehicleInfantryPhone), nil, true]; [GVAR(intercomPFH)] call CBA_fnc_removePerFrameHandler; + // Destroy connector rope + [false] call EFUNC(sys_core,handleConnectorRope); + private _message = format [localize LSTRING(infantryPhoneReceived), _intercomText]; - [QGVAR(giveInfantryPhone), [_vehicle, _unit, 1, _message, _intercomNetwork], _unit] call CBA_fnc_targetEvent; + [QGVAR(giveInfantryPhone), [_vehicle, _unit, 1, _message, _intercomNetwork, _position], _unit] call CBA_fnc_targetEvent; }; case 3: { _vehicle setVariable [QGVAR(unitInfantryPhone), [_unit, _intercomNetwork], true]; From 22c0c785cfc4faf7442e18eb03ffc85175a66188 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Fri, 3 Nov 2023 15:01:19 +0100 Subject: [PATCH 15/37] Use "PaperCar" as a helper object on both ends --- addons/sys_core/fnc_handleConnectorRope.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index 58f85b422..43bcea2c5 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -34,7 +34,7 @@ if (_state) then { GVAR(connectorRope) = ropeCreate [_fromObject, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; // Create helper object on player pelvis - GVAR(connectorRopeHelpers) set [0, "Land_Can_V2_F" createVehicle position _toObject]; + GVAR(connectorRopeHelpers) set [0, "PaperCar" createVehicle position _toObject]; [GVAR(connectorRopeHelpers) select 0, [0, 0, 0]] ropeAttachTo GVAR(connectorRope); (GVAR(connectorRopeHelpers) select 0) attachTo [_toObject, [-0.1, 0.1, 0.25], "Pelvis"]; hideObjectGlobal (GVAR(connectorRopeHelpers) select 0); @@ -53,7 +53,7 @@ if (_state) then { hideObject (GVAR(connectorRopeHelpers) select 0); // Create helper object on player pelvis - GVAR(connectorRopeHelpers) set [1, "Land_Can_V2_F" createVehicle position player]; + GVAR(connectorRopeHelpers) set [1, "PaperCar" createVehicle position player]; (GVAR(connectorRopeHelpers) select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; hideObject (GVAR(connectorRopeHelpers) select 1); @@ -69,7 +69,7 @@ if (_state) then { hideObject (GVAR(connectorRopeHelpers) select 0); // Create helper object on player pelvis - GVAR(connectorRopeHelpers) set [1, "Land_Can_V2_F" createVehicle position player]; + GVAR(connectorRopeHelpers) set [1, "PaperCar" createVehicle position player]; (GVAR(connectorRopeHelpers) select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; hideObject (GVAR(connectorRopeHelpers) select 1); From 12f106a98fcd328e2e8b47930e3392a16c4170a1 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Fri, 3 Nov 2023 15:02:19 +0100 Subject: [PATCH 16/37] Hide all helper objects globally --- addons/sys_core/fnc_handleConnectorRope.sqf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index 43bcea2c5..3a7b2dd84 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -50,12 +50,12 @@ if (_state) then { GVAR(connectorRopeHelpers) set [0, "PaperCar" createVehicle position _fromObject]; (GVAR(connectorRopeHelpers) select 0) disableCollisionWith _fromObject; (GVAR(connectorRopeHelpers) select 0) setPos (position _fromObject); - hideObject (GVAR(connectorRopeHelpers) select 0); + hideObjectGlobal (GVAR(connectorRopeHelpers) select 0); // Create helper object on player pelvis GVAR(connectorRopeHelpers) set [1, "PaperCar" createVehicle position player]; (GVAR(connectorRopeHelpers) select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; - hideObject (GVAR(connectorRopeHelpers) select 1); + hideObjectGlobal (GVAR(connectorRopeHelpers) select 1); // Create Rope between helper objects GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 5, nil, nil, QGVAR(connectorWire)]; @@ -66,12 +66,12 @@ if (_state) then { // Create helper object on radio owner GVAR(connectorRopeHelpers) set [0, "PaperCar" createVehicle position _fromObject]; (GVAR(connectorRopeHelpers) select 0) attachTo [_fromObject, [-0.1, 0.1, 0.15], "Pelvis"]; - hideObject (GVAR(connectorRopeHelpers) select 0); + hideObjectGlobal (GVAR(connectorRopeHelpers) select 0); // Create helper object on player pelvis GVAR(connectorRopeHelpers) set [1, "PaperCar" createVehicle position player]; (GVAR(connectorRopeHelpers) select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; - hideObject (GVAR(connectorRopeHelpers) select 1); + hideObjectGlobal (GVAR(connectorRopeHelpers) select 1); // Create Rope between helper objects GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; From 73b0061993d2dbc83148d71c1eff0d7bb04f3791 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sun, 12 Nov 2023 18:11:48 +0100 Subject: [PATCH 17/37] Cleaned up systemChat and Comment --- addons/sys_core/fnc_handleConnectorRope.sqf | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index 3a7b2dd84..92ee17bfc 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -27,9 +27,6 @@ if (!EGVAR(sys_gestures,showConnectorRopes)) exitWith {}; if (_state) then { switch (_type) do { case 0: { // Connect rope to Infantry Phone - // Adjust Rope start position to not interfere with interaction - //_fromPoint set [2, (_fromPoint select 2) - 0.3]; // Lower Z coordinate by 30cm ---------------------- CHECK IF NEEDED - // Create Rope GVAR(connectorRope) = ropeCreate [_fromObject, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; @@ -38,14 +35,8 @@ if (_state) then { [GVAR(connectorRopeHelpers) select 0, [0, 0, 0]] ropeAttachTo GVAR(connectorRope); (GVAR(connectorRopeHelpers) select 0) attachTo [_toObject, [-0.1, 0.1, 0.25], "Pelvis"]; hideObjectGlobal (GVAR(connectorRopeHelpers) select 0); - systemChat "created rope"; }; case 1: { // Connect rope to Ground Spike Antenna - // Adjust Rope start position to not interfere with interaction - /*if (typeOf _fromObject == "vhf30108spike") then { - _fromPoint set [1, (_fromPoint select 1) - 0.2]; // Shift Y coordinate by 20cm ---------------------- CHECK IF NEEDED - };*/ - // Create helper object on GSA GVAR(connectorRopeHelpers) set [0, "PaperCar" createVehicle position _fromObject]; (GVAR(connectorRopeHelpers) select 0) disableCollisionWith _fromObject; @@ -60,7 +51,6 @@ if (_state) then { // Create Rope between helper objects GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 5, nil, nil, QGVAR(connectorWire)]; [(GVAR(connectorRopeHelpers) select 1), [0, 0, 0]] ropeAttachTo GVAR(connectorRope); - systemChat "created rope"; }; case 2: { // Connect rope to shared backpack radio owner // Create helper object on radio owner @@ -76,7 +66,6 @@ if (_state) then { // Create Rope between helper objects GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; [GVAR(connectorRopeHelpers) select 1, [0, 0, 0]] ropeAttachTo GVAR(connectorRope); - systemChat "created rope"; }; }; } else { @@ -85,5 +74,4 @@ if (_state) then { GVAR(connectorRope) = objNull; { deleteVehicle _x } forEach GVAR(connectorRopeHelpers); GVAR(connectorRopeHelpers) = [objNull, objNull]; - systemChat "deleted rope"; }; From cdfd44dee9a6babe83a51c6f3eef913a14ea4368 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sun, 12 Nov 2023 18:14:58 +0100 Subject: [PATCH 18/37] Custom Rope Helper Object Reuses the PaperCar model --- addons/sys_core/CfgVehicles.hpp | 7 +++++++ addons/sys_core/fnc_handleConnectorRope.sqf | 17 ++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/addons/sys_core/CfgVehicles.hpp b/addons/sys_core/CfgVehicles.hpp index bd8ba523f..1c48c4a0c 100644 --- a/addons/sys_core/CfgVehicles.hpp +++ b/addons/sys_core/CfgVehicles.hpp @@ -15,4 +15,11 @@ class CfgVehicles { segmentType = QGVAR(connectorWireSegment); model = QPATHTOF(data\wire.p3d); }; + + class Car; + class GVAR(connectorHelper): Car { + displayName = "Connector Rope Helper"; + model = "core\default\default.p3d"; + scope = 2; + }; }; diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index 92ee17bfc..5c74e1476 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -24,6 +24,8 @@ params ["_state", ["_type", 0], ["_fromObject", objNull], ["_toObject", objNull] if (!EGVAR(sys_gestures,showConnectorRopes)) exitWith {}; +private _helper = QGVAR(connectorHelper); + if (_state) then { switch (_type) do { case 0: { // Connect rope to Infantry Phone @@ -31,22 +33,25 @@ if (_state) then { GVAR(connectorRope) = ropeCreate [_fromObject, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; // Create helper object on player pelvis - GVAR(connectorRopeHelpers) set [0, "PaperCar" createVehicle position _toObject]; + GVAR(connectorRopeHelpers) set [0, _helper createVehicle position _toObject]; [GVAR(connectorRopeHelpers) select 0, [0, 0, 0]] ropeAttachTo GVAR(connectorRope); (GVAR(connectorRopeHelpers) select 0) attachTo [_toObject, [-0.1, 0.1, 0.25], "Pelvis"]; hideObjectGlobal (GVAR(connectorRopeHelpers) select 0); + (GVAR(connectorRopeHelpers) select 0) allowDamage false; }; case 1: { // Connect rope to Ground Spike Antenna // Create helper object on GSA - GVAR(connectorRopeHelpers) set [0, "PaperCar" createVehicle position _fromObject]; + GVAR(connectorRopeHelpers) set [0, _helper createVehicle position _fromObject]; (GVAR(connectorRopeHelpers) select 0) disableCollisionWith _fromObject; (GVAR(connectorRopeHelpers) select 0) setPos (position _fromObject); hideObjectGlobal (GVAR(connectorRopeHelpers) select 0); + (GVAR(connectorRopeHelpers) select 0) allowDamage false; // Create helper object on player pelvis - GVAR(connectorRopeHelpers) set [1, "PaperCar" createVehicle position player]; + GVAR(connectorRopeHelpers) set [1, _helper createVehicle position player]; (GVAR(connectorRopeHelpers) select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; hideObjectGlobal (GVAR(connectorRopeHelpers) select 1); + (GVAR(connectorRopeHelpers) select 1) allowDamage false; // Create Rope between helper objects GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 5, nil, nil, QGVAR(connectorWire)]; @@ -54,14 +59,16 @@ if (_state) then { }; case 2: { // Connect rope to shared backpack radio owner // Create helper object on radio owner - GVAR(connectorRopeHelpers) set [0, "PaperCar" createVehicle position _fromObject]; + GVAR(connectorRopeHelpers) set [0, _helper createVehicle position _fromObject]; (GVAR(connectorRopeHelpers) select 0) attachTo [_fromObject, [-0.1, 0.1, 0.15], "Pelvis"]; hideObjectGlobal (GVAR(connectorRopeHelpers) select 0); + (GVAR(connectorRopeHelpers) select 0) allowDamage false; // Create helper object on player pelvis - GVAR(connectorRopeHelpers) set [1, "PaperCar" createVehicle position player]; + GVAR(connectorRopeHelpers) set [1, _helper createVehicle position player]; (GVAR(connectorRopeHelpers) select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; hideObjectGlobal (GVAR(connectorRopeHelpers) select 1); + (GVAR(connectorRopeHelpers) select 1) allowDamage false; // Create Rope between helper objects GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; From ef36edc05ad9deac005e5a1bfcdf4cf8a1f2a4cb Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Mon, 13 Nov 2023 12:05:07 +0100 Subject: [PATCH 19/37] More local var use, reducing macro invocations --- addons/sys_core/fnc_handleConnectorRope.sqf | 60 +++++++++++---------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index 5c74e1476..c48cc0b07 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -27,54 +27,60 @@ if (!EGVAR(sys_gestures,showConnectorRopes)) exitWith {}; private _helper = QGVAR(connectorHelper); if (_state) then { + private _connectorRopeHelpers = []; + private _connectorRope = ""; + switch (_type) do { case 0: { // Connect rope to Infantry Phone // Create Rope - GVAR(connectorRope) = ropeCreate [_fromObject, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; + _connectorRope = ropeCreate [_fromObject, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; // Create helper object on player pelvis - GVAR(connectorRopeHelpers) set [0, _helper createVehicle position _toObject]; - [GVAR(connectorRopeHelpers) select 0, [0, 0, 0]] ropeAttachTo GVAR(connectorRope); - (GVAR(connectorRopeHelpers) select 0) attachTo [_toObject, [-0.1, 0.1, 0.25], "Pelvis"]; - hideObjectGlobal (GVAR(connectorRopeHelpers) select 0); - (GVAR(connectorRopeHelpers) select 0) allowDamage false; + _connectorRopeHelpers set [0, _helper createVehicle position _toObject]; + [_connectorRopeHelpers select 0, [0, 0, 0]] ropeAttachTo _connectorRope; + (_connectorRopeHelpers select 0) attachTo [_toObject, [-0.1, 0.1, 0.25], "Pelvis"]; + hideObjectGlobal (_connectorRopeHelpers select 0); + (_connectorRopeHelpers select 0) allowDamage false; }; case 1: { // Connect rope to Ground Spike Antenna // Create helper object on GSA - GVAR(connectorRopeHelpers) set [0, _helper createVehicle position _fromObject]; - (GVAR(connectorRopeHelpers) select 0) disableCollisionWith _fromObject; - (GVAR(connectorRopeHelpers) select 0) setPos (position _fromObject); - hideObjectGlobal (GVAR(connectorRopeHelpers) select 0); - (GVAR(connectorRopeHelpers) select 0) allowDamage false; + _connectorRopeHelpers set [0, _helper createVehicle position _fromObject]; + (_connectorRopeHelpers select 0) disableCollisionWith _fromObject; + (_connectorRopeHelpers select 0) setPos (position _fromObject); + hideObjectGlobal (_connectorRopeHelpers select 0); + (_connectorRopeHelpers select 0) allowDamage false; // Create helper object on player pelvis - GVAR(connectorRopeHelpers) set [1, _helper createVehicle position player]; - (GVAR(connectorRopeHelpers) select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; - hideObjectGlobal (GVAR(connectorRopeHelpers) select 1); - (GVAR(connectorRopeHelpers) select 1) allowDamage false; + _connectorRopeHelpers set [1, _helper createVehicle position player]; + (_connectorRopeHelpers select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; + hideObjectGlobal (_connectorRopeHelpers select 1); + (_connectorRopeHelpers select 1) allowDamage false; // Create Rope between helper objects - GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 5, nil, nil, QGVAR(connectorWire)]; - [(GVAR(connectorRopeHelpers) select 1), [0, 0, 0]] ropeAttachTo GVAR(connectorRope); + _connectorRope = ropeCreate [_connectorRopeHelpers select 0, _fromPoint, 5, nil, nil, QGVAR(connectorWire)]; + [(_connectorRopeHelpers select 1), [0, 0, 0]] ropeAttachTo _connectorRope; }; case 2: { // Connect rope to shared backpack radio owner // Create helper object on radio owner - GVAR(connectorRopeHelpers) set [0, _helper createVehicle position _fromObject]; - (GVAR(connectorRopeHelpers) select 0) attachTo [_fromObject, [-0.1, 0.1, 0.15], "Pelvis"]; - hideObjectGlobal (GVAR(connectorRopeHelpers) select 0); - (GVAR(connectorRopeHelpers) select 0) allowDamage false; + _connectorRopeHelpers set [0, _helper createVehicle position _fromObject]; + (_connectorRopeHelpers select 0) attachTo [_fromObject, [-0.1, 0.1, 0.15], "Pelvis"]; + hideObjectGlobal (_connectorRopeHelpers select 0); + (_connectorRopeHelpers select 0) allowDamage false; // Create helper object on player pelvis - GVAR(connectorRopeHelpers) set [1, _helper createVehicle position player]; - (GVAR(connectorRopeHelpers) select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; - hideObjectGlobal (GVAR(connectorRopeHelpers) select 1); - (GVAR(connectorRopeHelpers) select 1) allowDamage false; + _connectorRopeHelpers set [1, _helper createVehicle position player]; + (_connectorRopeHelpers select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; + hideObjectGlobal (_connectorRopeHelpers select 1); + (_connectorRopeHelpers select 1) allowDamage false; // Create Rope between helper objects - GVAR(connectorRope) = ropeCreate [GVAR(connectorRopeHelpers) select 0, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; - [GVAR(connectorRopeHelpers) select 1, [0, 0, 0]] ropeAttachTo GVAR(connectorRope); + _connectorRope = ropeCreate [_connectorRopeHelpers select 0, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; + [_connectorRopeHelpers select 1, [0, 0, 0]] ropeAttachTo _connectorRope; }; }; + + GVAR(connectorRope) = _connectorRope; + GVAR(connectorRopeHelpers) = _connectorRopeHelpers; } else { // Destroy rope ropeDestroy GVAR(connectorRope); From 08290a4a573f328b1842dc84c9d4dfd1aa3ec5eb Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Mon, 8 Jan 2024 13:53:24 +0100 Subject: [PATCH 20/37] Properly run hideObjectGlobal on Server Rough quick fix via remoteExec. --- addons/sys_core/fnc_handleConnectorRope.sqf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index c48cc0b07..b4638bd61 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -39,7 +39,7 @@ if (_state) then { _connectorRopeHelpers set [0, _helper createVehicle position _toObject]; [_connectorRopeHelpers select 0, [0, 0, 0]] ropeAttachTo _connectorRope; (_connectorRopeHelpers select 0) attachTo [_toObject, [-0.1, 0.1, 0.25], "Pelvis"]; - hideObjectGlobal (_connectorRopeHelpers select 0); + [(_connectorRopeHelpers select 0), true] remoteExec ["hideObjectGlobal", 2]; (_connectorRopeHelpers select 0) allowDamage false; }; case 1: { // Connect rope to Ground Spike Antenna @@ -47,13 +47,13 @@ if (_state) then { _connectorRopeHelpers set [0, _helper createVehicle position _fromObject]; (_connectorRopeHelpers select 0) disableCollisionWith _fromObject; (_connectorRopeHelpers select 0) setPos (position _fromObject); - hideObjectGlobal (_connectorRopeHelpers select 0); + [(_connectorRopeHelpers select 0), true] remoteExec ["hideObjectGlobal", 2]; (_connectorRopeHelpers select 0) allowDamage false; // Create helper object on player pelvis _connectorRopeHelpers set [1, _helper createVehicle position player]; (_connectorRopeHelpers select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; - hideObjectGlobal (_connectorRopeHelpers select 1); + [(_connectorRopeHelpers select 1), true] remoteExec ["hideObjectGlobal", 2]; (_connectorRopeHelpers select 1) allowDamage false; // Create Rope between helper objects @@ -64,13 +64,13 @@ if (_state) then { // Create helper object on radio owner _connectorRopeHelpers set [0, _helper createVehicle position _fromObject]; (_connectorRopeHelpers select 0) attachTo [_fromObject, [-0.1, 0.1, 0.15], "Pelvis"]; - hideObjectGlobal (_connectorRopeHelpers select 0); + [(_connectorRopeHelpers select 0), true] remoteExec ["hideObjectGlobal", 2]; (_connectorRopeHelpers select 0) allowDamage false; // Create helper object on player pelvis _connectorRopeHelpers set [1, _helper createVehicle position player]; (_connectorRopeHelpers select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; - hideObjectGlobal (_connectorRopeHelpers select 1); + [(_connectorRopeHelpers select 1), true] remoteExec ["hideObjectGlobal", 2]; (_connectorRopeHelpers select 1) allowDamage false; // Create Rope between helper objects From 9be34ab988ce448fc8f9e8154a9348c4aea91780 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Thu, 14 Mar 2024 15:18:35 +0100 Subject: [PATCH 21/37] Use passed parameter instead of defaulting to player --- addons/sys_core/fnc_handleConnectorRope.sqf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index b4638bd61..edbe6281d 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -51,8 +51,8 @@ if (_state) then { (_connectorRopeHelpers select 0) allowDamage false; // Create helper object on player pelvis - _connectorRopeHelpers set [1, _helper createVehicle position player]; - (_connectorRopeHelpers select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; + _connectorRopeHelpers set [1, _helper createVehicle position _toObject]; + (_connectorRopeHelpers select 1) attachTo [_toObject, [-0.1, 0.1, 0.15], "Pelvis"]; [(_connectorRopeHelpers select 1), true] remoteExec ["hideObjectGlobal", 2]; (_connectorRopeHelpers select 1) allowDamage false; @@ -68,8 +68,8 @@ if (_state) then { (_connectorRopeHelpers select 0) allowDamage false; // Create helper object on player pelvis - _connectorRopeHelpers set [1, _helper createVehicle position player]; - (_connectorRopeHelpers select 1) attachTo [player, [-0.1, 0.1, 0.15], "Pelvis"]; + _connectorRopeHelpers set [1, _helper createVehicle position _toObject]; + (_connectorRopeHelpers select 1) attachTo [_toObject, [-0.1, 0.1, 0.15], "Pelvis"]; [(_connectorRopeHelpers select 1), true] remoteExec ["hideObjectGlobal", 2]; (_connectorRopeHelpers select 1) allowDamage false; From c86bd4f250878c3944a4722faabb19b22444f95b Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sun, 17 Mar 2024 10:45:33 +0100 Subject: [PATCH 22/37] Delete rope via CBA Event if someone else picks up GSA --- addons/sys_core/XEH_postInit.sqf | 4 ++++ addons/sys_gsa/fnc_disconnectServer.sqf | 1 + 2 files changed, 5 insertions(+) diff --git a/addons/sys_core/XEH_postInit.sqf b/addons/sys_core/XEH_postInit.sqf index 3b2743aee..4945e6552 100644 --- a/addons/sys_core/XEH_postInit.sqf +++ b/addons/sys_core/XEH_postInit.sqf @@ -42,6 +42,10 @@ if (!GVAR(aceLoaded)) then { }] call CBA_fnc_addPlayerEventHandler; }; +[QGVAR(deleteConnectorRope), { + [false] call FUNC(handleConnectorRope); +}] call CBA_fnc_addEventHandler; + // Keybinds - PTT ["ACRE2", "AltPTTKey1", [localize LSTRING(AltPTTKey1), localize LSTRING(AltPTTKey1_description)], { [0] call FUNC(handleMultiPttKeyPress) diff --git a/addons/sys_gsa/fnc_disconnectServer.sqf b/addons/sys_gsa/fnc_disconnectServer.sqf index a5789d58a..d8277d26e 100644 --- a/addons/sys_gsa/fnc_disconnectServer.sqf +++ b/addons/sys_gsa/fnc_disconnectServer.sqf @@ -71,6 +71,7 @@ private _parentComponentClass = configFile >> "CfgAcreComponents" >> BASE_CLASS_ // The unit that disconnected the antenna is different from the unit that was connected to it private _text = format [localize LSTRING(disconnectedUnit), name _connectedUnit]; [QGVAR(notifyPlayer), [_text], _unit] call CBA_fnc_targetEvent; + [QEGVAR(sys_core,deleteConnectorRope), [], _unit] call CBA_fnc_targetEvent; }; }; }; From a1938f3ad4eb06aec4c462adf9f023571ec99566 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Sun, 17 Mar 2024 10:48:34 +0100 Subject: [PATCH 23/37] Hide Rope Helpers via CBA Server Events --- addons/sys_core/XEH_preInit.sqf | 7 +++++++ addons/sys_core/fnc_handleConnectorRope.sqf | 14 +++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/addons/sys_core/XEH_preInit.sqf b/addons/sys_core/XEH_preInit.sqf index b5210106c..23674e7ad 100644 --- a/addons/sys_core/XEH_preInit.sqf +++ b/addons/sys_core/XEH_preInit.sqf @@ -9,6 +9,13 @@ PREP_RECOMPILE_END; // CBA Settings #include "initSettings.inc.sqf" +if (isServer) then { + [QGVAR(hideConnectorRopeHelpers), { + params ["_ropeHelpers"]; + { hideObjectGlobal _x; } forEach _ropeHelpers; + }] call CBA_fnc_addEventHandler; +}; + if (!hasInterface) exitWith { ADDON = true; }; diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index edbe6281d..139cc9b5c 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -39,23 +39,26 @@ if (_state) then { _connectorRopeHelpers set [0, _helper createVehicle position _toObject]; [_connectorRopeHelpers select 0, [0, 0, 0]] ropeAttachTo _connectorRope; (_connectorRopeHelpers select 0) attachTo [_toObject, [-0.1, 0.1, 0.25], "Pelvis"]; - [(_connectorRopeHelpers select 0), true] remoteExec ["hideObjectGlobal", 2]; (_connectorRopeHelpers select 0) allowDamage false; + + // Hide Helper Object + [QGVAR(hideConnectorRopeHelpers), [_connectorRopeHelpers]] call CBA_fnc_serverEvent; }; case 1: { // Connect rope to Ground Spike Antenna // Create helper object on GSA _connectorRopeHelpers set [0, _helper createVehicle position _fromObject]; (_connectorRopeHelpers select 0) disableCollisionWith _fromObject; (_connectorRopeHelpers select 0) setPos (position _fromObject); - [(_connectorRopeHelpers select 0), true] remoteExec ["hideObjectGlobal", 2]; (_connectorRopeHelpers select 0) allowDamage false; // Create helper object on player pelvis _connectorRopeHelpers set [1, _helper createVehicle position _toObject]; (_connectorRopeHelpers select 1) attachTo [_toObject, [-0.1, 0.1, 0.15], "Pelvis"]; - [(_connectorRopeHelpers select 1), true] remoteExec ["hideObjectGlobal", 2]; (_connectorRopeHelpers select 1) allowDamage false; + // Hide Helper Objects + [QGVAR(hideConnectorRopeHelpers), [_connectorRopeHelpers]] call CBA_fnc_serverEvent; + // Create Rope between helper objects _connectorRope = ropeCreate [_connectorRopeHelpers select 0, _fromPoint, 5, nil, nil, QGVAR(connectorWire)]; [(_connectorRopeHelpers select 1), [0, 0, 0]] ropeAttachTo _connectorRope; @@ -64,15 +67,16 @@ if (_state) then { // Create helper object on radio owner _connectorRopeHelpers set [0, _helper createVehicle position _fromObject]; (_connectorRopeHelpers select 0) attachTo [_fromObject, [-0.1, 0.1, 0.15], "Pelvis"]; - [(_connectorRopeHelpers select 0), true] remoteExec ["hideObjectGlobal", 2]; (_connectorRopeHelpers select 0) allowDamage false; // Create helper object on player pelvis _connectorRopeHelpers set [1, _helper createVehicle position _toObject]; (_connectorRopeHelpers select 1) attachTo [_toObject, [-0.1, 0.1, 0.15], "Pelvis"]; - [(_connectorRopeHelpers select 1), true] remoteExec ["hideObjectGlobal", 2]; (_connectorRopeHelpers select 1) allowDamage false; + // Hide Helper Objects + [QGVAR(hideConnectorRopeHelpers), [_connectorRopeHelpers]] call CBA_fnc_serverEvent; + // Create Rope between helper objects _connectorRope = ropeCreate [_connectorRopeHelpers select 0, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; [_connectorRopeHelpers select 1, [0, 0, 0]] ropeAttachTo _connectorRope; From 0a23f6603eab844db14862bbafc36637ec0c78c0 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Tue, 26 Mar 2024 12:59:31 +0100 Subject: [PATCH 24/37] Use CBA Events for all GSA Rope Handling This seems like the best solution, due to the complexity of the GSA connection handling and the different ways connection can be influenced by remote players. --- addons/sys_core/XEH_postInit.sqf | 4 ---- addons/sys_core/XEH_preInit.sqf | 4 ++++ addons/sys_gsa/fnc_connect.sqf | 1 - addons/sys_gsa/fnc_connectServer.sqf | 1 + addons/sys_gsa/fnc_disconnect.sqf | 1 - addons/sys_gsa/fnc_disconnectServer.sqf | 4 +++- addons/sys_gsa/fnc_externalAntennaPFH.sqf | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/addons/sys_core/XEH_postInit.sqf b/addons/sys_core/XEH_postInit.sqf index 4945e6552..3b2743aee 100644 --- a/addons/sys_core/XEH_postInit.sqf +++ b/addons/sys_core/XEH_postInit.sqf @@ -42,10 +42,6 @@ if (!GVAR(aceLoaded)) then { }] call CBA_fnc_addPlayerEventHandler; }; -[QGVAR(deleteConnectorRope), { - [false] call FUNC(handleConnectorRope); -}] call CBA_fnc_addEventHandler; - // Keybinds - PTT ["ACRE2", "AltPTTKey1", [localize LSTRING(AltPTTKey1), localize LSTRING(AltPTTKey1_description)], { [0] call FUNC(handleMultiPttKeyPress) diff --git a/addons/sys_core/XEH_preInit.sqf b/addons/sys_core/XEH_preInit.sqf index 23674e7ad..cd9a54b95 100644 --- a/addons/sys_core/XEH_preInit.sqf +++ b/addons/sys_core/XEH_preInit.sqf @@ -16,6 +16,10 @@ if (isServer) then { }] call CBA_fnc_addEventHandler; }; +[QGVAR(handleConnectorRopeEvent), { + _this call FUNC(handleConnectorRope); +}] call CBA_fnc_addEventHandler; + if (!hasInterface) exitWith { ADDON = true; }; diff --git a/addons/sys_gsa/fnc_connect.sqf b/addons/sys_gsa/fnc_connect.sqf index 6b8bdf504..c13183e09 100644 --- a/addons/sys_gsa/fnc_connect.sqf +++ b/addons/sys_gsa/fnc_connect.sqf @@ -20,4 +20,3 @@ params ["_gsa", "_radioId"]; // Fire the event [QGVAR(connectGsa), [_gsa, _radioId, acre_player]] call CBA_fnc_serverEvent; -[true, 1, _gsa, player] call EFUNC(sys_core,handleConnectorRope); diff --git a/addons/sys_gsa/fnc_connectServer.sqf b/addons/sys_gsa/fnc_connectServer.sqf index 107d7806b..2fedd0211 100644 --- a/addons/sys_gsa/fnc_connectServer.sqf +++ b/addons/sys_gsa/fnc_connectServer.sqf @@ -38,6 +38,7 @@ _gsa setVariable [QGVAR(connectedRadio), _radioId, true]; [_radioId, "setState", ["externalAntennaConnected", [true, _gsa]]] call EFUNC(sys_data,dataEvent); [QGVAR(notifyPlayer), [localize LSTRING(connected)], _player] call CBA_fnc_targetEvent; +[QEGVAR(sys_core,handleConnectorRopeEvent), [true, 1, _gsa, _player], _player] call CBA_fnc_targetEvent; // Support for having several radios connected to GSA private _pfh = [DFUNC(externalAntennaPFH), 1.0, [_gsa, _radioId]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/sys_gsa/fnc_disconnect.sqf b/addons/sys_gsa/fnc_disconnect.sqf index 96d92b359..e4ac486e6 100644 --- a/addons/sys_gsa/fnc_disconnect.sqf +++ b/addons/sys_gsa/fnc_disconnect.sqf @@ -20,4 +20,3 @@ params ["_unit", "_gsa"]; // Fire the event [QGVAR(disconnectGsa), [_gsa, _unit]] call CBA_fnc_serverEvent; -[false] call EFUNC(sys_core,handleConnectorRope); diff --git a/addons/sys_gsa/fnc_disconnectServer.sqf b/addons/sys_gsa/fnc_disconnectServer.sqf index d8277d26e..67e9f3ca2 100644 --- a/addons/sys_gsa/fnc_disconnectServer.sqf +++ b/addons/sys_gsa/fnc_disconnectServer.sqf @@ -60,9 +60,11 @@ private _parentComponentClass = configFile >> "CfgAcreComponents" >> BASE_CLASS_ if (_connectedUnit isKindOf "CAManBase" || {crew _connectedUnit isNotEqualTo []}) then { if (_connectedUnit isKindOf "CAManBase") then { [QGVAR(notifyPlayer), [localize LSTRING(disconnected)], _connectedUnit] call CBA_fnc_targetEvent; + [QEGVAR(sys_core,handleConnectorRopeEvent), [false], _connectedUnit] call CBA_fnc_targetEvent; } else { { [QGVAR(notifyPlayer), [localize LSTRING(disconnected)], _connectedUnit] call CBA_fnc_targetEvent; + [QEGVAR(sys_core,handleConnectorRopeEvent), [false], _connectedUnit] call CBA_fnc_targetEvent; } forEach (crew _connectedUnit); }; }; @@ -71,7 +73,7 @@ private _parentComponentClass = configFile >> "CfgAcreComponents" >> BASE_CLASS_ // The unit that disconnected the antenna is different from the unit that was connected to it private _text = format [localize LSTRING(disconnectedUnit), name _connectedUnit]; [QGVAR(notifyPlayer), [_text], _unit] call CBA_fnc_targetEvent; - [QEGVAR(sys_core,deleteConnectorRope), [], _unit] call CBA_fnc_targetEvent; + [QEGVAR(sys_core,handleConnectorRopeEvent), [false], _unit] call CBA_fnc_targetEvent; }; }; }; diff --git a/addons/sys_gsa/fnc_externalAntennaPFH.sqf b/addons/sys_gsa/fnc_externalAntennaPFH.sqf index edb169804..ba4b37ff2 100644 --- a/addons/sys_gsa/fnc_externalAntennaPFH.sqf +++ b/addons/sys_gsa/fnc_externalAntennaPFH.sqf @@ -35,5 +35,5 @@ if ( || {(_unit distance _gsa) > ANTENNA_MAXDISTANCE} ) then { [QGVAR(disconnectGsa), [_gsa, _unit, _radioId]] call CBA_fnc_localEvent; - [false] call EFUNC(sys_core,handleConnectorRope); + [QEGVAR(sys_core,handleConnectorRopeEvent), [false]] call CBA_fnc_localEvent; }; From 32bb482ede1ed7e33eb2d72ee4580c922ac7ff13 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Thu, 28 Mar 2024 11:07:01 +0100 Subject: [PATCH 25/37] Fix desync when adding/removing mast on GSA Doing so would create a desync / double connection if someone else was connected to the GSA, that's because the code wouldn't run the disconnect/reconnect events on the previously connected player but only on the one triggering the interaction. --- addons/sys_gsa/fnc_handleMast.sqf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/sys_gsa/fnc_handleMast.sqf b/addons/sys_gsa/fnc_handleMast.sqf index 7e1a6005f..c7fc35ebf 100644 --- a/addons/sys_gsa/fnc_handleMast.sqf +++ b/addons/sys_gsa/fnc_handleMast.sqf @@ -21,9 +21,11 @@ if (_connectedRadio isEqualTo "") then { _connectedRadio = _gsa getVariable [QGVAR(connectedRadio), ""]; }; +private _connectedPlayer = [_connectedRadio] call EFUNC(sys_radio,getRadioObject); + // Temporarily disconnect the GSA from the radio if (_connectedRadio != "") then { - [_player, _gsa] call FUNC(disconnect); + [_connectedPlayer, _gsa] call FUNC(disconnect); }; // Delete the antenna @@ -43,5 +45,5 @@ if (_mountMast) then { // Reconnect the GSA to the radio if (_connectedRadio != "") then { - [_gsa, _connectedRadio] call FUNC(connect); + [QGVAR(connectGsa), [_gsa, _connectedRadio, _connectedPlayer]] call CBA_fnc_serverEvent; }; From 87f6d84eb13ac5cc6d9a53d0bf0a923695e5ec83 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Thu, 11 Apr 2024 15:13:29 +0200 Subject: [PATCH 26/37] Use CBA Events for Infantryphone Rope Handling --- addons/sys_intercom/fnc_updateInfantryPhoneStatus.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/sys_intercom/fnc_updateInfantryPhoneStatus.sqf b/addons/sys_intercom/fnc_updateInfantryPhoneStatus.sqf index a26ed46a2..f20744d71 100644 --- a/addons/sys_intercom/fnc_updateInfantryPhoneStatus.sqf +++ b/addons/sys_intercom/fnc_updateInfantryPhoneStatus.sqf @@ -32,7 +32,7 @@ switch (_action) do { _unit setVariable [QGVAR(vehicleInfantryPhone), nil, true]; // Destroy connector rope - [false] call EFUNC(sys_core,handleConnectorRope); + [QEGVAR(sys_core,handleConnectorRopeEvent), [false]] call CBA_fnc_localEvent; ACRE_PLAYER_INTERCOM = []; [[ICON_RADIO_CALL], [format [localize LSTRING(infantryPhoneDisconnected), _intercomText]], true] call CBA_fnc_notify; @@ -44,7 +44,7 @@ switch (_action) do { _unit setVariable [QGVAR(vehicleInfantryPhone), [_vehicle, _intercomNetwork], true]; // Create connector rope - [true, 0, _vehicle, _unit, _position] call EFUNC(sys_core,handleConnectorRope); + [QEGVAR(sys_core,handleConnectorRopeEvent), [true, 0, _vehicle, _unit, _position]] call CBA_fnc_localEvent; [[ICON_RADIO_CALL], [format [localize LSTRING(infantryPhoneConnected), _intercomText]], true] call CBA_fnc_notify; GVAR(intercomPFH) = [DFUNC(intercomPFH), 1.1, [acre_player, _vehicle]] call CBA_fnc_addPerFrameHandler; @@ -55,7 +55,7 @@ switch (_action) do { [GVAR(intercomPFH)] call CBA_fnc_removePerFrameHandler; // Destroy connector rope - [false] call EFUNC(sys_core,handleConnectorRope); + [QEGVAR(sys_core,handleConnectorRopeEvent), [false]] call CBA_fnc_localEvent; private _message = format [localize LSTRING(infantryPhoneReceived), _intercomText]; [QGVAR(giveInfantryPhone), [_vehicle, _unit, 1, _message, _intercomNetwork, _position], _unit] call CBA_fnc_targetEvent; From bd0877c66b8bc66ee239bcc6ad04c2e75f1f431b Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Thu, 11 Apr 2024 16:29:21 +0200 Subject: [PATCH 27/37] Shorten external radio rope to 1.2m --- addons/sys_core/fnc_handleConnectorRope.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index 139cc9b5c..6df839eae 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -78,7 +78,7 @@ if (_state) then { [QGVAR(hideConnectorRopeHelpers), [_connectorRopeHelpers]] call CBA_fnc_serverEvent; // Create Rope between helper objects - _connectorRope = ropeCreate [_connectorRopeHelpers select 0, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; + _connectorRope = ropeCreate [_connectorRopeHelpers select 0, _fromPoint, 1.2, nil, nil, QGVAR(connectorWire)]; [_connectorRopeHelpers select 1, [0, 0, 0]] ropeAttachTo _connectorRope; }; }; From b2b266afa70cda8630610b5cbd8d746f3fc608b8 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Thu, 11 Apr 2024 17:22:26 +0200 Subject: [PATCH 28/37] Fix implementation on external radios --- addons/sys_external/fnc_startUsingExternalRadio.sqf | 6 ++---- addons/sys_external/fnc_stopUsingExternalRadio.sqf | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/sys_external/fnc_startUsingExternalRadio.sqf b/addons/sys_external/fnc_startUsingExternalRadio.sqf index 9aa5105e1..c85fec4dd 100644 --- a/addons/sys_external/fnc_startUsingExternalRadio.sqf +++ b/addons/sys_external/fnc_startUsingExternalRadio.sqf @@ -37,9 +37,7 @@ ACRE_ACTIVE_EXTERNAL_RADIOS pushBackUnique _radioId; // Set it as active radio. [_radioId] call EFUNC(api,setCurrentRadio); -// If it's a manpack radio, visualize the connection with a connector rope -if ([_radio] call EFUNC(sys_radio,isManpackRadio)) then { - [true, 2, _owner, player] call EFUNC(sys_core,handleConnectorRope); -}; +// Visualize the connection with a connector rope +[QEGVAR(sys_core,handleConnectorRopeEvent), [true, 2, _owner, _endUser], _owner] call CBA_fnc_targetEvent; [[ICON_RADIO_CALL], [format [localize LSTRING(hintTake), _displayName, name _owner]], true] call CBA_fnc_notify; diff --git a/addons/sys_external/fnc_stopUsingExternalRadio.sqf b/addons/sys_external/fnc_stopUsingExternalRadio.sqf index 23bc42309..3e8648a2c 100644 --- a/addons/sys_external/fnc_stopUsingExternalRadio.sqf +++ b/addons/sys_external/fnc_stopUsingExternalRadio.sqf @@ -28,6 +28,9 @@ private _baseRadio = [_radioId] call EFUNC(api,getBaseRadio); private _displayName = getText (ConfigFile >> "CfgWeapons" >> _baseRadio >> "displayName"); [[ICON_RADIO_CALL], [format [localize LSTRING(hintReturn), _displayName, name _owner]], true] call CBA_fnc_notify; +// Destroy Rope +[QEGVAR(sys_core,handleConnectorRopeEvent), [false], _owner] call CBA_fnc_targetEvent; + if (_target == _owner) then { // Handle remote owner private _message = format [localize LSTRING(hintReturnOwner), name ([_radioId] call FUNC(getExternalRadioUser)), _displayName]; From 9d8272d3ddc861db88b70810320e5b7415aa4614 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Tue, 23 Apr 2024 12:54:24 +0200 Subject: [PATCH 29/37] Handle External Radio Rope on the user instead of the owner This is to prevent issues in the case of the radio owner being connected to a GSA while sharing his radio. --- addons/sys_external/fnc_startUsingExternalRadio.sqf | 2 +- addons/sys_external/fnc_stopUsingExternalRadio.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sys_external/fnc_startUsingExternalRadio.sqf b/addons/sys_external/fnc_startUsingExternalRadio.sqf index c85fec4dd..2210b76d4 100644 --- a/addons/sys_external/fnc_startUsingExternalRadio.sqf +++ b/addons/sys_external/fnc_startUsingExternalRadio.sqf @@ -38,6 +38,6 @@ ACRE_ACTIVE_EXTERNAL_RADIOS pushBackUnique _radioId; [_radioId] call EFUNC(api,setCurrentRadio); // Visualize the connection with a connector rope -[QEGVAR(sys_core,handleConnectorRopeEvent), [true, 2, _owner, _endUser], _owner] call CBA_fnc_targetEvent; +[QEGVAR(sys_core,handleConnectorRopeEvent), [true, 2, _owner, _endUser]] call CBA_fnc_localEvent; [[ICON_RADIO_CALL], [format [localize LSTRING(hintTake), _displayName, name _owner]], true] call CBA_fnc_notify; diff --git a/addons/sys_external/fnc_stopUsingExternalRadio.sqf b/addons/sys_external/fnc_stopUsingExternalRadio.sqf index 3e8648a2c..60228f297 100644 --- a/addons/sys_external/fnc_stopUsingExternalRadio.sqf +++ b/addons/sys_external/fnc_stopUsingExternalRadio.sqf @@ -29,7 +29,7 @@ private _displayName = getText (ConfigFile >> "CfgWeapons" >> _baseRadio >> "dis [[ICON_RADIO_CALL], [format [localize LSTRING(hintReturn), _displayName, name _owner]], true] call CBA_fnc_notify; // Destroy Rope -[QEGVAR(sys_core,handleConnectorRopeEvent), [false], _owner] call CBA_fnc_targetEvent; +[QEGVAR(sys_core,handleConnectorRopeEvent), [false]] call CBA_fnc_localEvent; if (_target == _owner) then { // Handle remote owner From 4c2d98486cd6c3f3fecbe49cb1ceb7da20e0f201 Mon Sep 17 00:00:00 2001 From: Fabio Schick <58027418+mrschick@users.noreply.github.com> Date: Wed, 3 Jul 2024 09:50:53 +0200 Subject: [PATCH 30/37] Reword Translation Co-authored-by: Mike-MF --- addons/sys_intercom/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sys_intercom/stringtable.xml b/addons/sys_intercom/stringtable.xml index 4dd80b585..15b9d2886 100644 --- a/addons/sys_intercom/stringtable.xml +++ b/addons/sys_intercom/stringtable.xml @@ -152,7 +152,7 @@ Piyade Telefonu Alındı %1 - Infantry Phone used by someone else + Infantry Phone already in use Hörer wird gerade benutzt Telefono fanteria preso da qualcuno From 517de6eaf3c2fa9eadd87e7682df0d0ec9fe32ae Mon Sep 17 00:00:00 2001 From: Fabio Schick <58027418+mrschick@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:37:49 +0200 Subject: [PATCH 31/37] Apply suggestions from code review Co-authored-by: jonpas --- addons/sys_core/XEH_preInit.sqf | 4 +--- addons/sys_core/data/wire.cfg | 2 +- addons/sys_gestures/stringtable.xml | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/addons/sys_core/XEH_preInit.sqf b/addons/sys_core/XEH_preInit.sqf index cd9a54b95..7f1f166b8 100644 --- a/addons/sys_core/XEH_preInit.sqf +++ b/addons/sys_core/XEH_preInit.sqf @@ -16,9 +16,7 @@ if (isServer) then { }] call CBA_fnc_addEventHandler; }; -[QGVAR(handleConnectorRopeEvent), { - _this call FUNC(handleConnectorRope); -}] call CBA_fnc_addEventHandler; +[QGVAR(handleConnectorRopeEvent), FUNC(handleConnectorRope)] call CBA_fnc_addEventHandler; if (!hasInterface) exitWith { ADDON = true; diff --git a/addons/sys_core/data/wire.cfg b/addons/sys_core/data/wire.cfg index 65ae22011..8b31f5e83 100644 --- a/addons/sys_core/data/wire.cfg +++ b/addons/sys_core/data/wire.cfg @@ -4,4 +4,4 @@ class CfgModels { sections[] = {"rope"}; skeletonName = ""; }; -}; \ No newline at end of file +}; diff --git a/addons/sys_gestures/stringtable.xml b/addons/sys_gestures/stringtable.xml index e5bce8293..538ba2ac0 100644 --- a/addons/sys_gestures/stringtable.xml +++ b/addons/sys_gestures/stringtable.xml @@ -47,7 +47,7 @@ Usar rádios irá impedir a mira - Show connector wires + Show Connector Wires Zeige verbindungskabel Mostra cavi di collegamento From 41daddd6a5e70e2271082a7b750de9db8d2b7b59 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Wed, 28 Aug 2024 20:09:02 +0200 Subject: [PATCH 32/37] Drop unused argument --- addons/sys_core/fnc_handleConnectorRope.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index 6df839eae..eed69599e 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -37,7 +37,7 @@ if (_state) then { // Create helper object on player pelvis _connectorRopeHelpers set [0, _helper createVehicle position _toObject]; - [_connectorRopeHelpers select 0, [0, 0, 0]] ropeAttachTo _connectorRope; + (_connectorRopeHelpers select 0) ropeAttachTo _connectorRope; (_connectorRopeHelpers select 0) attachTo [_toObject, [-0.1, 0.1, 0.25], "Pelvis"]; (_connectorRopeHelpers select 0) allowDamage false; @@ -61,7 +61,7 @@ if (_state) then { // Create Rope between helper objects _connectorRope = ropeCreate [_connectorRopeHelpers select 0, _fromPoint, 5, nil, nil, QGVAR(connectorWire)]; - [(_connectorRopeHelpers select 1), [0, 0, 0]] ropeAttachTo _connectorRope; + (_connectorRopeHelpers select 1) ropeAttachTo _connectorRope; }; case 2: { // Connect rope to shared backpack radio owner // Create helper object on radio owner From 9c8972071a856c5c32564ac8d6e88540e6c8b222 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Wed, 28 Aug 2024 20:09:37 +0200 Subject: [PATCH 33/37] More appropriate init value --- addons/sys_core/fnc_handleConnectorRope.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index eed69599e..348e5956b 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -28,7 +28,7 @@ private _helper = QGVAR(connectorHelper); if (_state) then { private _connectorRopeHelpers = []; - private _connectorRope = ""; + private _connectorRope = objNull; switch (_type) do { case 0: { // Connect rope to Infantry Phone From 692689155eb62bd68d963ef246c709af8aab9246 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Wed, 28 Aug 2024 20:11:54 +0200 Subject: [PATCH 34/37] Remove External Radio Rope handling Unfeasible due to engine limitations, which prevent global attachment of a rope if its start is on an object that is attachTo-ed a player unit. --- addons/sys_core/fnc_handleConnectorRope.sqf | 18 ------------------ .../fnc_startUsingExternalRadio.sqf | 3 --- .../fnc_stopUsingExternalRadio.sqf | 3 --- 3 files changed, 24 deletions(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index 348e5956b..bbf52666e 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -63,24 +63,6 @@ if (_state) then { _connectorRope = ropeCreate [_connectorRopeHelpers select 0, _fromPoint, 5, nil, nil, QGVAR(connectorWire)]; (_connectorRopeHelpers select 1) ropeAttachTo _connectorRope; }; - case 2: { // Connect rope to shared backpack radio owner - // Create helper object on radio owner - _connectorRopeHelpers set [0, _helper createVehicle position _fromObject]; - (_connectorRopeHelpers select 0) attachTo [_fromObject, [-0.1, 0.1, 0.15], "Pelvis"]; - (_connectorRopeHelpers select 0) allowDamage false; - - // Create helper object on player pelvis - _connectorRopeHelpers set [1, _helper createVehicle position _toObject]; - (_connectorRopeHelpers select 1) attachTo [_toObject, [-0.1, 0.1, 0.15], "Pelvis"]; - (_connectorRopeHelpers select 1) allowDamage false; - - // Hide Helper Objects - [QGVAR(hideConnectorRopeHelpers), [_connectorRopeHelpers]] call CBA_fnc_serverEvent; - - // Create Rope between helper objects - _connectorRope = ropeCreate [_connectorRopeHelpers select 0, _fromPoint, 1.2, nil, nil, QGVAR(connectorWire)]; - [_connectorRopeHelpers select 1, [0, 0, 0]] ropeAttachTo _connectorRope; - }; }; GVAR(connectorRope) = _connectorRope; diff --git a/addons/sys_external/fnc_startUsingExternalRadio.sqf b/addons/sys_external/fnc_startUsingExternalRadio.sqf index 2210b76d4..aa9d76abf 100644 --- a/addons/sys_external/fnc_startUsingExternalRadio.sqf +++ b/addons/sys_external/fnc_startUsingExternalRadio.sqf @@ -37,7 +37,4 @@ ACRE_ACTIVE_EXTERNAL_RADIOS pushBackUnique _radioId; // Set it as active radio. [_radioId] call EFUNC(api,setCurrentRadio); -// Visualize the connection with a connector rope -[QEGVAR(sys_core,handleConnectorRopeEvent), [true, 2, _owner, _endUser]] call CBA_fnc_localEvent; - [[ICON_RADIO_CALL], [format [localize LSTRING(hintTake), _displayName, name _owner]], true] call CBA_fnc_notify; diff --git a/addons/sys_external/fnc_stopUsingExternalRadio.sqf b/addons/sys_external/fnc_stopUsingExternalRadio.sqf index 60228f297..23bc42309 100644 --- a/addons/sys_external/fnc_stopUsingExternalRadio.sqf +++ b/addons/sys_external/fnc_stopUsingExternalRadio.sqf @@ -28,9 +28,6 @@ private _baseRadio = [_radioId] call EFUNC(api,getBaseRadio); private _displayName = getText (ConfigFile >> "CfgWeapons" >> _baseRadio >> "displayName"); [[ICON_RADIO_CALL], [format [localize LSTRING(hintReturn), _displayName, name _owner]], true] call CBA_fnc_notify; -// Destroy Rope -[QEGVAR(sys_core,handleConnectorRopeEvent), [false]] call CBA_fnc_localEvent; - if (_target == _owner) then { // Handle remote owner private _message = format [localize LSTRING(hintReturnOwner), name ([_radioId] call FUNC(getExternalRadioUser)), _displayName]; From 5e10245e04add41cfae72b233d7de0cfb23674b8 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Wed, 28 Aug 2024 20:20:30 +0200 Subject: [PATCH 35/37] Use defined value instead of "constant" var --- addons/sys_core/fnc_handleConnectorRope.sqf | 8 +++----- addons/sys_core/script_component.hpp | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index bbf52666e..d375810a2 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -24,8 +24,6 @@ params ["_state", ["_type", 0], ["_fromObject", objNull], ["_toObject", objNull] if (!EGVAR(sys_gestures,showConnectorRopes)) exitWith {}; -private _helper = QGVAR(connectorHelper); - if (_state) then { private _connectorRopeHelpers = []; private _connectorRope = objNull; @@ -36,7 +34,7 @@ if (_state) then { _connectorRope = ropeCreate [_fromObject, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; // Create helper object on player pelvis - _connectorRopeHelpers set [0, _helper createVehicle position _toObject]; + _connectorRopeHelpers set [0, ROPE_HELPER createVehicle position _toObject]; (_connectorRopeHelpers select 0) ropeAttachTo _connectorRope; (_connectorRopeHelpers select 0) attachTo [_toObject, [-0.1, 0.1, 0.25], "Pelvis"]; (_connectorRopeHelpers select 0) allowDamage false; @@ -46,13 +44,13 @@ if (_state) then { }; case 1: { // Connect rope to Ground Spike Antenna // Create helper object on GSA - _connectorRopeHelpers set [0, _helper createVehicle position _fromObject]; + _connectorRopeHelpers set [0, ROPE_HELPER createVehicle position _fromObject]; (_connectorRopeHelpers select 0) disableCollisionWith _fromObject; (_connectorRopeHelpers select 0) setPos (position _fromObject); (_connectorRopeHelpers select 0) allowDamage false; // Create helper object on player pelvis - _connectorRopeHelpers set [1, _helper createVehicle position _toObject]; + _connectorRopeHelpers set [1, ROPE_HELPER createVehicle position _toObject]; (_connectorRopeHelpers select 1) attachTo [_toObject, [-0.1, 0.1, 0.15], "Pelvis"]; (_connectorRopeHelpers select 1) allowDamage false; diff --git a/addons/sys_core/script_component.hpp b/addons/sys_core/script_component.hpp index 10e5b6de5..bb58cccb5 100644 --- a/addons/sys_core/script_component.hpp +++ b/addons/sys_core/script_component.hpp @@ -25,3 +25,5 @@ #define NEAR_RADIO_RANGE 150 #define ZEUS_INTERFACE_DISPLAY 312 + +#define ROPE_HELPER QGVAR(connectorHelper) From 87b8ee83fdd00944fa6c25a834a79df9200f98dd Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Wed, 28 Aug 2024 22:00:46 +0200 Subject: [PATCH 36/37] Fix Intercom Passing --- addons/sys_core/fnc_handleConnectorRope.sqf | 11 +++++++++++ addons/sys_intercom/XEH_postInit.sqf | 2 +- .../sys_intercom/fnc_infantryPhoneChildrenActions.sqf | 6 ++++-- addons/sys_intercom/fnc_updateInfantryPhoneStatus.sqf | 3 ++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index d375810a2..03d81f8df 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -30,6 +30,17 @@ if (_state) then { switch (_type) do { case 0: { // Connect rope to Infantry Phone + // If _fromPoint could not be provided by the intercom passing action, fetch it again from config + if (_fromPoint isEqualTo [-1]) then { + private _positionConfig = configFile >> "CfgVehicles" >> typeOf _fromObject >> "acre_infantryPhonePosition"; + if (isText _positionConfig) then { + _fromPoint = _target selectionPosition (getText _positionConfig); // Convert to coordinates for sys_core intercomPFH checks + }; + if (isArray _positionConfig) then { + _fromPoint = getArray _positionConfig; + }; + }; + // Create Rope _connectorRope = ropeCreate [_fromObject, _fromPoint, 3, nil, nil, QGVAR(connectorWire)]; diff --git a/addons/sys_intercom/XEH_postInit.sqf b/addons/sys_intercom/XEH_postInit.sqf index 9286737d5..f18d22828 100644 --- a/addons/sys_intercom/XEH_postInit.sqf +++ b/addons/sys_intercom/XEH_postInit.sqf @@ -69,7 +69,7 @@ if (!hasInterface) exitWith {}; }, true] call CBA_fnc_addPlayerEventHandler; [QGVAR(giveInfantryPhone), { - params ["_vehicle", "_unit", "_action", "_message", ["_intercomNetwork", INTERCOM_DISCONNECTED], ["_position", objNull]]; + params ["_vehicle", "_unit", "_action", "_message", ["_intercomNetwork", INTERCOM_DISCONNECTED], ["_position", [0, 0, 0]]]; [[ICON_RADIO_CALL], [_message]] call CBA_fnc_notify; [_vehicle, _unit, _action, _intercomNetwork, objNull, _position] call FUNC(updateInfantryPhoneStatus); }] call CBA_fnc_addEventHandler; diff --git a/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf b/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf index ca6618e4c..43aaa24b8 100644 --- a/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf +++ b/addons/sys_intercom/fnc_infantryPhoneChildrenActions.sqf @@ -4,7 +4,9 @@ * Generates a list of actions for using vehicle intercoms externally. * * Arguments: - * 0: Vehicle/Unit + * 0: Vehicle/Unit target of interaction + * 1: Unit interacting with target + * 2: Relative position of the infantry phone interaction on the vehicle (default: [0, 0, 0]) * * Return Value: * Array of actions @@ -37,7 +39,7 @@ if (_target isKindOf "CAManBase") then { _params params ["_intercomNetwork"]; //USES_VARIABLES ["_target", "_player"]; - [_player getVariable [QGVAR(vehicleInfantryPhone), [objNull, INTERCOM_DISCONNECTED]] select 0, _target, 2, _intercomNetwork, _player, _position] call FUNC(updateInfantryPhoneStatus) + [_player getVariable [QGVAR(vehicleInfantryPhone), [objNull, INTERCOM_DISCONNECTED]] select 0, _target, 2, _intercomNetwork, _player, [-1]] call FUNC(updateInfantryPhoneStatus) }, {true}, {}, diff --git a/addons/sys_intercom/fnc_updateInfantryPhoneStatus.sqf b/addons/sys_intercom/fnc_updateInfantryPhoneStatus.sqf index f20744d71..674af4e63 100644 --- a/addons/sys_intercom/fnc_updateInfantryPhoneStatus.sqf +++ b/addons/sys_intercom/fnc_updateInfantryPhoneStatus.sqf @@ -9,6 +9,7 @@ * 2: Type of action * 3: Intercom network * 4: Unit giving the infantry phone (default: objNull) + * 5: Relative position of the infantry phone interaction on the vehicle (default: [0, 0, 0]) * * Return Value: * None @@ -20,7 +21,7 @@ * Public: No */ -params ["_vehicle", "_unit", "_action", "_intercomNetwork", ["_givingUnit", objNull, [objNull]], ["_position", objNull]]; +params ["_vehicle", "_unit", "_action", "_intercomNetwork", ["_givingUnit", objNull, [objNull]], ["_position", [0, 0, 0]]]; private _intercomName = ((_vehicle getVariable [QGVAR(intercomNames), []]) select _intercomNetwork) select 1; private _intercomText = format ["( %1 )", _intercomName]; From f2b3e0b00fc377bc31d9f55773ed0163deab8f43 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Wed, 28 Aug 2024 22:12:54 +0200 Subject: [PATCH 37/37] Prevent multiple rope creation, destroy previous --- addons/sys_core/XEH_preInit.sqf | 2 +- addons/sys_core/fnc_handleConnectorRope.sqf | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/sys_core/XEH_preInit.sqf b/addons/sys_core/XEH_preInit.sqf index 7f1f166b8..2e2b0be49 100644 --- a/addons/sys_core/XEH_preInit.sqf +++ b/addons/sys_core/XEH_preInit.sqf @@ -56,7 +56,7 @@ DGVAR(pttKeyDown) = false; DGVAR(speaking_cache_valid) = false; DGVAR(connectorRope) = objNull; -DGVAR(connectorRopeHelpers) = []; +DGVAR(connectorRopeHelpers) = [objNull, objNull]; DVAR(ACRE_SPIT_VERSION) = false; DVAR(ACRE_IS_SYNCING) = false; diff --git a/addons/sys_core/fnc_handleConnectorRope.sqf b/addons/sys_core/fnc_handleConnectorRope.sqf index 03d81f8df..24b64f452 100644 --- a/addons/sys_core/fnc_handleConnectorRope.sqf +++ b/addons/sys_core/fnc_handleConnectorRope.sqf @@ -25,6 +25,11 @@ params ["_state", ["_type", 0], ["_fromObject", objNull], ["_toObject", objNull] if (!EGVAR(sys_gestures,showConnectorRopes)) exitWith {}; if (_state) then { + // Destroy any previous connector rope and helpers + if (!isNull GVAR(connectorRope) || {GVAR(connectorRopeHelpers) isNotEqualTo [objNull, objNull]}) then { + [false] call FUNC(handleConnectorRope); + }; + private _connectorRopeHelpers = []; private _connectorRope = objNull;