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.
This commit is contained in:
ebaydayz
2016-05-20 12:14:48 -04:00
parent 1a5d26f26d
commit edd53597b0
9 changed files with 17 additions and 18 deletions

View File

@@ -15,7 +15,7 @@ _changecount = 0;
// Check is owner of the plot pole. // 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; _itemsExist = false;
if ((_isowner select 0 )) then { if ((_isowner select 0 )) then {
@@ -25,7 +25,7 @@ if ((_isowner select 0 )) then {
_classname = typeOf _object; _classname = typeOf _object;
if (_classname in DZE_plotTakeOwnershipItems)then { 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"; diag_log text "Plot Take Ownership: Object in DZE_plotTakeOwnershipItems";
if !( _isowner select 0 ) then{ if !( _isowner select 0 ) then{

View File

@@ -27,7 +27,7 @@ if(_IsNearPlot == 0) then {
_canBuildOnPlot = true; _canBuildOnPlot = true;
} else { } else {
if (DZE_plotManagement || DZE_plotforLife) then { 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; _isowner = _buildcheck select 0;
_isfriendly = _buildcheck select 1; _isfriendly = _buildcheck select 1;
if (_isowner || _isfriendly) then { if (_isowner || _isfriendly) then {

View File

@@ -26,7 +26,7 @@ if(_IsNearPlot == 0) then {
_canBuildOnPlot = true; _canBuildOnPlot = true;
} else { } else {
if (DZE_plotManagement || DZE_plotforLife) then { 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; _isowner = _buildcheck select 0;
_isfriendly = _buildcheck select 1; _isfriendly = _buildcheck select 1;
if (_isowner || _isfriendly) then { if (_isowner || _isfriendly) then {

View File

@@ -60,7 +60,7 @@ _nearestPole = _plotcheck select 2;
if(_IsNearPlot >= 1) then { if(_IsNearPlot >= 1) then {
// Since there are plot poles nearby we need to check ownership && friend status // 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; _isowner = _buildcheck select 0;
_isfriendly = _buildcheck select 1; _isfriendly = _buildcheck select 1;
if (!_isowner && !_isfriendly) then { if (!_isowner && !_isfriendly) then {

View File

@@ -4,15 +4,14 @@ private ["_player","_object","_playerUID","_ObjectOwner","_owner","_friendlies",
_player = _this select 0; _player = _this select 0;
_Object = _this select 1; _Object = _this select 1;
_PlotManagement = _this select 2;
_Owner = false; _Owner = false;
_friendly = false; _friendly = false;
_friendlies = []; _friendlies = [];
_ObjectOwner = "0"; _ObjectOwner = "0";
if (_PlotManagement) then { if (DZE_plotManagement) then {
_friendlies = [_Object, true, false] call dze_getPlotFriends; _friendlies = [_Object, true] call dze_getPlotFriends;
} else { } else {
_friendlies = _player getVariable ["friendlyTo",[]]; _friendlies = _player getVariable ["friendlyTo",[]];
}; };

View File

@@ -42,7 +42,7 @@ if(_IsNearPlot == 0) then {
_canBuild = true; _canBuild = true;
} else { } else {
if (DZE_plotManagement || DZE_plotforLife) then { 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; _isowner = _buildcheck select 0;
_isfriendly = _buildcheck select 1; _isfriendly = _buildcheck select 1;
if (_isowner || _isfriendly) then { if (_isowner || _isfriendly) then {

View File

@@ -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. 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; _pole = _this select 0;
_FindNearestPole = _this select 1; _FindNearestPole = _this select 1;
_AdminAccess = _this select 2;
_IsNearPlot = 0; _IsNearPlot = 0;
_allowed = []; _allowed = [];
if (_FindNearestPole) then { if (_FindNearestPole) then {
@@ -23,7 +23,7 @@ if(!_FindNearestPole || {_IsNearPlot > 0}) then {
_friendUID = _x select 0; _friendUID = _x select 0;
_allowed set [(count _allowed), _friendUID]; _allowed set [(count _allowed), _friendUID];
} count _friends; } count _friends;
if (_AdminAccess) then { if (count DZE_PlotManagementAdmins > 0) then {
_allowed = _allowed + DZE_PlotManagementAdmins; _allowed = _allowed + DZE_PlotManagementAdmins;
}; };
}; };

View File

@@ -215,7 +215,7 @@ if (isPlayer cursorTarget) then {
if (DZE_plotforLife) then { if (DZE_plotforLife) then {
_charID = [_unit] call FNC_GetPlayerUID; _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 { if !(_charID in _friendlies) then {
r_action = true; r_action = true;
_action = _unit addAction ["Tag as friendly", "\z\addons\dayz_code\actions\player_tagFriendly.sqf", [], 0, false, true]; _action = _unit addAction ["Tag as friendly", "\z\addons\dayz_code\actions\player_tagFriendly.sqf", [], 0, false, true];

View File

@@ -420,7 +420,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
if(_isModular || _isModularDoor || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then { if(_isModular || _isModularDoor || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then {
if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) 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 { If ((_isowner select 0) || (_isowner select 1)) then {
_player_deleteBuild = true; _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 ((_cursorTarget isKindOf "Plastic_Pole_EP1_DZ") && {_canDo && speed player <= 1}) then {
if( DZE_plotManagement || DZE_plotforLife) then { if( DZE_plotManagement || DZE_plotforLife) then {
if (s_player_plotManagement < 0) 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 { 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]; 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 (DZE_plotforLife) then {
if (s_player_plot_take_ownership < 0) then { if (s_player_plot_take_ownership < 0) then {
if (DZE_PlotOwnership) 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 { 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]; 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];
}; };