mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-22 20:12:20 +03:00
Keep global characterID only for special cases
Only vehicles with a key and locked/lockable buildings need a global characterID. All other vehicles and buildings will have a characterID of "0".
This commit is contained in:
@@ -1212,19 +1212,16 @@ if (_canBuild) then {
|
||||
if (count _findNearestPole > 0) then { // is near plot
|
||||
|
||||
_nearestPole = _findNearestPole select 0; // get first entry
|
||||
_ownerID = _nearestPole getVariable["CharacterID","0"];
|
||||
|
||||
if (dayz_characterID != _ownerID) then { // not the owner
|
||||
_buildcheck = [player, _nearestPole] call FNC_check_access;
|
||||
_isowner = _buildcheck select 0;
|
||||
_isfriendly = ((_buildcheck select 1) || (_buildcheck select 3));
|
||||
if (!_isowner && !_isfriendly) then {
|
||||
_cancel = true;
|
||||
};
|
||||
if (_cancel) then {
|
||||
_reason = localize "STR_EPOCH_PLAYER_134"; // You do not have access to build on this plot.
|
||||
};
|
||||
_buildcheck = [player, _nearestPole] call FNC_check_access;
|
||||
_isowner = _buildcheck select 0;
|
||||
_isfriendly = ((_buildcheck select 1) || (_buildcheck select 3));
|
||||
if (!_isowner && !_isfriendly) then {
|
||||
_cancel = true;
|
||||
};
|
||||
if (_cancel) then {
|
||||
_reason = localize "STR_EPOCH_PLAYER_134"; // You do not have access to build on this plot.
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1555,8 +1552,8 @@ if (_canBuild) then {
|
||||
systemChat format[localize "str_epoch_player_140", _combinationDisplay, _text]; // You have setup your %2. The combination is %1
|
||||
|
||||
} else { // if not lockable item
|
||||
|
||||
_builtObject setVariable ["CharacterID", dayz_characterID, true];
|
||||
local _charID = "0";
|
||||
_builtObject setVariable ["CharacterID", _charID];
|
||||
|
||||
// fireplace
|
||||
if (_builtObject isKindOf "Land_Fire_DZ") then { // if campfire, then spawn, but do not publish to database
|
||||
@@ -1571,9 +1568,9 @@ if (_canBuild) then {
|
||||
_friendsArr = [[dayz_playerUID, toArray (name player)]];
|
||||
_builtObject setVariable ["plotfriends", _friendsArr, true];
|
||||
|
||||
PVDZ_obj_Publish = [dayz_characterID, _builtObject, [_dir, _position, dayz_playerUID, _vector], _friendsArr, player, dayz_authKey];
|
||||
PVDZ_obj_Publish = [_charID, _builtObject, [_dir, _position, dayz_playerUID, _vector], _friendsArr, player, dayz_authKey];
|
||||
} else {
|
||||
PVDZ_obj_Publish = [dayz_characterID, _builtObject, [_dir, _position, dayz_playerUID, _vector], [], player, dayz_authKey];
|
||||
PVDZ_obj_Publish = [_charID, _builtObject, [_dir, _position, dayz_playerUID, _vector], [], player, dayz_authKey];
|
||||
};
|
||||
publicVariableServer "PVDZ_obj_Publish";
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@ if (dayz_actionInProgress) exitWith {localize "str_epoch_player_48" call dayz_ro
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
player removeAction s_player_downgrade_build;
|
||||
s_player_downgrade_build = 1;
|
||||
s_player_downgrade_build = -1;
|
||||
|
||||
local _obj = _this select 3;
|
||||
|
||||
@@ -22,7 +22,6 @@ local _objectCharacterID = _obj getVariable ["CharacterID","0"];
|
||||
|
||||
if (DZE_Lock_Door != _objectCharacterID) exitWith { // Unable to downgrade, you do not know the combination.
|
||||
dayz_actionInProgress = false;
|
||||
s_player_downgrade_build = -1;
|
||||
localize "str_epoch_player_49" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
@@ -30,10 +29,16 @@ local _playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities [
|
||||
|
||||
if (_playerNear) exitWith { // Another player is nearby. Only one player can be near to perform this action.
|
||||
dayz_actionInProgress = false;
|
||||
s_player_downgrade_build = -1;
|
||||
localize "str_pickup_limit_5" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
local _ownerID = _obj getVariable["ownerPUID", "0"];
|
||||
|
||||
if (_ownerID == "0") exitWith { // Not setup yet.
|
||||
dayz_actionInProgress = false;
|
||||
localize "str_epoch_player_50" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
local _classname = typeOf _obj;
|
||||
@@ -89,9 +94,8 @@ if (count _upgrade > 0) then {
|
||||
local _vector = [(vectorDir _obj), (vectorUp _obj)];
|
||||
|
||||
if (_classname in DZE_DoorsLocked) then {
|
||||
|
||||
_obj setVariable ["CharacterID", dayz_characterID, true];
|
||||
_objectCharacterID = dayz_characterID;
|
||||
_objectCharacterID = "0";
|
||||
_obj setVariable ["CharacterID",_objectCharacterID, true];
|
||||
};
|
||||
|
||||
_classname = _newclassname;
|
||||
@@ -125,8 +129,7 @@ if (count _upgrade > 0) then {
|
||||
|
||||
_object setDamage _damageNew;
|
||||
};
|
||||
|
||||
local _ownerID = _obj getVariable["ownerPUID", "0"];
|
||||
|
||||
_object setVariable ["ownerPUID", _ownerID, true];
|
||||
PVDZE_obj_Swap = [_objectCharacterID, _object, [_dir, _position, dayz_playerUID, _vector], _classname, _obj, player, [], dayz_authKey];
|
||||
publicVariableServer "PVDZE_obj_Swap";
|
||||
|
||||
@@ -14,14 +14,14 @@ if (dayz_actionInProgress) exitWith {localize "str_epoch_player_52" call dayz_ro
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
player removeAction s_player_upgrade_build;
|
||||
s_player_upgrade_build = 1;
|
||||
s_player_upgrade_build = -1;
|
||||
|
||||
local _obj = _this select 3;
|
||||
local _classname = typeOf _obj;
|
||||
local _ownerID = _obj getVariable["ownerPUID","0"];
|
||||
|
||||
if (_classname in DZE_DisableUpgrade) exitWith {
|
||||
if (_ownerID == "0" || {_classname in DZE_DisableUpgrade}) exitWith {
|
||||
dayz_actionInProgress = false;
|
||||
s_player_upgrade_build = -1;
|
||||
localize "str_epoch_player_50" call dayz_rollingMessages; // Not setup yet.
|
||||
};
|
||||
|
||||
@@ -206,9 +206,7 @@ if ((count _upgrade) > 0) then {
|
||||
};
|
||||
|
||||
_object setDamage _damageNew;
|
||||
};
|
||||
|
||||
local _ownerID = _obj getVariable["ownerPUID","0"];
|
||||
};
|
||||
|
||||
if (_ownerID == "0") then {
|
||||
_ownerID = dayz_playerUID; // APFL is on but UID is 0 so we will claim it to record the ownership.
|
||||
|
||||
@@ -91,7 +91,7 @@ if (_isPole && _isNearPlot > 0) exitWith {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
if (_isPole && !_isAdmin && DZE_limitPlots > 0) then {
|
||||
{
|
||||
if (_x getVariable["ownerPUID","0"] == dayz_playerUID || (_x getVariable["CharacterID","0"] == dayz_characterID)) then {
|
||||
if (_x getVariable["ownerPUID","0"] == dayz_playerUID) then {
|
||||
_plotPoles = _plotPoles + 1;
|
||||
};
|
||||
} count (entities "Plastic_Pole_EP1_DZ"); // all plot poles on the map owned by player
|
||||
@@ -130,16 +130,11 @@ if (_isNearPlot == 0 && !_canBuild) exitWith {
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
if (_isNearPlot > 0) then {
|
||||
local _ownerID = _nearestPole getVariable["CharacterID","0"];
|
||||
if (dayz_characterID == _ownerID) then {
|
||||
local _accessCheck = [player, _nearestPole] call FNC_check_access;
|
||||
local _isowner = _accessCheck select 0;
|
||||
local _isfriendly = ((_accessCheck select 1) || (_accessCheck select 3));
|
||||
if (_isowner || _isfriendly) then {
|
||||
_canBuild = true;
|
||||
} else {
|
||||
local _accessCheck = [player, _nearestPole] call FNC_check_access;
|
||||
local _isowner = _accessCheck select 0;
|
||||
local _isfriendly = ((_accessCheck select 1) || (_accessCheck select 3));
|
||||
if (_isowner || _isfriendly) then {
|
||||
_canBuild = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ private [
|
||||
,"_isDoorFriend" // return value - Only applicable if target is a door
|
||||
,"_isDoorAdmin" // return value - Only applicable if target is a door
|
||||
,"_targetType" // return value
|
||||
,"_targetOwnerUID" // UID or characterID of the owner of _target
|
||||
,"_targetOwnerUID" // UID of the owner of _target
|
||||
,"_playerUID" // UID of the _player
|
||||
,"_plotcheck" // takes return value of FNC_find_plots
|
||||
,"_isNearPlot" // player is in plot's reach
|
||||
|
||||
Reference in New Issue
Block a user