Use single config variable for Plot for Life and Plot Management

Plot for Life and Plot Management work best together. They essentially
provide the same functionality. Both let you keep your plot after death
by using UID instead of CharacterID. Plot Management doesn't even have
an option to save characterID, so by default it is always keeping all
friends and the owner permanently until they are removed. The only major
difference between them is Plot For Life also adds permanent ownership
of built items on the plot, which is behavior most people expect. It
doesn't make sense to keep ownership of the plot after death but not the
other objects built on it. The other functionality it adds (take
ownership) can be toggled with a config variable.

It is rare that someone would want Plot For Life enabled, but Plot
Management disabled or vice versa. If they really want that they can
still do it manually, but consolidating them to a single config option
greatly simplifies things for everyone else.

I removed links to mod githubs because many changes have been made to
the 1.0.6 versions, so outdated information there will likely confuse
people. Authors are already credited in the README and change log.

In variables.sqf "DZ_storage_base" is now the parent class which
includes all tents and stashes. DZE_checkNearbyRadius variable is not
used (identical to DZE_PlotPole select 0).
This commit is contained in:
ebaydayz
2016-06-12 12:54:46 -04:00
parent 16c1e9d205
commit 835d750c0c
24 changed files with 90 additions and 104 deletions

View File

@@ -1,32 +1,56 @@
// Check Ownership by RimBlock (http://epochmod.com/forum/index.php?/user/12612-rimblock/)
/*
Check object's ownership and friends
Original concept by RimBlock (github.com/RimBlock)
Parameters:
_this select 0: object - player calling this function
_this select 1: object - target to check ownership and friendlies of
Returns:
_return select 0: bool - player is owner of target object
_return select 1: bool - player is friends with owner of target object
*/
private ["_player","_object","_playerUID","_ObjectOwner","_owner","_friendlies","_friendly"];
private ["_player","_target","_playerUID","_targetOwner","_owner","_friendlies","_friendly","_findNearestPoles","_IsNearPlot","_pole","_friendUID","_ownerID","_friends"];
_player = _this select 0;
_Object = _this select 1;
_Owner = false;
_target = _this select 1;
_owner = false;
_friendly = false;
_friendlies = [];
_ObjectOwner = "0";
_targetOwner = "0";
if (DZE_plotManagement) then {
_friendlies = [_Object, true] call dze_getPlotFriends;
if (DZE_permanentPlot) then {
_pole = _target;
_IsNearPlot = 0;
_findNearestPoles = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];
_IsNearPlot = count _findNearestPoles;
_pole = _findNearestPoles select 0;
if (_IsNearPlot > 0) then {
_ownerID = _pole getVariable ["ownerPUID","0"];
_friendlies = [_ownerID];
_friends = _pole getVariable ["plotfriends", []];
{
_friendUID = _x select 0;
_friendlies set [count _friendlies, _friendUID];
} count _friends;
if (count DZE_PlotManagementAdmins > 0) then {
_friendlies = _friendlies + DZE_PlotManagementAdmins;
};
};
_playerUID = [_player] call FNC_GetPlayerUID;
_targetOwner = _target getVariable ["ownerPUID","0"];
_owner = (_playerUID == _targetOwner);
} else {
_friendlies = _player getVariable ["friendlyTo",[]];
_targetOwner = _target getVariable ["CharacterID","0"];
_owner = (_targetOwner == dayz_characterID);
};
if (DZE_plotforLife) then {
_playerUID = [_player] call FNC_GetPlayerUID;
_ObjectOwner = _object getVariable ["ownerPUID","0"];
_owner = (_playerUID == _ObjectOwner);
} else {
_ObjectOwner = _object getVariable["CharacterID","0"];
_owner = (_ObjectOwner == dayz_characterID);
};
if (_ObjectOwner in _friendlies) then {
if (_targetOwner in _friendlies) then {
_friendly = true;
};
[_owner, _friendly];
[_owner, _friendly]

View File

@@ -41,7 +41,7 @@ if(_IsNearPlot == 0) then {
if(dayz_characterID == _ownerID) then {
_canBuild = true;
} else {
if (DZE_plotManagement || DZE_plotforLife) then {
if (DZE_permanentPlot) then {
_buildcheck = [player, _nearestPole] call FNC_check_owner;
_isowner = _buildcheck select 0;
_isfriendly = _buildcheck select 1;

View File

@@ -1,30 +0,0 @@
/************************************************************************************************************************************************
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, _cursorTarget] call FNC_check_owner;
************************************************************************************************************************************************/
private ["_findNearestPoles","_IsNearPlot","_pole","_friendUID","_owner","_allowed","_friends","_FindNearestPole"];
_pole = _this select 0;
_FindNearestPole = _this select 1;
_IsNearPlot = 0;
_allowed = [];
if (_FindNearestPole) then {
_findNearestPoles = nearestObjects[[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];
_IsNearPlot = count (_findNearestPoles);
_pole = _findNearestPoles select 0;
};
if(!_FindNearestPole || {_IsNearPlot > 0}) then {
_owner = if(DZE_plotforLife) then { _pole getVariable ["ownerPUID","0"]; } else { _pole getVariable ["characterID","0"]; };
_allowed = [_owner];
_friends = _pole getVariable ["plotfriends", []];
{
_friendUID = _x select 0;
_allowed set [(count _allowed), _friendUID];
} count _friends;
if (count DZE_PlotManagementAdmins > 0) then {
_allowed = _allowed + DZE_PlotManagementAdmins;
};
};
_allowed;

View File

@@ -212,7 +212,7 @@ if (isPlayer cursorTarget) then {
if (_unit isKindOf "Man") then {
// should only fire if cursor target is man and not vehicle
_charID = _unit getVariable ["CharacterID", "0"];
if (DZE_plotforLife) then {
if (DZE_permanentPlot) then {
_charID = [_unit] call FNC_GetPlayerUID;
};
_friendlies = [player, _unit] call FNC_check_owner;

View File

@@ -250,7 +250,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
_ownerID = _cursorTarget getVariable ["characterID","0"];
_playerUID = dayz_characterID;
if (DZE_plotforLife) then {
if (DZE_permanentPlot) then {
_playerUID = [player] call FNC_GetPlayerUID;
_ownerID = _cursorTarget getVariable ["ownerPUID","0"];
};
@@ -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] call FNC_check_owner; //compile also calls dze_getPlotFriends and lists s_player_plotManagement friendlies
_isowner = [player, _cursorTarget] call FNC_check_owner;
If ((_isowner select 0) || (_isowner select 1)) then {
_player_deleteBuild = true;
};
@@ -631,9 +631,9 @@ 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 (DZE_permanentPlot) then {
if (s_player_plotManagement < 0) then {
_isowner = [player, _cursorTarget] call FNC_check_owner; //compile also calls dze_getPlotFriends and lists s_player_plotManagement friendlies
_isowner = [player, _cursorTarget] call FNC_check_owner;
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];
};
@@ -657,10 +657,10 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
s_player_plot_boundary_off = player addAction ["Remove plot boundary", "\z\addons\dayz_code\actions\A_Plot_for_Life\object_removePlotRadius.sqf", "", 1, false];
};
};
if (DZE_plotforLife) then {
if (DZE_permanentPlot) then {
if (s_player_plot_take_ownership < 0) then {
if (DZE_PlotOwnership) then {
_isowner = [player, _cursorTarget] call FNC_check_owner; //compile also calls dze_getPlotFriends and lists s_player_plotManagement friendlies
_isowner = [player, _cursorTarget] call FNC_check_owner;
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];
};

View File

@@ -32,7 +32,7 @@ _charID = _ownerID;
_objectID = _obj getVariable["ObjectID","0"];
_objectUID = _obj getVariable["ObjectUID","0"];
_ComboMatch = (_ownerID == dayz_combination);
if (DZE_plotforLife) then {
if (DZE_permanentPlot) then {
_combination = _obj getVariable["characterID","0"];
_ownerID = _obj getVariable["ownerPUID","0"];
_ComboMatch = (_combination == dayz_combination);
@@ -66,7 +66,7 @@ if (!isNull _obj) then {
_holder setVariable["ObjectID",_objectID,true];
_holder setVariable["ObjectUID",_objectUID,true];
_holder setVariable ["OEMPos", _pos, true];
if (DZE_plotforLife) then {
if (DZE_permanentPlot) then {
_holder setVariable ["ownerPUID", _ownerID , true];
};

View File

@@ -7,7 +7,7 @@ _obj = _this;
_ownerID = _obj getVariable["CharacterID","0"];
_objectID = _obj getVariable["ObjectID","0"];
_objectUID = _obj getVariable["ObjectUID","0"];
if (DZE_plotforLife) then {
if (DZE_permanentPlot) then {
_ownerID = _obj getVariable["ownerPUID","0"];
};
_pickup = false;

View File

@@ -25,7 +25,7 @@ _ownerID = _obj getVariable["CharacterID","0"];
_objectID = _obj getVariable["ObjectID","0"];
_objectUID = _obj getVariable["ObjectUID","0"];
_ComboMatch = (_ownerID == dayz_combination);
if (DZE_plotforLife) then {
if (DZE_permanentPlot) then {
_combination = _obj getVariable["characterID","0"];
_ownerID = _obj getVariable["ownerPUID","0"];
_ComboMatch = (_combination == dayz_combination);

View File

@@ -34,7 +34,7 @@ _claimedBy = _obj getVariable["claimed","0"];
_ownerID = _obj getVariable["CharacterID","0"];
_characterID = _ownerID;
_ComboMatch = (_ownerID == dayz_combination);
if (DZE_plotforLife) then {
if (DZE_permanentPlot) then {
_combination = _obj getVariable["characterID","0"];
_ownerID = _obj getVariable["ownerPUID","0"];
_ComboMatch = (_combination == dayz_combination);
@@ -96,7 +96,7 @@ if (_ComboMatch || (_ownerID == dayz_playerUID)) then {
_holder setVariable["ObjectID",_objectID,true];
_holder setVariable["ObjectUID",_objectUID,true];
_holder setVariable ["OEMPos", _pos, true];
if (DZE_plotforLife) then {
if (DZE_permanentPlot) then {
_holder setVariable ["ownerPUID", _ownerID , true];
};

View File

@@ -185,7 +185,7 @@ if (!isNull _humanityTarget && {isPlayer _humanityTarget} && {alive _humanityTar
_friendlies = player getVariable ["friendlies", []];
_charID = player getVariable ["CharacterID", "0"];
_rcharID = _humanityTarget getVariable ["CharacterID", "0"];
if (DZE_plotforLife) then {
if (DZE_permanentPlot) then {
_charID = [player] call FNC_GetPlayerUID;
_rcharID = [_humanityTarget] call FNC_GetPlayerUID;
};