Remove ObjectID and ObjectUID from PVDZ_obj_Destroy calls

This is just the first commit for the removel of all global set ObjectIDs and ObjectUIDs.
Also objects will no longer be send over the network. Only the netID will. The actual object can be resolved with the netID on the server.
This commit is contained in:
A Man
2022-03-24 17:17:45 +01:00
parent 01792fe8e2
commit e72394d6da
12 changed files with 48 additions and 75 deletions

View File

@@ -1,38 +1,33 @@
/*
[_objectID,_objectUID,_activatingPlayer,_objPos,dayz_authKey] call server_deleteObj;
[netID _activatingPlayer,netID _obj,dayz_authKey] call server_deleteObj;
For PV calls from the client use this function, otherwise if calling directly from the server use server_deleteObjDirect
*/
private["_id","_uid","_key","_activatingPlayer","_objPos","_clientKey","_exitReason","_PlayerUID","_processDelete"];
if (count _this < 3) exitWith {diag_log "Server_DeleteObj error: Improper parameter format";};
if (count _this < 5) exitWith {diag_log "Server_DeleteObj error: Improper parameter format";};
_id = _this select 0;
_uid = _this select 1;
_activatingPlayer = _this select 2;
_objPos = _this select 3; //Can be object or position if _processDelete is false
_clientKey = _this select 4;
_processDelete = [true,_this select 5] select (count _this > 5);
_PlayerUID = getPlayerUID _activatingPlayer;
local _activatingPlayer = objectFromNetID(_this select 0);
local _obj = objectFromNetID(_this select 1);
local _clientKey = _this select 2;
local _playerUID = getPlayerUID _activatingPlayer;
_exitReason = [_this,"DeleteObj",_objPos,_clientKey,_PlayerUID,_activatingPlayer] call server_verifySender;
local _exitReason = [_this,"DeleteObj",_obj,_clientKey,_playerUID,_activatingPlayer] call server_verifySender;
if (_exitReason != "") exitWith {diag_log _exitReason};
if (isServer) then {
if (_processDelete) then {deleteVehicle _objPos};
local _id = _obj getVariable ["ObjectID","0"];
local _uid = _obj getVariable ["ObjectUID","0"];
_type = typeOf _obj;
if (typeName _objPos != "ARRAY") then {
_objPos = typeof _objPos;
};
//remove from database
if (parseNumber _id > 0) then {
//Send request
_key = format["CHILD:304:%1:",_id];
_key call server_hiveWrite;
diag_log format["DELETE: Player %1(%2) deleted %4 with ID: %3",(_activatingPlayer call fa_plr2str), _PlayerUID, _id, _objPos];
} else {
//Send request
_key = format["CHILD:310:%1:",_uid];
_key call server_hiveWrite;
diag_log format["DELETE: Player %1(%2) deleted %4 with UID: %3",(_activatingPlayer call fa_plr2str), _PlayerUID, _uid, _objPos];
};
local _processDelete = [true,_this select 3] select (count _this > 3);
if (_processDelete) then {deleteVehicle _obj};
//remove from database
if (parseNumber _id > 0) then {
//Send request
_key = format["CHILD:304:%1:",_id];
_key call server_hiveWrite;
diag_log format["DELETE: Player %1(%2) deleted %4 with ID: %3",(_activatingPlayer call fa_plr2str), _playerUID, _id, _type];
} else {
//Send request
_key = format["CHILD:310:%1:",_uid];
_key call server_hiveWrite;
diag_log format["DELETE: Player %1(%2) deleted %4 with UID: %3",(_activatingPlayer call fa_plr2str), _playerUID, _uid, _type];
};