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:
A Man
2022-03-26 18:11:16 +01:00
parent fc6680c360
commit 67bdc72171
11 changed files with 45 additions and 49 deletions

View File

@@ -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";