Update plot pole boundary to works better with the new build system

Mady by @Victor-the-Cleaner
This commit is contained in:
A Man
2021-12-23 16:43:39 +01:00
parent d744d995ef
commit c2b3e817b5

View File

@@ -15,9 +15,15 @@
// //
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
local _pos = [player] call FNC_getPos; // player position 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 _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 (!isNil "PP_Marks") then {
if (((PP_Marks select 0) distance _plot) < 10) then {_toggle = true}; // if helpers exist 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 { if ((isNil "PP_Marks") && !_toggle) then {
local _dir = getDir _plot;
local _radius = DZE_PlotPole select 0; // plot radius local _radius = DZE_PlotPole select 0; // plot radius
local _density = 3; // helper density per ring local _density = 3; // helper density per ring
local _count = round((2 * pi * _radius) / _density); // initial count 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 _color set [1, DZE_plotRed]; // red color if too high
}; };
local _obj = "Sign_sphere25cm_EP1" createVehicleLocal [0,0,0]; local _center = "Sign_sphere10cm_EP1" createVehicleLocal [0,0,0];
_obj setObjectTexture DZE_plotGreen; // add color _center setObjectTexture DZE_plotGreen; // add color
_obj setPos ([_plot] call FNC_getPos); // move _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 = []; // 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]]; _v = _v + [[0, _a, _b], [_d, _d, _b], [-_d, _d, _b]];
}; };
}; };
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// //
// realign and draw each ring // 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 local _height = _zCheck select 2; // Z height
if (_height > -0.5) then { // if aboveground if (_height > -0.5) then { // if above terrain/sea
_obj = "Sign_sphere100cm_EP1" createVehicleLocal [0,0,0]; // create _obj = "Sign_sphere100cm_EP1" createVehicleLocal [0,0,0]; // create
_col = _color select (_height > DZE_BuildHeightLimit); // if too high _col = _color select (_height > DZE_BuildHeightLimit); // if too high
_obj setObjectTexture _col; // change color _obj setObjectTexture _col; // change color
_obj setPosASL (ATLToASL _vN); // move _obj setPosASL _position; // draw
PP_Marks set [count PP_Marks, _obj]; // record object PP_Marks set [count PP_Marks, _obj]; // record object
}; };