From c2b3e817b58f8b5cab3fa97c4f027a41e1d6e32a Mon Sep 17 00:00:00 2001 From: A Man Date: Thu, 23 Dec 2021 16:43:39 +0100 Subject: [PATCH] Update plot pole boundary to works better with the new build system Mady by @Victor-the-Cleaner --- .../plotManagement/plotToggleMarkers.sqf | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/SQF/dayz_code/actions/plotManagement/plotToggleMarkers.sqf b/SQF/dayz_code/actions/plotManagement/plotToggleMarkers.sqf index cf9c711e8..34c0fe3a5 100644 --- a/SQF/dayz_code/actions/plotManagement/plotToggleMarkers.sqf +++ b/SQF/dayz_code/actions/plotManagement/plotToggleMarkers.sqf @@ -15,9 +15,15 @@ // /////////////////////////////////////////////////////////////////////////////////////////////////// local _pos = [player] call FNC_getPos; // player position -local _plot = (_pos nearEntities ["Plastic_Pole_EP1_DZ", 15]) select 0; // get nearest plot +local _plot = objNull; // initialize local _toggle = false; // turn plot boundary on/off +local _count = count _this; // parameter list +if (_count > 0) then { // may be called from fn_selfActions + _plot = _this select (_count -1); // or modular_build +} else { + _plot = (_pos nearEntities ["Plastic_Pole_EP1_DZ", 15]) select 0; // or via the Dome button +}; if (!isNil "PP_Marks") then { if (((PP_Marks select 0) distance _plot) < 10) then {_toggle = true}; // if helpers exist @@ -33,6 +39,7 @@ if (!isNil "PP_Marks") then { if ((isNil "PP_Marks") && !_toggle) then { + local _dir = getDir _plot; local _radius = DZE_PlotPole select 0; // plot radius local _density = 3; // helper density per ring local _count = round((2 * pi * _radius) / _density); // initial count per ring @@ -49,12 +56,14 @@ if ((isNil "PP_Marks") && !_toggle) then { _color set [1, DZE_plotRed]; // red color if too high }; - local _obj = "Sign_sphere25cm_EP1" createVehicleLocal [0,0,0]; - _obj setObjectTexture DZE_plotGreen; // add color - _obj setPos ([_plot] call FNC_getPos); // move + local _center = "Sign_sphere10cm_EP1" createVehicleLocal [0,0,0]; + _center setObjectTexture DZE_plotGreen; // add color + _center attachTo [_plot, [0,0,0]]; // move to model center + uiSleep 0.01; // allow time to attach + local _origin = getPosASL _center; // exact center PP_Marks = []; // global array to record plot pole helpers - PP_Marks set [0, _obj]; // record parent object + PP_Marks set [0, _center]; // record parent object /////////////////////////////////////////////////////////////////////////////////////////// // @@ -79,21 +88,25 @@ if ((isNil "PP_Marks") && !_toggle) then { _v = _v + [[0, _a, _b], [_d, _d, _b], [-_d, _d, _b]]; }; }; + /////////////////////////////////////////////////////////////////////////// // // realign and draw each ring // /////////////////////////////////////////////////////////////////////////// { - local _vN = _plot modelToWorld _x; // realign + local _rotation = [_x, -_dir] call BIS_fnc_rotateVector2D; // align to plot pole + local _position = [_origin, _rotation] call BIS_fnc_vectorAdd; // vector offset + local _zCheck = +_position; // ASL + if !(surfaceIsWater _position) then {_zCheck = ASLToATL _zCheck;}; // ATL - local _height = _vN select 2; // ATL Z - if (_height > -0.5) then { // if aboveground + local _height = _zCheck select 2; // Z height + if (_height > -0.5) then { // if above terrain/sea _obj = "Sign_sphere100cm_EP1" createVehicleLocal [0,0,0]; // create _col = _color select (_height > DZE_BuildHeightLimit); // if too high _obj setObjectTexture _col; // change color - _obj setPosASL (ATLToASL _vN); // move + _obj setPosASL _position; // draw PP_Marks set [count PP_Marks, _obj]; // record object };