Plot Management cleanup + improvement

New compile DZE_GetPlotFriends

DZE_PlotManagementAdmins allows admin management of plot poles and
buildables near poles

DZE_MaxPlotFriends allows servers to allow more than 6 friends on a pole
at once
This commit is contained in:
icomrade
2016-05-01 13:20:21 -04:00
parent 9e2728af07
commit 1e65f7a959
8 changed files with 62 additions and 111 deletions

View File

@@ -413,72 +413,22 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
};
};
//Allow owners to delete modulars
if (_isModular && (dayz_characterID == _ownerID)) then {
if (_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
_player_deleteBuild = true;
};
};
// plotManagement //
if(_isModular && DZE_plotManagement) then {
if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
_findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];
_IsNearPlot = count (_findNearestPoles);
_fuid = [];
_allowed = [];
if(_IsNearPlot > 0) then {
_thePlot = _findNearestPoles select 0;
_owner = if(DZE_plotforLife)
then { _thePlot getVariable ["ownerPUID","010"] }
else { _thePlot getVariable ["characterID","0"] };
_friends = _thePlot getVariable ["plotfriends", []];
{
_friendUID = _x select 0;
_fuid = _fuid + [_friendUID];
} forEach _friends;
_allowed = [_owner];
_allowed = [_owner] + _fuid;
if( (dayz_playerUID in _allowed) || (dayz_characterID in _allowed) ) then {
if (DZE_plotManagement) then {
if(_isModular || _isModularDoor) then {
if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
_allowedUIDs = [objNull, true, true] call dze_getPlotFriends;
if( (dayz_playerUID in _allowedUIDs) || (dayz_characterID in _allowedUIDs) ) then {
_player_deleteBuild = true;
};
};
};
};
// plotManagement //
//Allow owners to delete modular doors without locks
if (_isModularDoor && (dayz_characterID == _ownerID)) then {
if (_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
_player_deleteBuild = true;
};
};
// plotManagement //
if(_isModularDoor && DZE_plotManagement) then {
if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
_findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];
_IsNearPlot = count (_findNearestPoles);
_fuid = [];
_allowed = [];
if(_IsNearPlot > 0)then{
_thePlot = _findNearestPoles select 0;
_owner = if(DZE_plotforLife)
then { _thePlot getVariable ["ownerPUID","010"] }
else { _thePlot getVariable ["characterID","0"] };
_friends = _thePlot getVariable ["plotfriends", []];
{
_friendUID = _x select 0;
_fuid = _fuid + [_friendUID];
} forEach _friends;
_allowed = [_owner];
_allowed = [_owner] + _fuid;
if( (dayz_playerUID in _allowed) || (dayz_characterID in _allowed) ) then {
_player_deleteBuild = true;
};
};
} else {
if ((_isModularDoor || _isModular) && (dayz_characterID == _ownerID)) then {
if (_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
_player_deleteBuild = true;
};
};
};
// plotManagement //
if (_isVehicle) then {
if ((_ownerID != "0") && {!_isMan} && {!_isBicycle}) then {
@@ -683,41 +633,23 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur
s_player_breakinhouse = -1;
};
if ((_cursorTarget isKindOf "Plastic_Pole_EP1_DZ") && {_canDo} && {speed player <= 1}) then {
// plotManagement //
// add Scroll-Menu to Plotpole
if( DZE_plotManagement && (s_player_plotManagement < 0) ) then {
_adminList = ["0152"]; //TODO: Add admins here if you admins to able to manage all plotpoles
_owner = if(DZE_plotforLife)
then { _cursorTarget getVariable ["ownerPUID","0"] }
else { _cursorTarget getVariable ["characterID","0"] };
_friends = _cursorTarget getVariable ["plotfriends", []];
_fuid = [];
{
_friendUID = _x select 0;
_fuid = _fuid + [_friendUID];
} forEach _friends;
_allowed = [_owner];
_allowed = [_owner] + _adminList + _fuid;
if( (dayz_playerUID in _allowed) || (dayz_characterID in _allowed) ) then {
s_player_plotManagement = player addAction ["<t color='#0059FF'>Manage Plot</t>", "\z\addons\dayz_code\actions\plotManagement\initPlotManagement.sqf", [], 5, false];
if ((_cursorTarget isKindOf "Plastic_Pole_EP1_DZ") && {_canDo && speed player <= 1}) then {
if( DZE_plotManagement) then {
if (s_player_plotManagement < 0) then {
_allowedUIDs = [_cursorTarget, false, true] call dze_getPlotFriends;
if( (dayz_playerUID in _allowedUIDs) || (dayz_characterID in _allowedUIDs) ) then {
s_player_plotManagement = player addAction ["<t color='#0059FF'>Manage Plot</t>", "\z\addons\dayz_code\actions\plotManagement\initPlotManagement.sqf", [], 5, false];
};
};
};
// plotManagement //
if(!DZE_plotManagement) then {
} else {
if (s_player_maintain_area < 0) then {
s_player_maintain_area = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTAREA"], "\z\addons\dayz_code\actions\maintain_area.sqf", "maintain", 5, false];
s_player_maintain_area_preview = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "\z\addons\dayz_code\actions\maintain_area.sqf", "preview", 5, false];
};
};
} else {
// plotManagement //
player removeAction s_player_plotManagement;
s_player_plotManagement = -1;
// plotManagement //
player removeAction s_player_maintain_area;
s_player_maintain_area = -1;
player removeAction s_player_maintain_area_preview;