mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-24 09:29:21 +03:00
Pullrequest/door management (#1694)
* Added doorManagement * Rename FNC_check_owner --> FNC_check_owner_friends * Fixed typo * Fixed bug in FNC_check_owner_friends which allowed every user to manage every plot and door. * Removed unused DZE_doorManagementHarderPenalty from configVariables.sqf * Now checking if _playerUID is in _friendlies for both cases. * DZE_plotforLife should be DZE_permanentPlot * Fixed case where DZE_permanentPlot is false. * Forgot to add STR_EPOCH_CANCEL * Changed translations to suggested string by ebaydayz. * Renamed EyeScanner to DoorAccess. * Reworked access rights for door management. * DZE_doorManagementMustBeClose = true; //Players must be within 10m of door to be added as a door friend. * Fixed copy-paste error. * Replace count with if * Remove redundant test. * Also replaced count in door management admins check. * Change plotManagement and doorManagement to be consistent to DayZ_UseSteamID (get UID from FNC_GetPlayerUID). * Use _playerUID and _characterID more consistent. * Added german translation to STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_ALREADYONTHELIST.
This commit is contained in:
22
SQF/dayz_code/actions/doorManagement/doorAddFriend.sqf
Normal file
22
SQF/dayz_code/actions/doorManagement/doorAddFriend.sqf
Normal file
@@ -0,0 +1,22 @@
|
||||
private ["_pos","_plots","_inList"];
|
||||
_pos = _this select 0;
|
||||
if (_pos < 0) exitWith {};
|
||||
_toAdd = (Humans select _pos);
|
||||
_friends = TheDoor getVariable ["doorfriends",[]];
|
||||
_inList = false;
|
||||
{
|
||||
if((_x select 0) == (_toAdd select 0)) exitWith { _inList = true; };
|
||||
} forEach _friends;
|
||||
if(_inList) exitWith { localize "STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_ALREADYONTHELIST" call dayz_rollingMessages; };
|
||||
if(count _friends >= DZE_doorManagementMaxFriends) exitWith { format[localize "STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_FRIENDLIMIT", DZE_doorManagementMaxFriends] call dayz_rollingMessages; };
|
||||
_friends set [count _friends, _toAdd];
|
||||
TheDoor setVariable ["doorfriends", _friends, true];
|
||||
PVDZ_veh_Save = [TheDoor,"gear"];
|
||||
if (isServer) then {
|
||||
PVDZ_veh_Save call server_updateObject;
|
||||
} else {
|
||||
publicVariableServer "PVDZ_veh_Save";
|
||||
};
|
||||
|
||||
call DoorGetFriends;
|
||||
call DoorNearbyHumans;
|
||||
6
SQF/dayz_code/actions/doorManagement/doorGetFriends.sqf
Normal file
6
SQF/dayz_code/actions/doorManagement/doorGetFriends.sqf
Normal file
@@ -0,0 +1,6 @@
|
||||
private ["_plots","_friendlies","_thePlot"];
|
||||
lbClear 7102;
|
||||
_friends = TheDoor getVariable ["doorfriends",[]];
|
||||
{
|
||||
lbAdd [7102, (_x select 1)];
|
||||
} forEach _friends;
|
||||
13
SQF/dayz_code/actions/doorManagement/doorNearbyHumans.sqf
Normal file
13
SQF/dayz_code/actions/doorManagement/doorNearbyHumans.sqf
Normal file
@@ -0,0 +1,13 @@
|
||||
private ["_close"];
|
||||
lbClear 7101;
|
||||
_closePeople = player nearEntities ["CAManBase", 10];
|
||||
if (!DZE_doorManagementMustBeClose) then {_closePeople = playableUnits};
|
||||
Humans = [];
|
||||
{
|
||||
if (isPlayer _x) then {
|
||||
_friendUID = [_x] call FNC_GetPlayerUID;
|
||||
_friendName = name _x;
|
||||
Humans set [count Humans, [_friendUID,_friendName]];
|
||||
lbAdd [7101, _friendName];
|
||||
};
|
||||
} forEach _closePeople;
|
||||
21
SQF/dayz_code/actions/doorManagement/doorRemoveFriend.sqf
Normal file
21
SQF/dayz_code/actions/doorManagement/doorRemoveFriend.sqf
Normal file
@@ -0,0 +1,21 @@
|
||||
private ["_list","_plots","_thePlot","_friends"];
|
||||
_pos = _this select 0;
|
||||
if (_pos < 0) exitWith {};
|
||||
_friends = TheDoor getVariable ["doorfriends", []];
|
||||
_toRemove = (_friends select _pos);
|
||||
_newList = [];
|
||||
{
|
||||
if(_x select 0 != _toRemove select 0) then {
|
||||
_newList set [count _newList, _x ];
|
||||
};
|
||||
} forEach _friends;
|
||||
TheDoor setVariable ["doorfriends", _newList, true];
|
||||
PVDZ_veh_Save = [TheDoor, "gear"];
|
||||
if (isServer) then {
|
||||
PVDZ_veh_Save call server_updateObject;
|
||||
} else {
|
||||
publicVariableServer "PVDZ_veh_Save";
|
||||
};
|
||||
|
||||
call DoorGetFriends;
|
||||
call DoorNearbyHumans;
|
||||
29
SQF/dayz_code/actions/doorManagement/initDoorManagement.sqf
Normal file
29
SQF/dayz_code/actions/doorManagement/initDoorManagement.sqf
Normal file
@@ -0,0 +1,29 @@
|
||||
disableSerialization;
|
||||
if(count(_this) > 0) then
|
||||
{
|
||||
TheDoor = _this select 3;
|
||||
} else {
|
||||
TheDoor = dayz_selectedDoor;
|
||||
};
|
||||
|
||||
// close DoorAccess if open
|
||||
_display = findDisplay 61144;
|
||||
_display closeDisplay 3000;
|
||||
|
||||
// Check player access
|
||||
_isowner = [player, TheDoor] call FNC_check_access;
|
||||
if( ((_isowner select 0) && DZE_doorManagementAllowManage_owner) // door owner
|
||||
|| ((_isowner select 1) && DZE_doorManagementAllowManage_ownerFriendlies) // door owner's friendly tagged
|
||||
|| ((_isowner select 2) && DZE_doorManagementAllowManage_plotOwner) // plot owner
|
||||
|| ((_isowner select 3) && DZE_doorManagementAllowManage_plotFriends) // plot friends
|
||||
|| ((_isowner select 4) && DZE_doorManagementAllowManage_plotAdmins) // plot management admins
|
||||
|| ((_isowner select 5) && DZE_doorManagementAllowManage_doorFriends) // door friends
|
||||
|| ((_isowner select 6) && DZE_doorManagementAllowManage_doorAdmins) // door management admins
|
||||
) then {
|
||||
createDialog "DoorManagement";
|
||||
call DoorNearbyHumans;
|
||||
call DoorGetFriends;
|
||||
} else {
|
||||
localize "STR_EPOCH_DOORMANAGEMENT_NORIGHTS" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
13
SQF/dayz_code/actions/doorManagement/player_enterCode.sqf
Normal file
13
SQF/dayz_code/actions/doorManagement/player_enterCode.sqf
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
// Close DoorAccess
|
||||
_display = findDisplay 61144;
|
||||
_display closeDisplay 3000;
|
||||
if(DZE_doorManagementAllowManualCode) then {
|
||||
//DZE_Lock_Door != (this getvariable['CharacterID','0']);
|
||||
DZE_topCombo = 0;
|
||||
DZE_midCombo = 0;
|
||||
DZE_botCombo = 0;
|
||||
createDialog "ComboLockUI";
|
||||
} else {
|
||||
localize "STR_EPOCH_DOORACCESS_NOMANUAL" call dayz_rollingMessages;
|
||||
};
|
||||
@@ -5,9 +5,9 @@ if (!DZE_plotManagementMustBeClose) then {_closePeople = playableUnits};
|
||||
Humans = [];
|
||||
{
|
||||
if (isPlayer _x) then {
|
||||
_friendUID = getPlayerUID _x;
|
||||
_friendUID = [_x] call FNC_GetPlayerUID;
|
||||
_friendName = name _x;
|
||||
Humans = Humans + [[_friendUID,_friendName]] ;
|
||||
Humans = Humans + [[_friendUID,_friendName]];
|
||||
lbAdd [7001, _friendName];
|
||||
};
|
||||
} forEach _closePeople; // count causes Error Type Number, expected Bool here
|
||||
Reference in New Issue
Block a user