From 55df5ec04eebd4f75a9c241b1ac85f7708223e06 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Wed, 24 Feb 2021 22:01:27 -0500 Subject: [PATCH 01/15] deep paste to hc Add setting to toggle hc checking Deep paste checks for hc with minimum group count on which to spawn deep-pasted entities --- addons/common/XEH_postInit.sqf | 4 +++ .../functions/fnc_deserializeObjects.sqf | 29 ++++++++++++++++++- addons/editor/initKeybinds.sqf | 2 +- addons/editor/initSettings.sqf | 9 ++++++ addons/editor/stringtable.xml | 6 ++++ 5 files changed, 48 insertions(+), 2 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 99feea14b..ac580a0bb 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -391,4 +391,8 @@ if (isServer) then { [QGVAR(createZeus), LINKFUNC(createZeus)] call CBA_fnc_addEventHandler; [QGVAR(deserializeObjects), LINKFUNC(deserializeObjects)] call CBA_fnc_addEventHandler; +} else { + if !(hasInterface) then { + [QGVAR(deserializeObjects), LINKFUNC(deserializeObjects)] call CBA_fnc_addEventHandler; + }; }; diff --git a/addons/common/functions/fnc_deserializeObjects.sqf b/addons/common/functions/fnc_deserializeObjects.sqf index 8d3b3e1f2..c042d878b 100644 --- a/addons/common/functions/fnc_deserializeObjects.sqf +++ b/addons/common/functions/fnc_deserializeObjects.sqf @@ -9,6 +9,7 @@ * 1: Center Position * 2: Make Editable (default: true) * 3: Randomization (default: false) + * 4: Use Headless Client (default: true) * * Return Value: * Created Objects @@ -19,9 +20,35 @@ * Public: No */ -params [["_serializedData", [], [[]]], ["_centerPos", [0, 0, 0], [[]], [2, 3]], ["_makeEditable", true, [true]], ["_enableRandomization", false, [true]]]; +params [["_serializedData", [], [[]]], ["_centerPos", [0, 0, 0], [[]], [2, 3]], ["_makeEditable", true, [true]], ["_enableRandomization", false, [true]], ["_useHC", true, [true]]]; _serializedData params [["_objectData", [], [[]]], ["_groupData", [], [[]]]]; +// Check for suitable Headless Client +private _HCs = []; +private _HCIDs = []; +private _HCLoad = []; +if (isServer && {_useHC}) then { + { + if (_x isKindOf "HeadlessClient_F") then { + _HCs pushBack _x; + _HCIDs pushBack owner _x; + _HCLoad pushBack 0; + }; + } forEach allPlayers; +}; +if (_HCIDs isNotEqualTo []) exitWith { + // Count HC local groups + { + private _HCIndex = _HCIDs find groupOwner _x; + if (_HCIndex > -1) then { + private _groupCount = _HCLoad select _HCIndex; + _HCLoad set [_HCIndex, _groupCount + 1]; + }; + } forEach allGroups; + private _minLoadHC = _HCs select (_HCLoad find selectMin _HCLoad); + [QEGVAR(common,deserializeObjects), _this, _minLoadHC] call CBA_fnc_targetEvent; +}; + // Set center position to ground level over land and water level over the ocean // Serialized object data offsets are relative to AGL height 0 _centerPos set [2, 0]; diff --git a/addons/editor/initKeybinds.sqf b/addons/editor/initKeybinds.sqf index 1b95979d3..c0e99aadd 100644 --- a/addons/editor/initKeybinds.sqf +++ b/addons/editor/initKeybinds.sqf @@ -59,7 +59,7 @@ [ELSTRING(main,DisplayName), QGVAR(deepPaste), [LSTRING(DeepPaste), LSTRING(DeepPaste_Description)], { if (!isNull curatorCamera && {!GETMVAR(RscDisplayCurator_search,false)}) then { private _position = [nil, false] call EFUNC(common,getPosFromScreen); - [QEGVAR(common,deserializeObjects), [GVAR(clipboard), _position, true, GVAR(randomizeCopyPaste)]] call CBA_fnc_serverEvent; + [QEGVAR(common,deserializeObjects), [GVAR(clipboard), _position, true, GVAR(randomizeCopyPaste), GVAR(deepPasteHC)]] call CBA_fnc_serverEvent; playSound ["RscDisplayCurator_error01", true]; diff --git a/addons/editor/initSettings.sqf b/addons/editor/initSettings.sqf index 82e980d64..595844126 100644 --- a/addons/editor/initSettings.sqf +++ b/addons/editor/initSettings.sqf @@ -52,6 +52,15 @@ false ] call CBA_fnc_addSetting; +[ + QGVAR(deepPasteHC), + "CHECKBOX", + [LSTRING(DeepPasteHC), LSTRING(DeepPasteHC_Description)], + [ELSTRING(main,DisplayName), LSTRING(DisplayName)], + true, + false +] call CBA_fnc_addSetting; + [ QGVAR(unitRadioMessages), "LIST", diff --git a/addons/editor/stringtable.xml b/addons/editor/stringtable.xml index 724ac9b8b..f5819a50f 100644 --- a/addons/editor/stringtable.xml +++ b/addons/editor/stringtable.xml @@ -196,6 +196,12 @@ Fügt die derzeitig gespeicherte komplette Kopie ein. Wkleja z schowka obiekty które zostały głęboko skopiowane. + + Deep Paste On Headless Client + + + Deep-copied entities will be sent to headless client(s) if available, avoiding subsequent transfer. + Focus Search Bar Suchfeld fokussieren From 721520508aebe38652960194ac3ddb8b68b9a59b Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Thu, 25 Feb 2021 23:59:06 -0500 Subject: [PATCH 02/15] separate fnc for hc w fewest groups --- addons/common/XEH_PREP.hpp | 1 + .../functions/fnc_deserializeObjects.sqf | 26 ++--------- .../functions/fnc_getFewestGroupsHC.sqf | 43 +++++++++++++++++++ 3 files changed, 47 insertions(+), 23 deletions(-) create mode 100644 addons/common/functions/fnc_getFewestGroupsHC.sqf diff --git a/addons/common/XEH_PREP.hpp b/addons/common/XEH_PREP.hpp index f0d9f718e..736398f3f 100644 --- a/addons/common/XEH_PREP.hpp +++ b/addons/common/XEH_PREP.hpp @@ -19,6 +19,7 @@ PREP(getArtilleryETA); PREP(getCargoPositionsCount); PREP(getDefaultInventory); PREP(getDLC); +PREP(getFewestGroupsHC); PREP(getLightingSelections); PREP(getPhoneticName); PREP(getPlayers); diff --git a/addons/common/functions/fnc_deserializeObjects.sqf b/addons/common/functions/fnc_deserializeObjects.sqf index c042d878b..37b5ecf51 100644 --- a/addons/common/functions/fnc_deserializeObjects.sqf +++ b/addons/common/functions/fnc_deserializeObjects.sqf @@ -24,29 +24,9 @@ params [["_serializedData", [], [[]]], ["_centerPos", [0, 0, 0], [[]], [2, 3]], _serializedData params [["_objectData", [], [[]]], ["_groupData", [], [[]]]]; // Check for suitable Headless Client -private _HCs = []; -private _HCIDs = []; -private _HCLoad = []; -if (isServer && {_useHC}) then { - { - if (_x isKindOf "HeadlessClient_F") then { - _HCs pushBack _x; - _HCIDs pushBack owner _x; - _HCLoad pushBack 0; - }; - } forEach allPlayers; -}; -if (_HCIDs isNotEqualTo []) exitWith { - // Count HC local groups - { - private _HCIndex = _HCIDs find groupOwner _x; - if (_HCIndex > -1) then { - private _groupCount = _HCLoad select _HCIndex; - _HCLoad set [_HCIndex, _groupCount + 1]; - }; - } forEach allGroups; - private _minLoadHC = _HCs select (_HCLoad find selectMin _HCLoad); - [QEGVAR(common,deserializeObjects), _this, _minLoadHC] call CBA_fnc_targetEvent; +private _HC = [] call FUNC(getFewestGroupsHC); +if !(isNull _HC) exitWith { + [QEGVAR(common,deserializeObjects), _this, _HC] call CBA_fnc_targetEvent; }; // Set center position to ground level over land and water level over the ocean diff --git a/addons/common/functions/fnc_getFewestGroupsHC.sqf b/addons/common/functions/fnc_getFewestGroupsHC.sqf new file mode 100644 index 000000000..6ef37d86f --- /dev/null +++ b/addons/common/functions/fnc_getFewestGroupsHC.sqf @@ -0,0 +1,43 @@ +#include "script_component.hpp" +/* + * Author: Ampersand + * Returns HC with fewest groups, if available. + * + * Arguments: + * None + * + * Return Value: + * Headless Client + * + * Example: + * [] call zen_common_fnc_getFewestGroupsHC + * + * Public: No + */ + +if !(isServer) exitWith {objNull}; + +private _HCs = []; +private _HCIDs = []; +private _HCLoad = []; + +{ + if (_x isKindOf "HeadlessClient_F") then { + _HCs pushBack _x; + _HCIDs pushBack owner _x; + _HCLoad pushBack 0; + }; +} forEach allPlayers; + +if (_HCIDs isEqualTo []) exitWith {objNull}; + +// Count local groups for each HC +{ + private _HCIndex = _HCIDs find groupOwner _x; + if (_HCIndex > -1) then { + private _groupCount = _HCLoad select _HCIndex; + _HCLoad set [_HCIndex, _groupCount + 1]; + }; +} forEach allGroups; + +_HCs select (_HCLoad find selectMin _HCLoad) From 2c7fc76c30ad86eea683c3efd82f531fb487d62c Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 26 Feb 2021 09:24:39 -0500 Subject: [PATCH 03/15] skip allGroups check for single HC --- .../functions/fnc_getFewestGroupsHC.sqf | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/addons/common/functions/fnc_getFewestGroupsHC.sqf b/addons/common/functions/fnc_getFewestGroupsHC.sqf index 6ef37d86f..53ae0ce01 100644 --- a/addons/common/functions/fnc_getFewestGroupsHC.sqf +++ b/addons/common/functions/fnc_getFewestGroupsHC.sqf @@ -29,15 +29,23 @@ private _HCLoad = []; }; } forEach allPlayers; -if (_HCIDs isEqualTo []) exitWith {objNull}; - -// Count local groups for each HC -{ - private _HCIndex = _HCIDs find groupOwner _x; - if (_HCIndex > -1) then { - private _groupCount = _HCLoad select _HCIndex; - _HCLoad set [_HCIndex, _groupCount + 1]; +switch (count _HCIDs) do { + case (0): { + objNull }; -} forEach allGroups; + case (1): { + _HCIDs select 0; + }; + default { + // Count local groups for each HC + { + private _HCIndex = _HCIDs find groupOwner _x; + if (_HCIndex > -1) then { + private _groupCount = _HCLoad select _HCIndex; + _HCLoad set [_HCIndex, _groupCount + 1]; + }; + } forEach allGroups; -_HCs select (_HCLoad find selectMin _HCLoad) + _HCs select (_HCLoad find selectMin _HCLoad) + }; +}; From 15018921f5b2f8b8dda3bedf45a6bbf1d5bc8a40 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Fri, 5 Mar 2021 20:55:25 -0500 Subject: [PATCH 04/15] lower case hc --- .../functions/fnc_deserializeObjects.sqf | 6 ++--- .../functions/fnc_getFewestGroupsHC.sqf | 26 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/addons/common/functions/fnc_deserializeObjects.sqf b/addons/common/functions/fnc_deserializeObjects.sqf index 37b5ecf51..0eb685ef2 100644 --- a/addons/common/functions/fnc_deserializeObjects.sqf +++ b/addons/common/functions/fnc_deserializeObjects.sqf @@ -24,9 +24,9 @@ params [["_serializedData", [], [[]]], ["_centerPos", [0, 0, 0], [[]], [2, 3]], _serializedData params [["_objectData", [], [[]]], ["_groupData", [], [[]]]]; // Check for suitable Headless Client -private _HC = [] call FUNC(getFewestGroupsHC); -if !(isNull _HC) exitWith { - [QEGVAR(common,deserializeObjects), _this, _HC] call CBA_fnc_targetEvent; +private _hc = [] call FUNC(getFewestGroupsHC); +if !(isNull _hc) exitWith { + [QEGVAR(common,deserializeObjects), _this, _hc] call CBA_fnc_targetEvent; }; // Set center position to ground level over land and water level over the ocean diff --git a/addons/common/functions/fnc_getFewestGroupsHC.sqf b/addons/common/functions/fnc_getFewestGroupsHC.sqf index 53ae0ce01..1ebf28f72 100644 --- a/addons/common/functions/fnc_getFewestGroupsHC.sqf +++ b/addons/common/functions/fnc_getFewestGroupsHC.sqf @@ -17,35 +17,35 @@ if !(isServer) exitWith {objNull}; -private _HCs = []; -private _HCIDs = []; -private _HCLoad = []; +private _hcs = []; +private _hcIDs = []; +private _hcLoad = []; { if (_x isKindOf "HeadlessClient_F") then { - _HCs pushBack _x; - _HCIDs pushBack owner _x; - _HCLoad pushBack 0; + _hcs pushBack _x; + _hcIDs pushBack owner _x; + _hcLoad pushBack 0; }; } forEach allPlayers; -switch (count _HCIDs) do { +switch (count _hcIDs) do { case (0): { objNull }; case (1): { - _HCIDs select 0; + _hcIDs select 0; }; default { // Count local groups for each HC { - private _HCIndex = _HCIDs find groupOwner _x; - if (_HCIndex > -1) then { - private _groupCount = _HCLoad select _HCIndex; - _HCLoad set [_HCIndex, _groupCount + 1]; + private _hcIndex = _hcIDs find groupOwner _x; + if (_hcIndex > -1) then { + private _groupCount = _hcLoad select _hcIndex; + _hcLoad set [_hcIndex, _groupCount + 1]; }; } forEach allGroups; - _HCs select (_HCLoad find selectMin _HCLoad) + _hcs select (_hcLoad find selectMin _hcLoad) }; }; From 73bef6fe0be2bfd0ded90c069e20a2905d535a3b Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Wed, 10 Mar 2021 11:44:57 -0500 Subject: [PATCH 05/15] add event everywhere --- addons/common/XEH_postInit.sqf | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index ac580a0bb..7f3e323a6 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -300,6 +300,7 @@ _unit setNameSound _nameSound; }] call CBA_fnc_addEventHandler; +[QGVAR(deserializeObjects), LINKFUNC(deserializeObjects)] call CBA_fnc_addEventHandler; [QGVAR(earthquake), LINKFUNC(earthquake)] call CBA_fnc_addEventHandler; [QGVAR(fireArtillery), LINKFUNC(fireArtillery)] call CBA_fnc_addEventHandler; [QGVAR(setLampState), LINKFUNC(setLampState)] call CBA_fnc_addEventHandler; @@ -390,9 +391,4 @@ if (isServer) then { } call FUNC(runAfterSettingsInit); [QGVAR(createZeus), LINKFUNC(createZeus)] call CBA_fnc_addEventHandler; - [QGVAR(deserializeObjects), LINKFUNC(deserializeObjects)] call CBA_fnc_addEventHandler; -} else { - if !(hasInterface) then { - [QGVAR(deserializeObjects), LINKFUNC(deserializeObjects)] call CBA_fnc_addEventHandler; - }; }; From 450342de449162512320651d5b2a8b8fd30b24bc Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Wed, 10 Mar 2021 11:45:14 -0500 Subject: [PATCH 06/15] remove unused param --- addons/common/functions/fnc_deserializeObjects.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_deserializeObjects.sqf b/addons/common/functions/fnc_deserializeObjects.sqf index 0eb685ef2..28ebd9b78 100644 --- a/addons/common/functions/fnc_deserializeObjects.sqf +++ b/addons/common/functions/fnc_deserializeObjects.sqf @@ -20,7 +20,7 @@ * Public: No */ -params [["_serializedData", [], [[]]], ["_centerPos", [0, 0, 0], [[]], [2, 3]], ["_makeEditable", true, [true]], ["_enableRandomization", false, [true]], ["_useHC", true, [true]]]; +params [["_serializedData", [], [[]]], ["_centerPos", [0, 0, 0], [[]], [2, 3]], ["_makeEditable", true, [true]], ["_enableRandomization", false, [true]]]]; _serializedData params [["_objectData", [], [[]]], ["_groupData", [], [[]]]]; // Check for suitable Headless Client From c2ff9d2dbda791c3846b13382cbfdb2caae2f6c7 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Wed, 10 Mar 2021 11:45:27 -0500 Subject: [PATCH 07/15] move ! inside paren --- addons/common/functions/fnc_deserializeObjects.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_deserializeObjects.sqf b/addons/common/functions/fnc_deserializeObjects.sqf index 28ebd9b78..71574b796 100644 --- a/addons/common/functions/fnc_deserializeObjects.sqf +++ b/addons/common/functions/fnc_deserializeObjects.sqf @@ -25,7 +25,7 @@ _serializedData params [["_objectData", [], [[]]], ["_groupData", [], [[]]]]; // Check for suitable Headless Client private _hc = [] call FUNC(getFewestGroupsHC); -if !(isNull _hc) exitWith { +if (!isNull _hc) exitWith { [QEGVAR(common,deserializeObjects), _this, _hc] call CBA_fnc_targetEvent; }; From 1f216bb82d94052e9a31fd247981120dd3bacb7e Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Thu, 11 Mar 2021 11:13:47 -0500 Subject: [PATCH 08/15] Update addons/common/functions/fnc_deserializeObjects.sqf Co-authored-by: Neil Evers --- addons/common/functions/fnc_deserializeObjects.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_deserializeObjects.sqf b/addons/common/functions/fnc_deserializeObjects.sqf index 71574b796..ca370068c 100644 --- a/addons/common/functions/fnc_deserializeObjects.sqf +++ b/addons/common/functions/fnc_deserializeObjects.sqf @@ -20,7 +20,7 @@ * Public: No */ -params [["_serializedData", [], [[]]], ["_centerPos", [0, 0, 0], [[]], [2, 3]], ["_makeEditable", true, [true]], ["_enableRandomization", false, [true]]]]; +params [["_serializedData", [], [[]]], ["_centerPos", [0, 0, 0], [[]], [2, 3]], ["_makeEditable", true, [true]], ["_enableRandomization", false, [true]]]; _serializedData params [["_objectData", [], [[]]], ["_groupData", [], [[]]]]; // Check for suitable Headless Client From 7ca1caef4b71a4b3bcf95911cd334ebfbccc4ab4 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 20 Apr 2021 16:04:55 -0400 Subject: [PATCH 09/15] ! inside parentheses --- addons/common/functions/fnc_getFewestGroupsHC.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_getFewestGroupsHC.sqf b/addons/common/functions/fnc_getFewestGroupsHC.sqf index 1ebf28f72..ba2440150 100644 --- a/addons/common/functions/fnc_getFewestGroupsHC.sqf +++ b/addons/common/functions/fnc_getFewestGroupsHC.sqf @@ -15,7 +15,7 @@ * Public: No */ -if !(isServer) exitWith {objNull}; +if (!isServer) exitWith {objNull}; private _hcs = []; private _hcIDs = []; From 2442a2073a6a6441057057222e498fe38fb2f55c Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 20 Apr 2021 16:06:32 -0400 Subject: [PATCH 10/15] != instead of > --- addons/common/functions/fnc_getFewestGroupsHC.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_getFewestGroupsHC.sqf b/addons/common/functions/fnc_getFewestGroupsHC.sqf index ba2440150..21961a868 100644 --- a/addons/common/functions/fnc_getFewestGroupsHC.sqf +++ b/addons/common/functions/fnc_getFewestGroupsHC.sqf @@ -40,7 +40,7 @@ switch (count _hcIDs) do { // Count local groups for each HC { private _hcIndex = _hcIDs find groupOwner _x; - if (_hcIndex > -1) then { + if (_hcIndex != -1) then { private _groupCount = _hcLoad select _hcIndex; _hcLoad set [_hcIndex, _groupCount + 1]; }; From dcdb83fff52ce36ad697d9ea98f21ef4cfae5955 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 20 Apr 2021 16:25:29 -0400 Subject: [PATCH 11/15] No parentheses --- addons/common/functions/fnc_getFewestGroupsHC.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/common/functions/fnc_getFewestGroupsHC.sqf b/addons/common/functions/fnc_getFewestGroupsHC.sqf index 21961a868..d341ec3e4 100644 --- a/addons/common/functions/fnc_getFewestGroupsHC.sqf +++ b/addons/common/functions/fnc_getFewestGroupsHC.sqf @@ -30,10 +30,10 @@ private _hcLoad = []; } forEach allPlayers; switch (count _hcIDs) do { - case (0): { + case 0: { objNull }; - case (1): { + case 1: { _hcIDs select 0; }; default { From 490d4244f5201a01fc09c5d6fad03920e040aaad Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 20 Apr 2021 16:31:16 -0400 Subject: [PATCH 12/15] No semicolon since this is a return value --- addons/common/functions/fnc_getFewestGroupsHC.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_getFewestGroupsHC.sqf b/addons/common/functions/fnc_getFewestGroupsHC.sqf index d341ec3e4..6d2633dc7 100644 --- a/addons/common/functions/fnc_getFewestGroupsHC.sqf +++ b/addons/common/functions/fnc_getFewestGroupsHC.sqf @@ -34,7 +34,7 @@ switch (count _hcIDs) do { objNull }; case 1: { - _hcIDs select 0; + _hcIDs select 0 }; default { // Count local groups for each HC From dd035444dd0679198d9a7416049bc4268c6b39f0 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 20 Apr 2021 16:32:44 -0400 Subject: [PATCH 13/15] Description --- addons/common/functions/fnc_getFewestGroupsHC.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_getFewestGroupsHC.sqf b/addons/common/functions/fnc_getFewestGroupsHC.sqf index 6d2633dc7..8da0c2e73 100644 --- a/addons/common/functions/fnc_getFewestGroupsHC.sqf +++ b/addons/common/functions/fnc_getFewestGroupsHC.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: Ampersand - * Returns HC with fewest groups, if available. + * Returns the headless client with the fewest local groups. objNull if none are available. * * Arguments: * None From 6159bef484c313773ac54bb284d71fd36d1e8169 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 20 Apr 2021 18:28:41 -0400 Subject: [PATCH 14/15] Use value from setting --- addons/common/functions/fnc_deserializeObjects.sqf | 4 ++-- addons/editor/initKeybinds.sqf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/common/functions/fnc_deserializeObjects.sqf b/addons/common/functions/fnc_deserializeObjects.sqf index ca370068c..e32548904 100644 --- a/addons/common/functions/fnc_deserializeObjects.sqf +++ b/addons/common/functions/fnc_deserializeObjects.sqf @@ -20,12 +20,12 @@ * Public: No */ -params [["_serializedData", [], [[]]], ["_centerPos", [0, 0, 0], [[]], [2, 3]], ["_makeEditable", true, [true]], ["_enableRandomization", false, [true]]]; +params [["_serializedData", [], [[]]], ["_centerPos", [0, 0, 0], [[]], [2, 3]], ["_makeEditable", true, [true]], ["_enableRandomization", false, [true]], ["_useHC", true, [true]]]; _serializedData params [["_objectData", [], [[]]], ["_groupData", [], [[]]]]; // Check for suitable Headless Client private _hc = [] call FUNC(getFewestGroupsHC); -if (!isNull _hc) exitWith { +if (isServer && {_useHC} && {!isNull _hc}) exitWith { [QEGVAR(common,deserializeObjects), _this, _hc] call CBA_fnc_targetEvent; }; diff --git a/addons/editor/initKeybinds.sqf b/addons/editor/initKeybinds.sqf index c0e99aadd..2201473ed 100644 --- a/addons/editor/initKeybinds.sqf +++ b/addons/editor/initKeybinds.sqf @@ -59,7 +59,7 @@ [ELSTRING(main,DisplayName), QGVAR(deepPaste), [LSTRING(DeepPaste), LSTRING(DeepPaste_Description)], { if (!isNull curatorCamera && {!GETMVAR(RscDisplayCurator_search,false)}) then { private _position = [nil, false] call EFUNC(common,getPosFromScreen); - [QEGVAR(common,deserializeObjects), [GVAR(clipboard), _position, true, GVAR(randomizeCopyPaste), GVAR(deepPasteHC)]] call CBA_fnc_serverEvent; + [QEGVAR(common,deserializeObjects), [GVAR(clipboard), _position, true, GVAR(randomizeCopyPaste), EGVAR(editor,deepPasteHC)]] call CBA_fnc_serverEvent; playSound ["RscDisplayCurator_error01", true]; From 9987f62a7e517bcb57d62fc7d94d4345de3f11f4 Mon Sep 17 00:00:00 2001 From: Steve Zhao Date: Tue, 20 Apr 2021 18:28:56 -0400 Subject: [PATCH 15/15] return hc object instead of clientID --- addons/common/functions/fnc_getFewestGroupsHC.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_getFewestGroupsHC.sqf b/addons/common/functions/fnc_getFewestGroupsHC.sqf index 8da0c2e73..2ac025da1 100644 --- a/addons/common/functions/fnc_getFewestGroupsHC.sqf +++ b/addons/common/functions/fnc_getFewestGroupsHC.sqf @@ -34,7 +34,7 @@ switch (count _hcIDs) do { objNull }; case 1: { - _hcIDs select 0 + _hcs select 0 }; default { // Count local groups for each HC