From ccf4e2d7507a9b1367309f47209e6a94009ef4d6 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Mon, 18 Jan 2021 01:49:28 +0300 Subject: [PATCH 01/10] Add interaction with terrain objects --- .../functions/fnc_renderActionPoints.sqf | 2 + addons/interaction/XEH_PREP.hpp | 2 + addons/interaction/XEH_postInit.sqf | 17 ++++++ addons/interaction/XEH_preInit.sqf | 11 ++++ addons/interaction/XEH_preStart.sqf | 24 +++++++++ .../dev/initReplaceTerrainCursorObject.sqf | 54 +++++++++++++++++++ .../functions/fnc_replaceTerrainObject.sqf | 34 ++++++++++++ addons/interaction/initSettings.sqf | 7 +++ 8 files changed, 151 insertions(+) create mode 100644 addons/interaction/dev/initReplaceTerrainCursorObject.sqf create mode 100644 addons/interaction/functions/fnc_replaceTerrainObject.sqf create mode 100644 addons/interaction/initSettings.sqf diff --git a/addons/interact_menu/functions/fnc_renderActionPoints.sqf b/addons/interact_menu/functions/fnc_renderActionPoints.sqf index f4aa8927f66..5e8c6d0c7ed 100644 --- a/addons/interact_menu/functions/fnc_renderActionPoints.sqf +++ b/addons/interact_menu/functions/fnc_renderActionPoints.sqf @@ -29,6 +29,8 @@ private _fnc_renderNearbyActions = { GVAR(foundActions) = []; GVAR(lastTimeSearchedActions) = diag_tickTime; + QGVAR(renderNearbyActions) call CBA_fnc_localEvent; + private _numInteractObjects = 0; private _nearestObjects = nearestObjects [ACE_player, ["All"], 13]; { diff --git a/addons/interaction/XEH_PREP.hpp b/addons/interaction/XEH_PREP.hpp index a63bfc48f8f..bc92eab2722 100644 --- a/addons/interaction/XEH_PREP.hpp +++ b/addons/interaction/XEH_PREP.hpp @@ -44,4 +44,6 @@ PREP(openDoor); PREP(canPush); PREP(push); +// misc PREP(canFlip); +PREP(replaceTerrainObject); diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 7a9f2b6572d..ff15f1be9be 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -77,8 +77,25 @@ ACE_Modifier = 0; }; }] call CBA_fnc_addEventHandler; +if (isServer) then { + [QGVAR(replaceTerrainObject), FUNC(replaceTerrainObject)] call CBA_fnc_addEventHandler; +}; + if (!hasInterface) exitWith {}; +[QEGVAR(interact_menu,renderNearbyActions), { + if !GVAR(interactWithTerrainObjects) exitWith {}; + { + if (!isObjectHidden _x && {_x getVariable [QGVAR(terrainObjectNotReplaced), true]} && {typeOf _x isEqualTo ""}) then { + private _model = getModelInfo _x select 1; + private _class = GVAR(replaceTerrainClasses) getVariable [_model, ""]; + if (_class isEqualTo "") exitWith {}; + _x setVariable [QGVAR(terrainObjectNotReplaced), false]; + [QGVAR(replaceTerrainObject), [_x, _class]] call CBA_fnc_serverEvent; + }; + } forEach nearestTerrainObjects [ACE_player, [], 5, false]; +}] call CBA_fnc_addEventHandler; + GVAR(isOpeningDoor) = false; [QGVAR(tapShoulder), { diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index dbc37e2bb68..76edbbe7489 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -6,6 +6,8 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +#include "initSettings.sqf" + DFUNC(repair_Statement) = { // moved from config because of build problems TRACE_1("repair_Statement",_this); { @@ -13,4 +15,13 @@ DFUNC(repair_Statement) = { // moved from config because of build problems } forEach (curatorSelected select 0) }; +if hasInterface then { + GVAR(replaceTerrainClasses) = call CBA_fnc_createNamespace; + private _cacheReplaceTerrainArray = call (uiNamespace getVariable [QGVAR(cacheReplaceTerrainClasses), {[[],[]]}]); + _cacheReplaceTerrainArray params ["_cacheReplaceTerrainModels", "_cacheReplaceTerrainClasses"]; + { + GVAR(replaceTerrainClasses) setVariable [_x, _cacheReplaceTerrainClasses select _forEachIndex]; + } forEach _cacheReplaceTerrainModels; +}; + ADDON = true; diff --git a/addons/interaction/XEH_preStart.sqf b/addons/interaction/XEH_preStart.sqf index 022888575ed..6d0763c6b69 100644 --- a/addons/interaction/XEH_preStart.sqf +++ b/addons/interaction/XEH_preStart.sqf @@ -1,3 +1,27 @@ #include "script_component.hpp" #include "XEH_PREP.hpp" + +if !hasInterface exitWith {}; + +private _replaceTerrainClasses = QUOTE( \ + getNumber (_x >> 'scope') == 2 \ + && {getNumber (_x >> QQGVAR(replaceTerrainObject)) > 0} \ +) configClasses (configFile >> "CfgVehicles"); + +private _cacheReplaceTerrainModels = []; +private _cacheReplaceTerrainClasses = []; +{ + private _model = toLower getText (_x >> "model"); + if (_model select [0, 1] == "\") then { + _model = _model select [1]; + }; + if ((_model select [count _model - 4]) != ".p3d") then { + _model = _model + ".p3d" + }; + if (-1 < _cacheReplaceTerrainModels pushBackUnique _model) then { + _cacheReplaceTerrainClasses pushBack configName _x; + }; +} forEach _replaceTerrainClasses; + +uiNamespace setVariable [QGVAR(cacheReplaceTerrainClasses), compileFinal str [_cacheReplaceTerrainModels, _cacheReplaceTerrainClasses]]; diff --git a/addons/interaction/dev/initReplaceTerrainCursorObject.sqf b/addons/interaction/dev/initReplaceTerrainCursorObject.sqf new file mode 100644 index 00000000000..722549f69a2 --- /dev/null +++ b/addons/interaction/dev/initReplaceTerrainCursorObject.sqf @@ -0,0 +1,54 @@ +// execVM "z\ace\addons\interaction\dev\initReplaceTerrainCursorObject.sqf"; +// use "J" key to replace terrain object and add dragging actions to cursorObject + +#include "\z\ace\addons\interaction\script_component.hpp" + +DFUNC(replaceTerrainClassesAdd) = { + params ["_model", ["_class", ""]]; + if (_model isEqualType objNull) then { + _model = getModelInfo _model select 1; + }; + if (_model isEqualTo "") exitWith {systemChat "fail model"; false}; + + private _savedClass = GVAR(replaceTerrainClasses) getVariable [_model, ""]; + if (_savedClass != "") exitWith {systemChat ("was " + _savedClass); true}; + + private _parent = ""; + if (_class isEqualTo "") then { + private _configClasses = QUOTE(getNumber (_x >> 'scope') == 2 && {!(configName _x isKindOf 'AllVehicles')}) configClasses (configFile >> "CfgVehicles"); + { + private _xmodel = toLower getText (_x >> "model"); + if (_xmodel select [0, 1] == "\") then { + _xmodel = _xmodel select [1]; + }; + if ((_xmodel select [count _xmodel - 4]) != ".p3d") then { + _xmodel = _xmodel + ".p3d" + }; + if (_model == _xmodel) exitWith {_class = configName _x; _parent = configName inheritsFrom _x;} + } forEach _configClasses; + }; + if (_class isEqualTo "") exitWith {systemChat "fail class"; false}; + GVAR(replaceTerrainClasses) setVariable [_model, _class]; + QEGVAR(interact_menu,renderNearbyActions) call CBA_fnc_localEvent; + systemChat ("found " + _class); + diag_log format ["replaceTerrain: class %1: %2", _class, _parent]; + true +}; + +// DIK_J +[0x24, [false, false, false], { + if ( + cursorObject call FUNC(replaceTerrainClassesAdd) + && {["ace_dragging"] call EFUNC(common,isModLoaded)} + ) then { + [{ + if (typeOf cursorObject == "") exitwith {}; + [cursorObject, { + if !hasInterface exitWith {}; + [_this, true] call EFUNC(dragging,setDraggable); + [_this, true] call EFUNC(dragging,setCarryable); + }] remoteExec ["call", 0]; + }, [], 1] call CBA_fnc_waitAndExecute; + }; + true +}, nil, nil, false] call CBA_fnc_addKeyHandler; diff --git a/addons/interaction/functions/fnc_replaceTerrainObject.sqf b/addons/interaction/functions/fnc_replaceTerrainObject.sqf new file mode 100644 index 00000000000..ca4b0d7a48c --- /dev/null +++ b/addons/interaction/functions/fnc_replaceTerrainObject.sqf @@ -0,0 +1,34 @@ +#include "script_component.hpp" +/* + * Author: Dystopian + * Replaces terrain object with created one. + * Run on server only. + * + * Arguments: + * 0: Terrain object + * 1: New object class + * + * Return Value: + * None + * + * Example: + * [cursorObject, "Land_Bucket_F"] call ace_interaction_fnc_replaceTerrainObject + * + * Public: No + */ + +params ["_terrainObject", "_class"]; +TRACE_2("",_terrainObject,_class); + +if (isObjectHidden _terrainObject) exitWith {}; + +private _position = getPosATL _terrainObject; +private _vectorDirAndUp = [vectorDir _terrainObject, vectorUp _terrainObject]; + +hideObjectGlobal _terrainObject; +// prevent new object clipping with old one +_terrainObject setDamage [1, false]; + +private _newObject = createVehicle [_class, [0,0,0]]; +_newObject setVectorDirAndUp _vectorDirAndUp; +_newObject setPosATL _position; diff --git a/addons/interaction/initSettings.sqf b/addons/interaction/initSettings.sqf new file mode 100644 index 00000000000..7ae8fea0e1f --- /dev/null +++ b/addons/interaction/initSettings.sqf @@ -0,0 +1,7 @@ +[ + QGVAR(interactWithTerrainObjects), "CHECKBOX", + "str_a3_modules_moduleomquest_defend_f_attributes_useterrainobject0", + "ACE " + LLSTRING(DisplayName), + false, + true +] call CBA_fnc_addSetting; From 18dc7a48c31ee191662608ae16611cd771564075 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sun, 7 Mar 2021 03:26:55 +0300 Subject: [PATCH 02/10] Optimize with new commands --- addons/interaction/XEH_postInit.sqf | 14 +++++++------- addons/interaction/XEH_preInit.sqf | 7 +------ addons/interaction/XEH_preStart.sqf | 10 ++++------ .../dev/initReplaceTerrainCursorObject.sqf | 19 ++++++++++++------- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 6d391f8e366..22bd2775dc9 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -86,13 +86,13 @@ if (!hasInterface) exitWith {}; [QEGVAR(interact_menu,renderNearbyActions), { if !GVAR(interactWithTerrainObjects) exitWith {}; { - if (!isObjectHidden _x && {_x getVariable [QGVAR(terrainObjectNotReplaced), true]} && {typeOf _x isEqualTo ""}) then { - private _model = getModelInfo _x select 1; - private _class = GVAR(replaceTerrainClasses) getVariable [_model, ""]; - if (_class isEqualTo "") exitWith {}; - _x setVariable [QGVAR(terrainObjectNotReplaced), false]; - [QGVAR(replaceTerrainObject), [_x, _class]] call CBA_fnc_serverEvent; - }; + if (isObjectHidden _x || {_x getVariable [QGVAR(terrainObjectReplaced), false]} || {typeOf _x isNotEqualTo ""}) then {continue}; + + private _model = getModelInfo _x select 1; + private _class = GVAR(replaceTerrainModels) get _model; + if (isNil "_class") then {continue}; + _x setVariable [QGVAR(terrainObjectReplaced), true]; + [QGVAR(replaceTerrainObject), [_x, _class]] call CBA_fnc_serverEvent; } forEach nearestTerrainObjects [ACE_player, [], 5, false]; }] call CBA_fnc_addEventHandler; diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index 76edbbe7489..98d59d8cb64 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -16,12 +16,7 @@ DFUNC(repair_Statement) = { // moved from config because of build problems }; if hasInterface then { - GVAR(replaceTerrainClasses) = call CBA_fnc_createNamespace; - private _cacheReplaceTerrainArray = call (uiNamespace getVariable [QGVAR(cacheReplaceTerrainClasses), {[[],[]]}]); - _cacheReplaceTerrainArray params ["_cacheReplaceTerrainModels", "_cacheReplaceTerrainClasses"]; - { - GVAR(replaceTerrainClasses) setVariable [_x, _cacheReplaceTerrainClasses select _forEachIndex]; - } forEach _cacheReplaceTerrainModels; + GVAR(replaceTerrainModels) = createHashMapFromArray call (uiNamespace getVariable QGVAR(cacheReplaceTerrainModels)); }; ADDON = true; diff --git a/addons/interaction/XEH_preStart.sqf b/addons/interaction/XEH_preStart.sqf index 6d0763c6b69..e9df4f765ed 100644 --- a/addons/interaction/XEH_preStart.sqf +++ b/addons/interaction/XEH_preStart.sqf @@ -9,8 +9,7 @@ private _replaceTerrainClasses = QUOTE( \ && {getNumber (_x >> QQGVAR(replaceTerrainObject)) > 0} \ ) configClasses (configFile >> "CfgVehicles"); -private _cacheReplaceTerrainModels = []; -private _cacheReplaceTerrainClasses = []; +private _cacheReplaceTerrainModels = createHashMap; { private _model = toLower getText (_x >> "model"); if (_model select [0, 1] == "\") then { @@ -19,9 +18,8 @@ private _cacheReplaceTerrainClasses = []; if ((_model select [count _model - 4]) != ".p3d") then { _model = _model + ".p3d" }; - if (-1 < _cacheReplaceTerrainModels pushBackUnique _model) then { - _cacheReplaceTerrainClasses pushBack configName _x; - }; + if (_model in _cacheReplaceTerrainModels) then {continue}; + _cacheReplaceTerrainModels set [_model, configName _x]; } forEach _replaceTerrainClasses; -uiNamespace setVariable [QGVAR(cacheReplaceTerrainClasses), compileFinal str [_cacheReplaceTerrainModels, _cacheReplaceTerrainClasses]]; +uiNamespace setVariable [QGVAR(cacheReplaceTerrainModels), compileFinal str _cacheReplaceTerrainModels]; diff --git a/addons/interaction/dev/initReplaceTerrainCursorObject.sqf b/addons/interaction/dev/initReplaceTerrainCursorObject.sqf index 722549f69a2..f458b6d3f8e 100644 --- a/addons/interaction/dev/initReplaceTerrainCursorObject.sqf +++ b/addons/interaction/dev/initReplaceTerrainCursorObject.sqf @@ -1,17 +1,17 @@ // execVM "z\ace\addons\interaction\dev\initReplaceTerrainCursorObject.sqf"; -// use "J" key to replace terrain object and add dragging actions to cursorObject +// use "J" key to replace terrain cursorObject and add dragging actions to it #include "\z\ace\addons\interaction\script_component.hpp" -DFUNC(replaceTerrainClassesAdd) = { +DFUNC(replaceTerrainModelsAdd) = { params ["_model", ["_class", ""]]; if (_model isEqualType objNull) then { _model = getModelInfo _model select 1; }; if (_model isEqualTo "") exitWith {systemChat "fail model"; false}; - private _savedClass = GVAR(replaceTerrainClasses) getVariable [_model, ""]; - if (_savedClass != "") exitWith {systemChat ("was " + _savedClass); true}; + private _savedClass = GVAR(replaceTerrainModels) get _model; + if (!isNil "_savedClass") exitWith {systemChat ("was " + _savedClass); true}; private _parent = ""; if (_class isEqualTo "") then { @@ -24,11 +24,15 @@ DFUNC(replaceTerrainClassesAdd) = { if ((_xmodel select [count _xmodel - 4]) != ".p3d") then { _xmodel = _xmodel + ".p3d" }; - if (_model == _xmodel) exitWith {_class = configName _x; _parent = configName inheritsFrom _x;} + if (_model == _xmodel) then { + _class = configName _x; + _parent = configName inheritsFrom _x; + break; + } } forEach _configClasses; }; if (_class isEqualTo "") exitWith {systemChat "fail class"; false}; - GVAR(replaceTerrainClasses) setVariable [_model, _class]; + GVAR(replaceTerrainModels) set [_model, _class]; QEGVAR(interact_menu,renderNearbyActions) call CBA_fnc_localEvent; systemChat ("found " + _class); diag_log format ["replaceTerrain: class %1: %2", _class, _parent]; @@ -38,9 +42,10 @@ DFUNC(replaceTerrainClassesAdd) = { // DIK_J [0x24, [false, false, false], { if ( - cursorObject call FUNC(replaceTerrainClassesAdd) + cursorObject call FUNC(replaceTerrainModelsAdd) && {["ace_dragging"] call EFUNC(common,isModLoaded)} ) then { + // wait while server replaces object, then init dragging on all clients [{ if (typeOf cursorObject == "") exitwith {}; [cursorObject, { From 301471f0482a65abf26603b69bf69430da3f305b Mon Sep 17 00:00:00 2001 From: Dystopian Date: Fri, 30 Apr 2021 00:02:57 +0300 Subject: [PATCH 03/10] Handle z-position under ground --- addons/interaction/functions/fnc_replaceTerrainObject.sqf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/interaction/functions/fnc_replaceTerrainObject.sqf b/addons/interaction/functions/fnc_replaceTerrainObject.sqf index ca4b0d7a48c..7a164e42125 100644 --- a/addons/interaction/functions/fnc_replaceTerrainObject.sqf +++ b/addons/interaction/functions/fnc_replaceTerrainObject.sqf @@ -23,6 +23,9 @@ TRACE_2("",_terrainObject,_class); if (isObjectHidden _terrainObject) exitWith {}; private _position = getPosATL _terrainObject; +if (_position select 2 < 0) then { + _position set [2, 0]; +}; private _vectorDirAndUp = [vectorDir _terrainObject, vectorUp _terrainObject]; hideObjectGlobal _terrainObject; From 34df3142df6c81b1624b056f215916f72cd33ca7 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Fri, 30 Apr 2021 20:43:36 +0300 Subject: [PATCH 04/10] Add warning for setting --- addons/interaction/initSettings.sqf | 2 +- addons/interaction/stringtable.xml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/interaction/initSettings.sqf b/addons/interaction/initSettings.sqf index 4eb72702a48..63f5bcdf4d7 100644 --- a/addons/interaction/initSettings.sqf +++ b/addons/interaction/initSettings.sqf @@ -32,7 +32,7 @@ [ QGVAR(interactWithTerrainObjects), "CHECKBOX", - "str_a3_modules_moduleomquest_defend_f_attributes_useterrainobject0", + ["str_a3_modules_moduleomquest_defend_f_attributes_useterrainobject0", LSTRING(interactWithTerrainObjects_Description)], format ["ACE %1", LLSTRING(DisplayName)], false, true diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index fae143bde2b..aec6e7caa19 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -1218,5 +1218,9 @@ Включает действия Установить/Снять для приспособлений текущего оружия. インタラクションから使用中の武器に対してのアタッチメント取り外しを可能にします。 + + Warning: can cause some objects to collide with others. + Внимание: может вызвать отталкивание некоторых объектов друг от друга. + From 227c9da1867c87b77340c036a574a5ed0877e7b2 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sat, 1 May 2021 14:23:14 +0400 Subject: [PATCH 05/10] Add parentheses to condition Co-authored-by: jonpas --- addons/interaction/XEH_preInit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index 98d59d8cb64..4dd0bb13e63 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -15,7 +15,7 @@ DFUNC(repair_Statement) = { // moved from config because of build problems } forEach (curatorSelected select 0) }; -if hasInterface then { +if (hasInterface) then { GVAR(replaceTerrainModels) = createHashMapFromArray call (uiNamespace getVariable QGVAR(cacheReplaceTerrainModels)); }; From 16025e846189aaeaa8ff5e824b02575b02e9b8f7 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sat, 1 May 2021 23:20:37 +0300 Subject: [PATCH 06/10] Add comments --- addons/interaction/XEH_postInit.sqf | 11 +++++++---- .../dev/initReplaceTerrainCursorObject.sqf | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 22bd2775dc9..7785228eee4 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -83,11 +83,16 @@ if (isServer) then { if (!hasInterface) exitWith {}; +GVAR(isOpeningDoor) = false; + [QEGVAR(interact_menu,renderNearbyActions), { if !GVAR(interactWithTerrainObjects) exitWith {}; { - if (isObjectHidden _x || {_x getVariable [QGVAR(terrainObjectReplaced), false]} || {typeOf _x isNotEqualTo ""}) then {continue}; - + if ( + isObjectHidden _x // after hiding on server + || {_x getVariable [QGVAR(terrainObjectReplaced), false]} // after checking but before hiding + || {typeOf _x isNotEqualTo ""} + ) then {continue}; private _model = getModelInfo _x select 1; private _class = GVAR(replaceTerrainModels) get _model; if (isNil "_class") then {continue}; @@ -96,8 +101,6 @@ if (!hasInterface) exitWith {}; } forEach nearestTerrainObjects [ACE_player, [], 5, false]; }] call CBA_fnc_addEventHandler; -GVAR(isOpeningDoor) = false; - [QGVAR(tapShoulder), { params ["_unit", "_shoulderNum"]; diff --git a/addons/interaction/dev/initReplaceTerrainCursorObject.sqf b/addons/interaction/dev/initReplaceTerrainCursorObject.sqf index f458b6d3f8e..c0221b2d38e 100644 --- a/addons/interaction/dev/initReplaceTerrainCursorObject.sqf +++ b/addons/interaction/dev/initReplaceTerrainCursorObject.sqf @@ -28,7 +28,7 @@ DFUNC(replaceTerrainModelsAdd) = { _class = configName _x; _parent = configName inheritsFrom _x; break; - } + }; } forEach _configClasses; }; if (_class isEqualTo "") exitWith {systemChat "fail class"; false}; From c0493ba278620f6cb24272eb050b1d709b7d8b1a Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sun, 2 May 2021 01:12:52 +0400 Subject: [PATCH 07/10] Add parentheses to condition Co-authored-by: jonpas --- addons/interaction/XEH_preStart.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/interaction/XEH_preStart.sqf b/addons/interaction/XEH_preStart.sqf index e9df4f765ed..dad32c8b99e 100644 --- a/addons/interaction/XEH_preStart.sqf +++ b/addons/interaction/XEH_preStart.sqf @@ -2,7 +2,7 @@ #include "XEH_PREP.hpp" -if !hasInterface exitWith {}; +if (!hasInterface) exitWith {}; private _replaceTerrainClasses = QUOTE( \ getNumber (_x >> 'scope') == 2 \ From 169ddfa8aaefb12786dc0a63b41d516741135503 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sat, 24 Jul 2021 02:41:46 +0400 Subject: [PATCH 08/10] Add parentheses to condition Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> --- addons/interaction/XEH_postInit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 7785228eee4..e21ead30acf 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -86,7 +86,7 @@ if (!hasInterface) exitWith {}; GVAR(isOpeningDoor) = false; [QEGVAR(interact_menu,renderNearbyActions), { - if !GVAR(interactWithTerrainObjects) exitWith {}; + if (!GVAR(interactWithTerrainObjects)) exitWith {}; { if ( isObjectHidden _x // after hiding on server From 9c2d97d1331e005b87ba22611196ad6b7c7c36f2 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sat, 24 Jul 2021 15:01:31 +0300 Subject: [PATCH 09/10] Add replacement configs to dragging This reverts commit afc5abe6cd90258570529292c969acb4ee04e438. --- addons/dragging/CfgVehicles.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/addons/dragging/CfgVehicles.hpp b/addons/dragging/CfgVehicles.hpp index 055013f7279..076c5fb640c 100644 --- a/addons/dragging/CfgVehicles.hpp +++ b/addons/dragging/CfgVehicles.hpp @@ -186,6 +186,7 @@ class CfgVehicles { // Misc crates class Constructions_base_F; class Land_WoodenBox_F: Constructions_base_F { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canCarry) = 1; GVAR(canDrag) = 1; @@ -249,22 +250,27 @@ class CfgVehicles { // some terrain objects class Land_CampingTable_F: ThingX { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canCarry) = 1; GVAR(carryPosition)[] = {0,1,0.5}; }; class Land_CampingTable_small_F: ThingX { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canCarry) = 1; GVAR(carryPosition)[] = {0,1,0.5}; }; class Land_GarbageContainer_closed_F: ThingX { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canDrag) = 1; GVAR(dragDirection) = 180; }; class Land_GarbageContainer_open_F: ThingX { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canDrag) = 1; GVAR(dragDirection) = 180; }; class Land_Sun_chair_F: ThingX { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canCarry) = 1; GVAR(carryDirection) = 90; @@ -273,56 +279,69 @@ class CfgVehicles { GVAR(dragDirection) = 90; }; class Land_TablePlastic_01_F: ThingX { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canCarry) = 1; GVAR(carryPosition)[] = {0,1,0}; GVAR(canDrag) = 1; }; class Land_Tyre_F: ThingX { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canCarry) = 1; GVAR(carryPosition)[] = {0,0.6,1}; }; class Land_WoodenTable_large_F: ThingX { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canDrag) = 1; GVAR(dragDirection) = 90; }; class Land_BarrelSand_F: Items_base_F { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canDrag) = 1; GVAR(dragPosition)[] = {0,1,0}; }; class Land_BarrelWater_F: Items_base_F { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canDrag) = 1; GVAR(dragPosition)[] = {0,1,0}; }; class Land_Bucket_F: Items_base_F { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canCarry) = 1; GVAR(carryPosition)[] = {0,0.6,1}; }; class Land_CanisterPlastic_F: Items_base_F { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canCarry) = 1; GVAR(carryPosition)[] = {0,0.6,0}; }; class Land_GarbageBarrel_01_english_F: Items_base_F { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canDrag) = 1; }; class Land_MetalBarrel_F: Items_base_F { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canDrag) = 1; GVAR(dragPosition)[] = {0,1,0}; }; class Land_Pallet_F: Constructions_base_F { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canCarry) = 1; GVAR(canDrag) = 1; }; class Land_Pallet_vertical_F: Constructions_base_F { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canCarry) = 1; GVAR(carryPosition)[] = {0,0.6,0.6}; GVAR(carryDirection) = 180; }; class Land_WheelCart_F: Constructions_base_F { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canDrag) = 1; }; class Land_WorkStand_F: Constructions_base_F { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canCarry) = 1; GVAR(carryPosition)[] = {0,1,0}; @@ -331,10 +350,12 @@ class CfgVehicles { }; class Market_base_F; class Land_Basket_F: Market_base_F { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canCarry) = 1; GVAR(carryPosition)[] = {0,0.6,0.5}; }; class Land_WoodenCart_F: Market_base_F { + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canDrag) = 1; }; @@ -343,23 +364,27 @@ class CfgVehicles { class NonStrategic; class Land_Pallets_F: NonStrategic { XEH_INHERITED; + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canDrag) = 1; }; class Camping_base_F; class Land_CampingChair_V1_folded_F: Camping_base_F { XEH_INHERITED; + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canCarry) = 1; GVAR(carryPosition)[] = {0,0.6,1}; }; class Stall_base_F; class Land_CratesPlastic_F: Stall_base_F { XEH_INHERITED; + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canCarry) = 1; GVAR(carryPosition)[] = {0,0.6,1}; }; class House_Small_F; class Land_MetalBarrel_empty_F: House_Small_F { XEH_INHERITED; + EGVAR(interaction,replaceTerrainObject) = 1; GVAR(canDrag) = 1; GVAR(dragPosition)[] = {0,1,0}; }; From cbe326cf48d947c7934827e8599619f93e49f0f7 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sat, 24 Jul 2021 17:10:24 +0300 Subject: [PATCH 10/10] Fix validator error and optimize condition --- addons/interaction/XEH_preStart.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/interaction/XEH_preStart.sqf b/addons/interaction/XEH_preStart.sqf index dad32c8b99e..799e9e5986e 100644 --- a/addons/interaction/XEH_preStart.sqf +++ b/addons/interaction/XEH_preStart.sqf @@ -4,9 +4,9 @@ if (!hasInterface) exitWith {}; -private _replaceTerrainClasses = QUOTE( \ - getNumber (_x >> 'scope') == 2 \ - && {getNumber (_x >> QQGVAR(replaceTerrainObject)) > 0} \ +private _replaceTerrainClasses = QUOTE( + getNumber (_x >> QQGVAR(replaceTerrainObject)) > 0 + && {getNumber (_x >> 'scope') == 2} ) configClasses (configFile >> "CfgVehicles"); private _cacheReplaceTerrainModels = createHashMap;