From 84c54ee08fd439fd2b3c45917e594bbc0de8c403 Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Tue, 20 Apr 2021 23:21:12 +0100 Subject: [PATCH 01/15] Add map markers for ACE Fortify Objects --- AUTHORS.txt | 1 + addons/fortify/XEH_PREP.hpp | 1 + addons/fortify/XEH_postInit.sqf | 16 ++++++ .../functions/fnc_createObjectMarker.sqf | 49 +++++++++++++++++++ .../fortify/functions/fnc_deployConfirm.sqf | 3 +- addons/fortify/initSettings.sqf | 14 ++++++ addons/fortify/stringtable.xml | 15 ++++++ 7 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 addons/fortify/functions/fnc_createObjectMarker.sqf diff --git a/AUTHORS.txt b/AUTHORS.txt index 1b1e7d22..17c703b5 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -125,3 +125,4 @@ VyMajoris(W-Cephei) Winter wizpig64 zGuba +Seb diff --git a/addons/fortify/XEH_PREP.hpp b/addons/fortify/XEH_PREP.hpp index 07124fe6..f833a1c0 100644 --- a/addons/fortify/XEH_PREP.hpp +++ b/addons/fortify/XEH_PREP.hpp @@ -17,3 +17,4 @@ PREP(getPlaceableSet); PREP(modifyAction); PREP(setupModule); PREP(buildLocationModule); +PREP(createObjectMarker); diff --git a/addons/fortify/XEH_postInit.sqf b/addons/fortify/XEH_postInit.sqf index 3ee46cd5..1a94a246 100644 --- a/addons/fortify/XEH_postInit.sqf +++ b/addons/fortify/XEH_postInit.sqf @@ -7,6 +7,7 @@ if (isServer) then { TRACE_3("objectPlaced",_unit,_side,_object); private _jipID = [QGVAR(addActionToObject), [_side, _object]] call CBA_fnc_globalEventJIP; [_jipID, _object] call CBA_fnc_removeGlobalEventJIP; // idealy this function should be called on the server + if (GVAR(markObjectsOnMap) isNotEqualTo 0 && {_object isKindOf "Static"}) then {[_object] call FUNC(createObjectMarker)}; }] call CBA_fnc_addEventHandler; }; @@ -63,3 +64,18 @@ GVAR(objectRotationZ) = 0; [_object, 0, ["ACE_MainActions"], _removeAction] call ACEFUNC(interact_menu,addActionToObject); }; }] call CBA_fnc_addEventHandler; + +[QGVAR(setMarkerVisible), { + params ["_object"]; + [ + {!isNull player}, + { + params ["_object"]; + if (GVAR(markObjectsOnMap) isEqualTo 2 || {[_object getVariable QGVAR(objectSide), side group player] call BIS_fnc_sideIsEnemy}) then { + private _marker = _object getVariable QGVAR(mapMarker); + _marker setMarkerAlpha 0; + }; + }, + _object + ] call CBA_fnc_waitUntilAndExecute; +}] call CBA_fnc_addEventHandler; diff --git a/addons/fortify/functions/fnc_createObjectMarker.sqf b/addons/fortify/functions/fnc_createObjectMarker.sqf new file mode 100644 index 00000000..187957c3 --- /dev/null +++ b/addons/fortify/functions/fnc_createObjectMarker.sqf @@ -0,0 +1,49 @@ +#include "script_component.hpp" + +/* + * Author: Seb + * Creates a map marker for a created static object but only for sides friendly to the creator side + * + * Arguments: + * 0: Created fortify object + * 1: Friendly side + * + * Return Value: + * None + * + * Example: + * [_object, _side] call acex_fortify_fnc_createObjectMarker + * + * Public: Yes + */ + +params ["_object"]; + +// Get Object size and direction +private _bbr = 0 boundingBoxReal _object; +private _p1 = _bbr select 0; +private _p2 = _bbr select 1; +private _maxWidth = abs ((_p2 select 0) - (_p1 select 0)); +private _maxLength = abs ((_p2 select 1) - (_p1 select 1)); +private _direction = getDir _object; + +// Marker name unique to this trench object +private _markerNameStr = format ["acex_fortify_marker_%1", _object]; + +// Create marker, but only for side of trench placer +private _marker = createMarker [_markerNameStr, _object]; +_marker setMarkerShapeLocal "RECTANGLE"; +_marker setMarkerBrushLocal "SolidFull"; +_marker setMarkerSizeLocal [(_maxWidth / 2),(_maxLength / 2)]; +_marker setMarkerDirLocal _direction; +_marker setMarkerColor "ColorGrey"; +_object setVariable [QGVAR(mapMarker), _marker, true]; +// Marker Alpha set in EH: +private _jipID = [QGVAR(setMarkerVisible), _object] call CBA_fnc_globalEventJIP; +[_jipID, _object] call CBA_fnc_removeGlobalEventJIP; + +_object addEventHandler ["Deleted", { + params ["_object"]; + private _marker = _object getVariable QGVAR(mapMarker); + deleteMarker _marker; +}]; diff --git a/addons/fortify/functions/fnc_deployConfirm.sqf b/addons/fortify/functions/fnc_deployConfirm.sqf index 4e08a891..8a30a6e5 100644 --- a/addons/fortify/functions/fnc_deployConfirm.sqf +++ b/addons/fortify/functions/fnc_deployConfirm.sqf @@ -31,10 +31,11 @@ private _vectorDir = vectorDir _object; deleteVehicle _object; private _newObject = _typeOf createVehicle _posASL; +_newObject setVariable [QGVAR(objectSide), _side, true]; _newObject setPosASL _posASL; _newObject setVectorDirAndUp [_vectorDir, _vectorUp]; -// Server will use this event to run the jip compatible QGVAR(addActionToObject) event +// Server will use this event to run the jip compatible QGVAR(addActionToObject) event and create the related map marker. [QGVAR(objectPlaced), [_unit, _side, _newObject]] call CBA_fnc_globalEvent; if (cba_events_control) then { diff --git a/addons/fortify/initSettings.sqf b/addons/fortify/initSettings.sqf index 779365db..1f7fd44f 100644 --- a/addons/fortify/initSettings.sqf +++ b/addons/fortify/initSettings.sqf @@ -9,3 +9,17 @@ 2 ] ] call CBA_settings_fnc_init; +[ + QGVAR(markObjectsOnMap), + "LIST", + [LLSTRING(markObjectsOnMap), LLSTRING(markObjectsOnMapDesc)], + LLSTRING(settingsCategory), + [ + [0, 1, 2], + [LLSTRING(markObjectsOnMapNone), LLSTRING(markObjectsOnMapFriendly), LLSTRING(markObjectsOnMapEveryone)], + 1 + ], + true, + {}, + true +] call CBA_settings_fnc_init; diff --git a/addons/fortify/stringtable.xml b/addons/fortify/stringtable.xml index 8405bf4e..7ff0e5b6 100644 --- a/addons/fortify/stringtable.xml +++ b/addons/fortify/stringtable.xml @@ -155,6 +155,21 @@ Показывать всегда Her Zaman Göster + + Create map markers + + + Controls when budget update hints are shown + + + Never + + + Only for friendlies + + + Show for everyone + Small Małe From edb17eca09e4449e0d85c95fd54e88139039dadb Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Tue, 20 Apr 2021 23:25:08 +0100 Subject: [PATCH 02/15] Fix side handling --- addons/fortify/XEH_postInit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/fortify/XEH_postInit.sqf b/addons/fortify/XEH_postInit.sqf index 1a94a246..67dc13ee 100644 --- a/addons/fortify/XEH_postInit.sqf +++ b/addons/fortify/XEH_postInit.sqf @@ -71,7 +71,7 @@ GVAR(objectRotationZ) = 0; {!isNull player}, { params ["_object"]; - if (GVAR(markObjectsOnMap) isEqualTo 2 || {[_object getVariable QGVAR(objectSide), side group player] call BIS_fnc_sideIsEnemy}) then { + if (GVAR(markObjectsOnMap) isEqualTo 1 || {[_object getVariable QGVAR(objectSide), side group player] call BIS_fnc_sideIsEnemy}) then { private _marker = _object getVariable QGVAR(mapMarker); _marker setMarkerAlpha 0; }; From abeefe0e40425b68beefdc322bac41eb05d24274 Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Tue, 20 Apr 2021 23:29:00 +0100 Subject: [PATCH 03/15] Fix out of date comments --- addons/fortify/functions/fnc_createObjectMarker.sqf | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/fortify/functions/fnc_createObjectMarker.sqf b/addons/fortify/functions/fnc_createObjectMarker.sqf index 187957c3..0d568081 100644 --- a/addons/fortify/functions/fnc_createObjectMarker.sqf +++ b/addons/fortify/functions/fnc_createObjectMarker.sqf @@ -6,13 +6,12 @@ * * Arguments: * 0: Created fortify object - * 1: Friendly side * * Return Value: * None * * Example: - * [_object, _side] call acex_fortify_fnc_createObjectMarker + * _object call acex_fortify_fnc_createObjectMarker * * Public: Yes */ @@ -27,10 +26,10 @@ private _maxWidth = abs ((_p2 select 0) - (_p1 select 0)); private _maxLength = abs ((_p2 select 1) - (_p1 select 1)); private _direction = getDir _object; -// Marker name unique to this trench object +// Marker name unique to this object private _markerNameStr = format ["acex_fortify_marker_%1", _object]; -// Create marker, but only for side of trench placer +// Create marker, set alpha using global event private _marker = createMarker [_markerNameStr, _object]; _marker setMarkerShapeLocal "RECTANGLE"; _marker setMarkerBrushLocal "SolidFull"; From 0bccc9f2efa9b00eef3b6ffb4a37450c5719a28c Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Tue, 20 Apr 2021 23:49:52 +0100 Subject: [PATCH 04/15] Fix stringtable --- addons/fortify/stringtable.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/fortify/stringtable.xml b/addons/fortify/stringtable.xml index 7ff0e5b6..81502844 100644 --- a/addons/fortify/stringtable.xml +++ b/addons/fortify/stringtable.xml @@ -159,16 +159,16 @@ Create map markers - Controls when budget update hints are shown + Create map area markers akin to terrain buildings when an ACEX static object is placed. Never - Only for friendlies + For friendlies only - Show for everyone + For everyone Small From 08a4f845312b1b01983fa66e840c7f6583bd0742 Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Tue, 20 Apr 2021 23:53:55 +0100 Subject: [PATCH 05/15] Update fnc_createObjectMarker.sqf --- addons/fortify/functions/fnc_createObjectMarker.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/fortify/functions/fnc_createObjectMarker.sqf b/addons/fortify/functions/fnc_createObjectMarker.sqf index 0d568081..80764d1d 100644 --- a/addons/fortify/functions/fnc_createObjectMarker.sqf +++ b/addons/fortify/functions/fnc_createObjectMarker.sqf @@ -13,7 +13,7 @@ * Example: * _object call acex_fortify_fnc_createObjectMarker * - * Public: Yes + * Public: No */ params ["_object"]; @@ -27,10 +27,10 @@ private _maxLength = abs ((_p2 select 1) - (_p1 select 1)); private _direction = getDir _object; // Marker name unique to this object -private _markerNameStr = format ["acex_fortify_marker_%1", _object]; +private _markerNameStr = format [QGVAR(marker_%1), _object]; // Create marker, set alpha using global event -private _marker = createMarker [_markerNameStr, _object]; +private _marker = createMarkerLocal [_markerNameStr, _object]; _marker setMarkerShapeLocal "RECTANGLE"; _marker setMarkerBrushLocal "SolidFull"; _marker setMarkerSizeLocal [(_maxWidth / 2),(_maxLength / 2)]; From fbd9e101147b964ce4b205d091b32f818db35443 Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Wed, 21 Apr 2021 00:00:07 +0100 Subject: [PATCH 06/15] Update XEH_postInit.sqf --- addons/fortify/XEH_postInit.sqf | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/fortify/XEH_postInit.sqf b/addons/fortify/XEH_postInit.sqf index 67dc13ee..f8126d41 100644 --- a/addons/fortify/XEH_postInit.sqf +++ b/addons/fortify/XEH_postInit.sqf @@ -7,7 +7,9 @@ if (isServer) then { TRACE_3("objectPlaced",_unit,_side,_object); private _jipID = [QGVAR(addActionToObject), [_side, _object]] call CBA_fnc_globalEventJIP; [_jipID, _object] call CBA_fnc_removeGlobalEventJIP; // idealy this function should be called on the server - if (GVAR(markObjectsOnMap) isNotEqualTo 0 && {_object isKindOf "Static"}) then {[_object] call FUNC(createObjectMarker)}; + if (GVAR(markObjectsOnMap) isNotEqualTo 0 && {_object isKindOf "Static"}) then { + [_object] call FUNC(createObjectMarker) + }; }] call CBA_fnc_addEventHandler; }; @@ -71,7 +73,10 @@ GVAR(objectRotationZ) = 0; {!isNull player}, { params ["_object"]; - if (GVAR(markObjectsOnMap) isEqualTo 1 || {[_object getVariable QGVAR(objectSide), side group player] call BIS_fnc_sideIsEnemy}) then { + private _objectSide = _object getVariable QGVAR(objectSide); + private _playerSide = side group player; + // If enemy placed object, hide marker. + if (GVAR(markObjectsOnMap) isEqualTo 1 || {_objectSide getFriend _playerSide < 0.6}) then { private _marker = _object getVariable QGVAR(mapMarker); _marker setMarkerAlpha 0; }; From 7d73d4e932478839460f23910eefa38f5ceb3a04 Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Wed, 21 Apr 2021 00:04:20 +0100 Subject: [PATCH 07/15] Update fnc_createObjectMarker.sqf --- addons/fortify/functions/fnc_createObjectMarker.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/fortify/functions/fnc_createObjectMarker.sqf b/addons/fortify/functions/fnc_createObjectMarker.sqf index 80764d1d..62fa3698 100644 --- a/addons/fortify/functions/fnc_createObjectMarker.sqf +++ b/addons/fortify/functions/fnc_createObjectMarker.sqf @@ -2,7 +2,7 @@ /* * Author: Seb - * Creates a map marker for a created static object but only for sides friendly to the creator side + * Creates a map marker for a created static object but only for sides friendly to the creator side. * * Arguments: * 0: Created fortify object From 59c2fe318f9160594e267b1d6da26063ccf4d61d Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Wed, 21 Apr 2021 00:11:31 +0100 Subject: [PATCH 08/15] Fix side handling. --- addons/fortify/XEH_postInit.sqf | 2 +- addons/fortify/initSettings.sqf | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/fortify/XEH_postInit.sqf b/addons/fortify/XEH_postInit.sqf index f8126d41..e2f47388 100644 --- a/addons/fortify/XEH_postInit.sqf +++ b/addons/fortify/XEH_postInit.sqf @@ -76,7 +76,7 @@ GVAR(objectRotationZ) = 0; private _objectSide = _object getVariable QGVAR(objectSide); private _playerSide = side group player; // If enemy placed object, hide marker. - if (GVAR(markObjectsOnMap) isEqualTo 1 || {_objectSide getFriend _playerSide < 0.6}) then { + if (GVAR(markObjectsOnMap) isNotEqualTo 2 || {_objectSide getFriend _playerSide < 0.6}) then { private _marker = _object getVariable QGVAR(mapMarker); _marker setMarkerAlpha 0; }; diff --git a/addons/fortify/initSettings.sqf b/addons/fortify/initSettings.sqf index 1f7fd44f..84a3eda8 100644 --- a/addons/fortify/initSettings.sqf +++ b/addons/fortify/initSettings.sqf @@ -9,6 +9,7 @@ 2 ] ] call CBA_settings_fnc_init; + [ QGVAR(markObjectsOnMap), "LIST", From b55b73e8cf2b2302165bc8c9130edc9be6539dc0 Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Wed, 21 Apr 2021 00:12:59 +0100 Subject: [PATCH 09/15] settings_fnc_init -> fnc_addsetting --- addons/fortify/initSettings.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/fortify/initSettings.sqf b/addons/fortify/initSettings.sqf index 84a3eda8..6dc2dac6 100644 --- a/addons/fortify/initSettings.sqf +++ b/addons/fortify/initSettings.sqf @@ -8,7 +8,7 @@ [LLSTRING(settingHintNone), LLSTRING(settingHintHasTool), LLSTRING(settingHintEveryone)], 2 ] -] call CBA_settings_fnc_init; +] call CBA_fnc_addSetting; [ QGVAR(markObjectsOnMap), @@ -23,4 +23,4 @@ true, {}, true -] call CBA_settings_fnc_init; +] call CBA_fnc_addSetting; From 9ec402c300226385747b34208835e859968420bd Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Wed, 21 Apr 2021 00:19:29 +0100 Subject: [PATCH 10/15] Actually fix side handling --- addons/fortify/XEH_postInit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/fortify/XEH_postInit.sqf b/addons/fortify/XEH_postInit.sqf index e2f47388..156980b7 100644 --- a/addons/fortify/XEH_postInit.sqf +++ b/addons/fortify/XEH_postInit.sqf @@ -76,7 +76,7 @@ GVAR(objectRotationZ) = 0; private _objectSide = _object getVariable QGVAR(objectSide); private _playerSide = side group player; // If enemy placed object, hide marker. - if (GVAR(markObjectsOnMap) isNotEqualTo 2 || {_objectSide getFriend _playerSide < 0.6}) then { + if (GVAR(markObjectsOnMap) isEqualTo 1 && {_objectSide getFriend _playerSide < 0.6}) then { private _marker = _object getVariable QGVAR(mapMarker); _marker setMarkerAlpha 0; }; From 6d3084bd7d2830ba0a7c9e2434d3a7236688e502 Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Wed, 28 Apr 2021 16:28:55 +0100 Subject: [PATCH 11/15] Use setMarkerAlphaLocal --- addons/fortify/XEH_postInit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/fortify/XEH_postInit.sqf b/addons/fortify/XEH_postInit.sqf index 156980b7..9d2e03bc 100644 --- a/addons/fortify/XEH_postInit.sqf +++ b/addons/fortify/XEH_postInit.sqf @@ -78,7 +78,7 @@ GVAR(objectRotationZ) = 0; // If enemy placed object, hide marker. if (GVAR(markObjectsOnMap) isEqualTo 1 && {_objectSide getFriend _playerSide < 0.6}) then { private _marker = _object getVariable QGVAR(mapMarker); - _marker setMarkerAlpha 0; + _marker setMarkerAlphaLocal 0; }; }, _object From 47ff80b422049e6ebc0d1997784926ac3db40435 Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Wed, 28 Apr 2021 18:13:03 +0100 Subject: [PATCH 12/15] Add player side handling --- addons/fortify/XEH_postInit.sqf | 24 ++++++++++++++----- .../functions/fnc_createObjectMarker.sqf | 8 ++++++- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/addons/fortify/XEH_postInit.sqf b/addons/fortify/XEH_postInit.sqf index 9d2e03bc..36d269ba 100644 --- a/addons/fortify/XEH_postInit.sqf +++ b/addons/fortify/XEH_postInit.sqf @@ -1,6 +1,8 @@ #include "script_component.hpp" if (isServer) then { + GVAR(markerObjectHashmap) = createHashMap; + publicVariable QGVAR(markerObjectHashmap); [QGVAR(registerObjects), LINKFUNC(registerObjects)] call CBA_fnc_addEventHandler; [QGVAR(objectPlaced), { params ["_unit", "_side", "_object"]; @@ -73,14 +75,24 @@ GVAR(objectRotationZ) = 0; {!isNull player}, { params ["_object"]; + private _currentUnit = call CBA_fnc_currentUnit; private _objectSide = _object getVariable QGVAR(objectSide); - private _playerSide = side group player; - // If enemy placed object, hide marker. - if (GVAR(markObjectsOnMap) isEqualTo 1 && {_objectSide getFriend _playerSide < 0.6}) then { - private _marker = _object getVariable QGVAR(mapMarker); - _marker setMarkerAlphaLocal 0; - }; + private _playerSide = side group _currentUnit; + private _marker = _object getVariable QGVAR(mapMarker); + // If enemy placed object, hide marker, else set visible + private _alpha = if (GVAR(markObjectsOnMap) isEqualTo 1 && {_objectSide getFriend _playerSide < 0.6}) then {0} else {1}; + _marker setMarkerAlphaLocal _alpha; }, _object ] call CBA_fnc_waitUntilAndExecute; }] call CBA_fnc_addEventHandler; + + +// Reset map marker alphas when the side of the controlled unit changes. +["group", { + systemChat "Running map change"; + { + private _object = _y; + [QGVAR(setMarkerVisible), _object] call CBA_fnc_localEvent; + } forEach GVAR(markerObjectHashmap); +}] call CBA_fnc_addPlayerEventHandler; \ No newline at end of file diff --git a/addons/fortify/functions/fnc_createObjectMarker.sqf b/addons/fortify/functions/fnc_createObjectMarker.sqf index 62fa3698..66e56749 100644 --- a/addons/fortify/functions/fnc_createObjectMarker.sqf +++ b/addons/fortify/functions/fnc_createObjectMarker.sqf @@ -26,7 +26,7 @@ private _maxWidth = abs ((_p2 select 0) - (_p1 select 0)); private _maxLength = abs ((_p2 select 1) - (_p1 select 1)); private _direction = getDir _object; -// Marker name unique to this object +// Marker name unique to this object, add it to a hashmap that matches map markers to objects. private _markerNameStr = format [QGVAR(marker_%1), _object]; // Create marker, set alpha using global event @@ -37,12 +37,18 @@ _marker setMarkerSizeLocal [(_maxWidth / 2),(_maxLength / 2)]; _marker setMarkerDirLocal _direction; _marker setMarkerColor "ColorGrey"; _object setVariable [QGVAR(mapMarker), _marker, true]; + // Marker Alpha set in EH: private _jipID = [QGVAR(setMarkerVisible), _object] call CBA_fnc_globalEventJIP; [_jipID, _object] call CBA_fnc_removeGlobalEventJIP; +GVAR(markerObjectHashmap) set [_marker, _object]; +publicVariable QGVAR(markerObjectHashmap); + _object addEventHandler ["Deleted", { params ["_object"]; private _marker = _object getVariable QGVAR(mapMarker); + GVAR(markerObjectHashmap) deleteAt _marker; deleteMarker _marker; + publicVariable QGVAR(markerObjectHashmap); }]; From e76bc5e23342a7cd5ea80f17b9bf383f2d8beb53 Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Wed, 28 Apr 2021 18:20:53 +0100 Subject: [PATCH 13/15] Introduce wait for marker creation Object position and rotation can be slightly off when on a server because the object is moved after creation, so wait a little. --- addons/fortify/XEH_postInit.sqf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/fortify/XEH_postInit.sqf b/addons/fortify/XEH_postInit.sqf index 36d269ba..5f1cf6d7 100644 --- a/addons/fortify/XEH_postInit.sqf +++ b/addons/fortify/XEH_postInit.sqf @@ -10,7 +10,12 @@ if (isServer) then { private _jipID = [QGVAR(addActionToObject), [_side, _object]] call CBA_fnc_globalEventJIP; [_jipID, _object] call CBA_fnc_removeGlobalEventJIP; // idealy this function should be called on the server if (GVAR(markObjectsOnMap) isNotEqualTo 0 && {_object isKindOf "Static"}) then { - [_object] call FUNC(createObjectMarker) + // Wait ensures correct marker pos/rot as object is moved into position after creation + [ + {_this call FUNC(createObjectMarker)}, + _object, + 1 + ] call CBA_fnc_waitAndExecute; }; }] call CBA_fnc_addEventHandler; }; From f26897535a81caa2d958870261b2bc5f2ebba013 Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Wed, 28 Apr 2021 18:29:49 +0100 Subject: [PATCH 14/15] Update stringtable.xml --- addons/fortify/stringtable.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/fortify/stringtable.xml b/addons/fortify/stringtable.xml index 81502844..7cfffc00 100644 --- a/addons/fortify/stringtable.xml +++ b/addons/fortify/stringtable.xml @@ -159,13 +159,13 @@ Create map markers - Create map area markers akin to terrain buildings when an ACEX static object is placed. + Create map markers that look like terrain buildings when static fortifications are placed Never - For friendlies only + For units friendly to the placer For everyone From 49e9fb953f968335981df8949493fd03e7ec095a Mon Sep 17 00:00:00 2001 From: Seb <65898127+Seb105@users.noreply.github.com> Date: Wed, 28 Apr 2021 21:31:24 +0100 Subject: [PATCH 15/15] Remove debug text --- addons/fortify/XEH_postInit.sqf | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/fortify/XEH_postInit.sqf b/addons/fortify/XEH_postInit.sqf index 5f1cf6d7..f3a237f7 100644 --- a/addons/fortify/XEH_postInit.sqf +++ b/addons/fortify/XEH_postInit.sqf @@ -95,7 +95,6 @@ GVAR(objectRotationZ) = 0; // Reset map marker alphas when the side of the controlled unit changes. ["group", { - systemChat "Running map change"; { private _object = _y; [QGVAR(setMarkerVisible), _object] call CBA_fnc_localEvent;