From 746b921321ca4caea0615a09b0617a3de230c580 Mon Sep 17 00:00:00 2001 From: ebayShopper Date: Wed, 29 Mar 2017 16:04:48 -0400 Subject: [PATCH] Use nearEntities for plot pole searches Also made 73899d5 compatible with DZE_permanentPlot = false; at the request of @oiad --- SQF/dayz_code/actions/maintain_area.sqf | 2 +- .../actions/plotManagement/plotAddFriend.sqf | 2 +- .../actions/plotManagement/plotGetFriends.sqf | 2 +- .../actions/plotManagement/plotObjects.sqf | 2 +- .../actions/plotManagement/plotRemoveFriend.sqf | 2 +- .../actions/plotManagement/plotToggleMarkers.sqf | 2 +- SQF/dayz_code/compile/dze_buildChecks.sqf | 8 +++++++- SQF/dayz_code/compile/fn_selfActions.sqf | 2 +- SQF/dayz_code/init/compiles.sqf | 13 ------------- 9 files changed, 14 insertions(+), 21 deletions(-) diff --git a/SQF/dayz_code/actions/maintain_area.sqf b/SQF/dayz_code/actions/maintain_area.sqf index 27bdc6995..cd015a3c5 100644 --- a/SQF/dayz_code/actions/maintain_area.sqf +++ b/SQF/dayz_code/actions/maintain_area.sqf @@ -30,7 +30,7 @@ s_player_maintain_area_force = 1; player removeAction s_player_maintain_area_preview; s_player_maintain_area_preview = 1; -_target = nearestObject [[player] call FNC_getPos,"Plastic_Pole_EP1_DZ"]; +_target = (([player] call FNC_getPos) nearEntities ["Plastic_Pole_EP1_DZ",15]) select 0; _objects = nearestObjects [_target, DZE_maintainClasses, DZE_maintainRange]; _objects_filtered = []; diff --git a/SQF/dayz_code/actions/plotManagement/plotAddFriend.sqf b/SQF/dayz_code/actions/plotManagement/plotAddFriend.sqf index b00ec5939..712e6d2ac 100644 --- a/SQF/dayz_code/actions/plotManagement/plotAddFriend.sqf +++ b/SQF/dayz_code/actions/plotManagement/plotAddFriend.sqf @@ -8,7 +8,7 @@ _friendName = _userList lbText (lbCurSel _userList); if (_friendUID == "") exitWith {}; -_plots = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"],15]; +_plots = ([player] call FNC_getPos) nearEntities ["Plastic_Pole_EP1_DZ",15]; _thePlot = _plots select 0; _friends = _thePlot getVariable ["plotfriends",[]]; diff --git a/SQF/dayz_code/actions/plotManagement/plotGetFriends.sqf b/SQF/dayz_code/actions/plotManagement/plotGetFriends.sqf index 10b779420..de2935d59 100644 --- a/SQF/dayz_code/actions/plotManagement/plotGetFriends.sqf +++ b/SQF/dayz_code/actions/plotManagement/plotGetFriends.sqf @@ -1,7 +1,7 @@ private ["_name","_plots","_friendlies","_thePlot"]; lbClear 7002; -_plots = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"],15]; +_plots = ([player] call FNC_getPos) nearEntities ["Plastic_Pole_EP1_DZ",15]; _thePlot = _plots select 0; _friendlies = _thePlot getVariable ["plotfriends", []]; { diff --git a/SQF/dayz_code/actions/plotManagement/plotObjects.sqf b/SQF/dayz_code/actions/plotManagement/plotObjects.sqf index bd1753e12..fecbb490e 100644 --- a/SQF/dayz_code/actions/plotManagement/plotObjects.sqf +++ b/SQF/dayz_code/actions/plotManagement/plotObjects.sqf @@ -2,7 +2,7 @@ private ["_range","_buildables","_count","_colour","_ctrl","_target"]; disableSerialization; _range = DZE_PlotPole select 0; -_target = nearestObject [[player] call FNC_getPos,"Plastic_Pole_EP1_DZ"]; +_target = (([player] call FNC_getPos) nearEntities ["Plastic_Pole_EP1_DZ",15]) select 0; // Also count safes, lockboxes, vanilla buildables, tents and stashes against DZE_BuildingLimit _buildables = DZE_maintainClasses + DZE_LockableStorage + ["DZ_buildables","DZ_storage_base"]; _count = count (nearestObjects [_target,_buildables,_range]); diff --git a/SQF/dayz_code/actions/plotManagement/plotRemoveFriend.sqf b/SQF/dayz_code/actions/plotManagement/plotRemoveFriend.sqf index 602082c00..cd46e996a 100644 --- a/SQF/dayz_code/actions/plotManagement/plotRemoveFriend.sqf +++ b/SQF/dayz_code/actions/plotManagement/plotRemoveFriend.sqf @@ -2,7 +2,7 @@ private ["_pos","_plots","_thePlot","_friends","_toRemove","_newList"]; _pos = _this select 0; if (_pos < 0) exitWith {}; -_plots = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"],15]; +_plots = ([player] call FNC_getPos) nearEntities ["Plastic_Pole_EP1_DZ",15]; _thePlot = _plots select 0; _friends = _thePlot getVariable ["plotfriends", []]; _toRemove = (_friends select _pos); diff --git a/SQF/dayz_code/actions/plotManagement/plotToggleMarkers.sqf b/SQF/dayz_code/actions/plotManagement/plotToggleMarkers.sqf index bfa3f1ab7..980dec9ce 100644 --- a/SQF/dayz_code/actions/plotManagement/plotToggleMarkers.sqf +++ b/SQF/dayz_code/actions/plotManagement/plotToggleMarkers.sqf @@ -6,7 +6,7 @@ _density = 3; // density of markers per ring _model = "Sign_sphere100cm_EP1"; // marker model to use on rings // Possible ones to use :: Sign_sphere10cm_EP1 Sign_sphere25cm_EP1 Sign_sphere100cm_EP1 -_thePlot = (nearestObjects [player, ["Plastic_Pole_EP1_DZ"],15]) select 0; +_thePlot = (([player] call FNC_getPos) nearEntities ["Plastic_Pole_EP1_DZ",15]) select 0; _center = getPosASL _thePlot; _radius = DZE_PlotPole select 0; _obj = false; diff --git a/SQF/dayz_code/compile/dze_buildChecks.sqf b/SQF/dayz_code/compile/dze_buildChecks.sqf index defb989d8..ae6ed9268 100644 --- a/SQF/dayz_code/compile/dze_buildChecks.sqf +++ b/SQF/dayz_code/compile/dze_buildChecks.sqf @@ -24,7 +24,13 @@ _friendlies = []; if (_isPole) then { _plotcheck = [player, true] call FNC_find_plots; _distance = DZE_PlotPole select 1; - if (DZE_limitPlots && {!((getPlayerUID player) in DZE_PlotManagementAdmins)}) then {_hasPole = call FNC_plotCheck;}; + if (DZE_limitPlots && {!(dayz_playerUID in DZE_PlotManagementAdmins)}) then { + { + if (_x getVariable["ownerPUID","0"] == dayz_playerUID or (_x getVariable["CharacterID","0"] == dayz_characterID)) exitWith { + _hasPole = true; + }; + } count (entities "Plastic_Pole_EP1_DZ"); + }; } else { _plotcheck = [player, false] call FNC_find_plots; _distance = DZE_PlotPole select 0; diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf index f2f5aa3be..7a3c3cbbb 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -613,7 +613,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur player removeAction s_player_breakinhouse; s_player_breakinhouse = -1; };*/ - if ((_cursorTarget isKindOf "Plastic_Pole_EP1_DZ") && {speed player <= 1}) then { + if (_typeOfCursorTarget == "Plastic_Pole_EP1_DZ" && {speed player <= 1}) then { _hasAccess = [player, _cursorTarget] call FNC_check_access; _allowed = ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3) or (_hasAccess select 4)); if (DZE_permanentPlot) then { diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index a692f26f5..e09c2f923 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -606,19 +606,6 @@ if (!isDedicated) then { [(format ["%1
%2
%3
%4",death_1,death_2,death_3,death_4]),(safeZoneX + _offset),safeZoneY,10,0,0,8000] spawn BIS_fnc_dynamicText; }; - fnc_plotCheck = { - private ["_hasPole","_plotFriends"]; - - _hasPole = false; - - { - _plotFriends = _x getVariable ["plotfriends",[]]; - if (((_plotFriends select 0) select 0) == dayz_playerUID) exitWith {_hasPole = true;}; - } count (entities "Plastic_Pole_EP1_DZ"); - - _hasPole - }; - dayz_originalPlayer = player; // database trader menu