From edd53597b0cc8e804291f4877a5786e2444d4843 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Fri, 20 May 2016 12:14:48 -0400 Subject: [PATCH] Don't pass DZE_plotManagement to fn_check_owner The whole point of a global variable is you do not need to pass it. DZE_plotManagement and DZE_plotmanagementAdmins are always defined and do not change, so there is no need to pass them as parameters. --- .../actions/A_Plot_for_Life/plot_take_ownership.sqf | 4 ++-- SQF/dayz_code/actions/player_buildingDowngrade.sqf | 2 +- SQF/dayz_code/actions/player_upgrade.sqf | 2 +- SQF/dayz_code/actions/remove.sqf | 2 +- .../compile/A_Plot_for_Life/fn_check_owner.sqf | 5 ++--- SQF/dayz_code/compile/dze_buildChecks.sqf | 2 +- SQF/dayz_code/compile/dze_getPlotFriends.sqf | 10 +++++----- SQF/dayz_code/compile/fn_damageActions.sqf | 2 +- SQF/dayz_code/compile/fn_selfActions.sqf | 6 +++--- 9 files changed, 17 insertions(+), 18 deletions(-) diff --git a/SQF/dayz_code/actions/A_Plot_for_Life/plot_take_ownership.sqf b/SQF/dayz_code/actions/A_Plot_for_Life/plot_take_ownership.sqf index f56a127f1..c9874b031 100644 --- a/SQF/dayz_code/actions/A_Plot_for_Life/plot_take_ownership.sqf +++ b/SQF/dayz_code/actions/A_Plot_for_Life/plot_take_ownership.sqf @@ -15,7 +15,7 @@ _changecount = 0; // Check is owner of the plot pole. -_isowner = [player, _plotpole, DZE_plotManagement] call FNC_check_owner; +_isowner = [player, _plotpole] call FNC_check_owner; _itemsExist = false; if ((_isowner select 0 )) then { @@ -25,7 +25,7 @@ if ((_isowner select 0 )) then { _classname = typeOf _object; if (_classname in DZE_plotTakeOwnershipItems)then { - _isowner = [player, _object, DZE_plotManagement] call FNC_check_owner; + _isowner = [player, _object] call FNC_check_owner; diag_log text "Plot Take Ownership: Object in DZE_plotTakeOwnershipItems"; if !( _isowner select 0 ) then{ diff --git a/SQF/dayz_code/actions/player_buildingDowngrade.sqf b/SQF/dayz_code/actions/player_buildingDowngrade.sqf index fdf332f31..2ce3541c0 100644 --- a/SQF/dayz_code/actions/player_buildingDowngrade.sqf +++ b/SQF/dayz_code/actions/player_buildingDowngrade.sqf @@ -27,7 +27,7 @@ if(_IsNearPlot == 0) then { _canBuildOnPlot = true; } else { if (DZE_plotManagement || DZE_plotforLife) then { - _buildcheck = [player, _nearestPole, DZE_plotManagement] call FNC_check_owner; + _buildcheck = [player, _nearestPole] call FNC_check_owner; _isowner = _buildcheck select 0; _isfriendly = _buildcheck select 1; if (_isowner || _isfriendly) then { diff --git a/SQF/dayz_code/actions/player_upgrade.sqf b/SQF/dayz_code/actions/player_upgrade.sqf index 490522fa3..0eec99eb1 100644 --- a/SQF/dayz_code/actions/player_upgrade.sqf +++ b/SQF/dayz_code/actions/player_upgrade.sqf @@ -26,7 +26,7 @@ if(_IsNearPlot == 0) then { _canBuildOnPlot = true; } else { if (DZE_plotManagement || DZE_plotforLife) then { - _buildcheck = [player, _nearestPole, DZE_plotManagement] call FNC_check_owner; + _buildcheck = [player, _nearestPole] call FNC_check_owner; _isowner = _buildcheck select 0; _isfriendly = _buildcheck select 1; if (_isowner || _isfriendly) then { diff --git a/SQF/dayz_code/actions/remove.sqf b/SQF/dayz_code/actions/remove.sqf index eba63dbdd..aa073f683 100644 --- a/SQF/dayz_code/actions/remove.sqf +++ b/SQF/dayz_code/actions/remove.sqf @@ -60,7 +60,7 @@ _nearestPole = _plotcheck select 2; if(_IsNearPlot >= 1) then { // Since there are plot poles nearby we need to check ownership && friend status - _buildcheck = [player, _nearestPole, DZE_plotManagement] call FNC_check_owner; + _buildcheck = [player, _nearestPole] call FNC_check_owner; _isowner = _buildcheck select 0; _isfriendly = _buildcheck select 1; if (!_isowner && !_isfriendly) then { diff --git a/SQF/dayz_code/compile/A_Plot_for_Life/fn_check_owner.sqf b/SQF/dayz_code/compile/A_Plot_for_Life/fn_check_owner.sqf index de81bcbb2..ef53718a6 100644 --- a/SQF/dayz_code/compile/A_Plot_for_Life/fn_check_owner.sqf +++ b/SQF/dayz_code/compile/A_Plot_for_Life/fn_check_owner.sqf @@ -4,15 +4,14 @@ private ["_player","_object","_playerUID","_ObjectOwner","_owner","_friendlies", _player = _this select 0; _Object = _this select 1; -_PlotManagement = _this select 2; _Owner = false; _friendly = false; _friendlies = []; _ObjectOwner = "0"; -if (_PlotManagement) then { - _friendlies = [_Object, true, false] call dze_getPlotFriends; +if (DZE_plotManagement) then { + _friendlies = [_Object, true] call dze_getPlotFriends; } else { _friendlies = _player getVariable ["friendlyTo",[]]; }; diff --git a/SQF/dayz_code/compile/dze_buildChecks.sqf b/SQF/dayz_code/compile/dze_buildChecks.sqf index d6c7d6fc6..7b76035eb 100644 --- a/SQF/dayz_code/compile/dze_buildChecks.sqf +++ b/SQF/dayz_code/compile/dze_buildChecks.sqf @@ -42,7 +42,7 @@ if(_IsNearPlot == 0) then { _canBuild = true; } else { if (DZE_plotManagement || DZE_plotforLife) then { - _buildcheck = [player, _nearestPole, DZE_plotManagement] call FNC_check_owner; + _buildcheck = [player, _nearestPole] call FNC_check_owner; _isowner = _buildcheck select 0; _isfriendly = _buildcheck select 1; if (_isowner || _isfriendly) then { diff --git a/SQF/dayz_code/compile/dze_getPlotFriends.sqf b/SQF/dayz_code/compile/dze_getPlotFriends.sqf index 3a4309641..a07d7c170 100644 --- a/SQF/dayz_code/compile/dze_getPlotFriends.sqf +++ b/SQF/dayz_code/compile/dze_getPlotFriends.sqf @@ -1,13 +1,13 @@ /************************************************************************************************************************************************ -This file is used to obtain plot pole owners and friends, which includes plot management admins depending on the third array element passed to the script +This file is used to obtain plot pole owners and friends, which includes plot management admins. You should NOT call this file directly, you should call FNC_check_owner as below to obtain a list of the plot owner and friends. -[player, _nearestPole, DZE_plotManagement] call FNC_check_owner; +[player, _cursorTarget] call FNC_check_owner; ************************************************************************************************************************************************/ -private ["_findNearestPoles","_AdminAccess","_IsNearPlot","_pole","_friendUID","_owner","_allowed","_friends","_FindNearestPole"]; +private ["_findNearestPoles","_IsNearPlot","_pole","_friendUID","_owner","_allowed","_friends","_FindNearestPole"]; _pole = _this select 0; _FindNearestPole = _this select 1; -_AdminAccess = _this select 2; + _IsNearPlot = 0; _allowed = []; if (_FindNearestPole) then { @@ -23,7 +23,7 @@ if(!_FindNearestPole || {_IsNearPlot > 0}) then { _friendUID = _x select 0; _allowed set [(count _allowed), _friendUID]; } count _friends; - if (_AdminAccess) then { + if (count DZE_PlotManagementAdmins > 0) then { _allowed = _allowed + DZE_PlotManagementAdmins; }; }; diff --git a/SQF/dayz_code/compile/fn_damageActions.sqf b/SQF/dayz_code/compile/fn_damageActions.sqf index b910c7bb7..9a1d5f895 100644 --- a/SQF/dayz_code/compile/fn_damageActions.sqf +++ b/SQF/dayz_code/compile/fn_damageActions.sqf @@ -215,7 +215,7 @@ if (isPlayer cursorTarget) then { if (DZE_plotforLife) then { _charID = [_unit] call FNC_GetPlayerUID; }; - _friendlies = [player, _unit, DZE_plotManagement] call FNC_check_owner; + _friendlies = [player, _unit] call FNC_check_owner; if !(_charID in _friendlies) then { r_action = true; _action = _unit addAction ["Tag as friendly", "\z\addons\dayz_code\actions\player_tagFriendly.sqf", [], 0, false, true]; diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf index 568ea5e57..e04430515 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -420,7 +420,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur if(_isModular || _isModularDoor || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then { if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then { - _isowner = [player, _cursorTarget, DZE_plotManagement] call FNC_check_owner; //compile also calls dze_getPlotFriends and lists s_player_plotManagement friendlies + _isowner = [player, _cursorTarget] call FNC_check_owner; //compile also calls dze_getPlotFriends and lists s_player_plotManagement friendlies If ((_isowner select 0) || (_isowner select 1)) then { _player_deleteBuild = true; }; @@ -633,7 +633,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur if ((_cursorTarget isKindOf "Plastic_Pole_EP1_DZ") && {_canDo && speed player <= 1}) then { if( DZE_plotManagement || DZE_plotforLife) then { if (s_player_plotManagement < 0) then { - _isowner = [player, _cursorTarget, DZE_plotManagement] call FNC_check_owner; //compile also calls dze_getPlotFriends and lists s_player_plotManagement friendlies + _isowner = [player, _cursorTarget] call FNC_check_owner; //compile also calls dze_getPlotFriends and lists s_player_plotManagement friendlies If ((_isowner select 0) || (_isowner select 1)) then { s_player_plot_take_ownership = player addAction ["Take plot items ownership", "\z\addons\dayz_code\actions\A_Plot_for_Life\plot_take_ownership.sqf", "", 1, false]; }; @@ -660,7 +660,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur if (DZE_plotforLife) then { if (s_player_plot_take_ownership < 0) then { if (DZE_PlotOwnership) then { - _isowner = [player, _cursorTarget, DZE_plotManagement] call FNC_check_owner; //compile also calls dze_getPlotFriends and lists s_player_plotManagement friendlies + _isowner = [player, _cursorTarget] call FNC_check_owner; //compile also calls dze_getPlotFriends and lists s_player_plotManagement friendlies If (_isowner select 0) then { s_player_plot_take_ownership = player addAction ["Take plot items ownership", "\z\addons\dayz_code\actions\A_Plot_for_Life\plot_take_ownership.sqf", "", 1, false]; };