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

@@ -58,7 +58,7 @@ if ((count _VehKey2) > 0) then {
if (isNil "_localResult2") then { if (isNil "_localResult2") then {
_localResult2 = 0; _localResult2 = 0;
} else { } else {
PVDZ_obj_Destroy = [(_VehKey2 select 2),(_VehKey2 select 3),player,(_VehKey2 select 1),dayz_authKey]; PVDZ_obj_Destroy = [netID player,netID (_VehKey2 select 1),dayz_authKey];
publicVariableServer "PVDZ_obj_Destroy"; publicVariableServer "PVDZ_obj_Destroy";
//deleteVehicle (_VehKey2 select 1); //deleteVehicle (_VehKey2 select 1);
}; };

View File

@@ -18,7 +18,7 @@ _itemsCheckArray = [];
_itemsToLog = [[],[],[],"sell"]; _itemsToLog = [[],[],[],"sell"];
_sellVehicle = { _sellVehicle = {
private ["_damage","_tireDmg","_tires","_okToSell","_returnInfo","_hitpoints","_objectID","_objectUID","_objectCharacterId","_notSetup","_vehicle","_sellType"]; private ["_damage","_tireDmg","_tires","_okToSell","_returnInfo","_hitpoints","_objectCharacterId","_notSetup","_vehicle","_sellType"];
_vehicle = _this select 0; _vehicle = _this select 0;
_sellType = _this select 1; _sellType = _this select 1;
_returnInfo = []; _returnInfo = [];
@@ -42,14 +42,12 @@ _sellVehicle = {
}; };
}; };
}; };
_objectID = DZE_myVehicle getVariable ["ObjectID","0"];
_objectUID = DZE_myVehicle getVariable ["ObjectUID","0"];
_objectCharacterId = DZE_myVehicle getVariable ["CharacterID","0"]; _objectCharacterId = DZE_myVehicle getVariable ["CharacterID","0"];
_notSetup = (_objectID == "0" && _objectUID == "0"); _notSetup = _objectCharacterId == "-1";
if (local DZE_myVehicle && !isNull DZE_myVehicle && alive DZE_myVehicle && !_notSetup) then { if (local DZE_myVehicle && !isNull DZE_myVehicle && alive DZE_myVehicle && !_notSetup) then {
if (_okToSell) then { if (_okToSell) then {
_returnInfo = [_objectCharacterId, DZE_myVehicle, _objectID, _objectUID, _sellType]; _returnInfo = [_objectCharacterId, DZE_myVehicle, _sellType];
} else { } else {
systemChat format[localize "str_epoch_player_182",typeOf DZE_myVehicle]; systemChat format[localize "str_epoch_player_182",typeOf DZE_myVehicle];
_returnInfo = []; _returnInfo = [];

View File

@@ -55,7 +55,7 @@ _normalWeaps = _normalWeaps - ["soldItem"];
} count _normalWeaps; } count _normalWeaps;
if (count _vehInfo > 0) then { if (count _vehInfo > 0) then {
_sell = [_vehInfo, ((_vehInfo select 0) select 4), _object] call DZE_deleteTradedVehicle; _sell = [_vehInfo, ((_vehInfo select 0) select 2), _object] call DZE_deleteTradedVehicle;
if (_sell > 0) then { if (_sell > 0) then {
_returnVar set [3,[1]]; _returnVar set [3,[1]];
}; };

View File

@@ -72,7 +72,7 @@ if (_isOk) then {
["PartWoodPile",1,1] call fn_dropItem; ["PartWoodPile",1,1] call fn_dropItem;
["equip_duct_tape",1,1] call fn_dropItem; ["equip_duct_tape",1,1] call fn_dropItem;
}; };
PVDZ_obj_Destroy = [(_holder getVariable["ObjectID","0"]),(_holder getVariable["ObjectUID","0"]),player,_holder,dayz_authKey]; PVDZ_obj_Destroy = [netID player,netID _holder,dayz_authKey];
publicVariableServer "PVDZ_obj_Destroy"; publicVariableServer "PVDZ_obj_Destroy";
} else { } else {
deleteVehicle _holder; deleteVehicle _holder;

View File

@@ -61,7 +61,7 @@ player addMagazine _emptycan;
// Added Nutrition-Factor for work // Added Nutrition-Factor for work
["Working",0,[20,40,15,0]] call dayz_NutritionSystem; ["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
PVDZ_obj_Destroy = [_objectID,_objectUID,player,_obj,dayz_authKey,false]; PVDZ_obj_Destroy = [netID player,netID _obj,dayz_authKey,false];
publicVariableServer "PVDZ_obj_Destroy"; publicVariableServer "PVDZ_obj_Destroy";
PVDZ_veh_Save = [_obj,"killed",false,false,dayz_playerUID,dayz_authKey]; PVDZ_veh_Save = [_obj,"killed",false,false,dayz_playerUID,dayz_authKey];

View File

@@ -70,11 +70,6 @@ s_player_maint_build = 1;
local _objOwnerID = _obj getVariable["ownerPUID","0"]; local _objOwnerID = _obj getVariable["ownerPUID","0"];
local _isOwnerOfObj = (_objOwnerID == dayz_playerUID); local _isOwnerOfObj = (_objOwnerID == dayz_playerUID);
local _objectID = _obj getVariable ["ObjectID","0"];
local _objectUID = _obj getVariable ["ObjectUID","0"];
local _hasNoID = (_objectID == "0" && _objectUID == "0");
local _isDestructable = _obj isKindOf "BuiltItems"; local _isDestructable = _obj isKindOf "BuiltItems";
local _isWreck = _objType in DZE_isWreck; local _isWreck = _objType in DZE_isWreck;
local _isRemovable = _objType in DZE_isRemovable; local _isRemovable = _objType in DZE_isRemovable;
@@ -259,7 +254,6 @@ if (_proceed && _success) then {
local _iPos = _objectPos; // default refund position local _iPos = _objectPos; // default refund position
local _iDir = getDir _obj; // default refund direction local _iDir = getDir _obj; // default refund direction
local _selectedRemoveOutput = []; // initialize refund array local _selectedRemoveOutput = []; // initialize refund array
local _preventRefund = false; // in case object has no id
local _bpTotal = 0; // total number of backpacks to refund local _bpTotal = 0; // total number of backpacks to refund
call { call {
@@ -332,7 +326,6 @@ if (_proceed && _success) then {
if (_modularRefund) exitWith { if (_modularRefund) exitWith {
{_selectedRemoveOutput set [count _selectedRemoveOutput, _x]} forEach _refund; {_selectedRemoveOutput set [count _selectedRemoveOutput, _x]} forEach _refund;
_preventRefund = _hasNoID;
}; };
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@@ -342,9 +335,7 @@ if (_proceed && _success) then {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
if (_isStorageItem) exitWith { if (_isStorageItem) exitWith {
if (!_hasNoID) then {
_selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput"); // refund config array _selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput"); // refund config array
};
local _weapons = getWeaponCargo _obj; local _weapons = getWeaponCargo _obj;
local _magazines = getMagazineCargo _obj; local _magazines = getMagazineCargo _obj;
@@ -380,7 +371,6 @@ if (_proceed && _success) then {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
_selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput"); // refund config array _selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput"); // refund config array
_preventRefund = _hasNoID;
}; };
call { call {
@@ -419,7 +409,7 @@ if (_proceed && _success) then {
if (!_isWreck && !_isWreckBuilding) then { if (!_isWreck && !_isWreckBuilding) then {
// Server performs deleteVehicle // Server performs deleteVehicle
PVDZ_obj_Destroy = [_objectID, _objectUID, player, _obj, dayz_authKey]; PVDZ_obj_Destroy = [netID player,netID _obj, dayz_authKey];
publicVariableServer "PVDZ_obj_Destroy"; publicVariableServer "PVDZ_obj_Destroy";
} else { } else {
deleteVehicle _obj; deleteVehicle _obj;
@@ -439,7 +429,7 @@ if (_proceed && _success) then {
// //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
if (!_preventRefund && {count _selectedRemoveOutput > 0}) then { if (count _selectedRemoveOutput > 0) then {
local _item = "WeaponHolder" createVehicle [0,0,0]; local _item = "WeaponHolder" createVehicle [0,0,0];
_item setDir _iDir; _item setDir _iDir;

View File

@@ -1,22 +1,16 @@
// Written by salival (https://github.com/oiad) // Written by salival (https://github.com/oiad)
private ["_hasAccess","_objectID","_objectUID","_plotCheck"];
closeDialog 0; closeDialog 0;
_plotCheck = [player, false] call FNC_find_plots; local _plotCheck = [player, false] call FNC_find_plots;
_hasAccess = [player,_plotCheck select 2] call FNC_check_access; local _hasAccess = [player,_plotCheck select 2] call FNC_check_access;
if ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3) or (_hasAccess select 4)) then { if ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3) or (_hasAccess select 4)) then {
{ {
_objectID = _x getVariable ["ObjectID","0"]; PVDZ_obj_Destroy = [netID player,netID _x,dayz_authKey];
_objectUID = _x getVariable ["ObjectUID","0"];
PVDZ_obj_Destroy = [_objectID,_objectUID,player,_x,dayz_authKey];
publicVariableServer "PVDZ_obj_Destroy"; publicVariableServer "PVDZ_obj_Destroy";
deleteVehicle _x;
systemChat format[localize "STR_CL_VG_HELIPAD_REMOVED",typeOf _x]; systemChat format[localize "STR_CL_VG_HELIPAD_REMOVED",typeOf _x];
} count (nearestObjects [_plotCheck select 2,vg_heliPads,Z_VehicleDistance]); } count (nearestObjects [_plotCheck select 2,vg_heliPads,Z_VehicleDistance]);
} else { } else {

View File

@@ -77,9 +77,8 @@ if ((_ownerID == dayz_playerUID) || {_objType in ["IC_DomeTent","IC_Tent"]}) the
local _magazines = getMagazineCargo _obj; local _magazines = getMagazineCargo _obj;
local _backpacks = getBackpackCargo _obj; local _backpacks = getBackpackCargo _obj;
PVDZ_obj_Destroy = [_objectID, _objectUID, player, _pos, dayz_authKey, false]; // delete original tent PVDZ_obj_Destroy = [netID player,netID _obj, dayz_authKey]; // delete original tent
publicVariableServer "PVDZ_obj_Destroy"; publicVariableServer "PVDZ_obj_Destroy";
deleteVehicle _obj;
[_weapons, _magazines, _backpacks, _holder] call fn_addCargo; // pile everything onto the ground [_weapons, _magazines, _backpacks, _holder] call fn_addCargo; // pile everything onto the ground

View File

@@ -1,16 +1,15 @@
private ["_obj","_objectID","_objectUID"]; local _obj = _this select 0;
_obj = _this select 0;
_objectID = _obj getVariable ["ObjectID","0"];
_objectUID = _obj getVariable ["ObjectUID","0"];
if (isServer) then { if (isServer) then {
local _objectID = _obj getVariable ["ObjectID","0"];
local _objectUID = _obj getVariable ["ObjectUID","0"];
[_objectID,_objectUID,_obj] call server_deleteObjDirect; [_objectID,_objectUID,_obj] call server_deleteObjDirect;
} else { } else {
if (count _this == 2) then { if (count _this == 2) then {
//single use trap triggered, remove with no animation //single use trap triggered, remove with no animation
//For normal remove let object_pickup.sqf perform deletion to ensure player has room in gear first, no others remove at same time and animation runs //For normal remove let object_pickup.sqf perform deletion to ensure player has room in gear first, no others remove at same time and animation runs
PVDZ_obj_Destroy = [_objectID,_objectUID,player,_obj,dayz_authKey]; PVDZ_obj_Destroy = [netID player,netID _obj,dayz_authKey];
publicVariableServer "PVDZ_obj_Destroy"; publicVariableServer "PVDZ_obj_Destroy";
//deleteVehicle _obj; //deleteVehicle _obj;
}; };

View File

@@ -1,15 +1,13 @@
private ["_id", "_uid", "_armed"]; local _trap = _this select 0;
_trap = _this select 0;
if (!isNull _trap) then { if (!isNull _trap) then {
while { true } do { while { true } do {
_id = _trap getVariable ["ObjectID", "0"];
_uid = _trap getVariable ["ObjectUID", "0"]; local _armed = _trap getVariable "armed";
_armed = _trap getVariable "armed";
if (isNull _trap) exitWith { /* break from loop */ }; if (isNull _trap) exitWith { /* break from loop */ };
if (((parseNumber _id > 0) || (parseNumber _uid > 0)) && !isNil "_armed") exitWith { if (!isNil "_armed") exitWith {
if (isServer) then { if (isServer) then {
dayz_traps set [count dayz_traps, _trap]; dayz_traps set [count dayz_traps, _trap];
}; };

View File

@@ -1,4 +1,4 @@
_trap = _this select 0; local _trap = _this select 0;
if (getNumber (configFile >> "CfgVehicles" >> typeOf _trap >> "singleUse") > 0) then { if (getNumber (configFile >> "CfgVehicles" >> typeOf _trap >> "singleUse") > 0) then {
[_trap,true] call remove_trap; [_trap,true] call remove_trap;

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 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";}; local _activatingPlayer = objectFromNetID(_this select 0);
_id = _this select 0; local _obj = objectFromNetID(_this select 1);
_uid = _this select 1; local _clientKey = _this select 2;
_activatingPlayer = _this select 2; local _playerUID = getPlayerUID _activatingPlayer;
_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;
_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 (_exitReason != "") exitWith {diag_log _exitReason};
if (isServer) then { local _id = _obj getVariable ["ObjectID","0"];
if (_processDelete) then {deleteVehicle _objPos}; local _uid = _obj getVariable ["ObjectUID","0"];
_type = typeOf _obj;
if (typeName _objPos != "ARRAY") then { local _processDelete = [true,_this select 3] select (count _this > 3);
_objPos = typeof _objPos; if (_processDelete) then {deleteVehicle _obj};
};
//remove from database //remove from database
if (parseNumber _id > 0) then { if (parseNumber _id > 0) then {
//Send request //Send request
_key = format["CHILD:304:%1:",_id]; _key = format["CHILD:304:%1:",_id];
_key call server_hiveWrite; _key call server_hiveWrite;
diag_log format["DELETE: Player %1(%2) deleted %4 with ID: %3",(_activatingPlayer call fa_plr2str), _PlayerUID, _id, _objPos]; diag_log format["DELETE: Player %1(%2) deleted %4 with ID: %3",(_activatingPlayer call fa_plr2str), _playerUID, _id, _type];
} else { } else {
//Send request //Send request
_key = format["CHILD:310:%1:",_uid]; _key = format["CHILD:310:%1:",_uid];
_key call server_hiveWrite; _key call server_hiveWrite;
diag_log format["DELETE: Player %1(%2) deleted %4 with UID: %3",(_activatingPlayer call fa_plr2str), _PlayerUID, _uid, _objPos]; diag_log format["DELETE: Player %1(%2) deleted %4 with UID: %3",(_activatingPlayer call fa_plr2str), _playerUID, _uid, _type];
};
}; };