Add better logging for server_deleteObj

This commit is contained in:
A Man
2020-04-03 14:54:58 +02:00
parent ad41a9a7f4
commit f6e7a1a91e
6 changed files with 32 additions and 26 deletions

View File

@@ -5,7 +5,7 @@ _objectID = _obj getVariable ["ObjectID","0"];
_objectUID = _obj getVariable ["ObjectUID","0"];
if (isServer) then {
[_objectID,_objectUID] call server_deleteObjDirect;
[_objectID,_objectUID,_obj] call server_deleteObjDirect;
} else {
if (count _this == 2) then {
//single use trap triggered, remove with no animation
@@ -14,4 +14,4 @@ if (isServer) then {
publicVariableServer "PVDZ_obj_Destroy";
//deleteVehicle _obj;
};
};
};

View File

@@ -10,7 +10,7 @@ _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 = if (count _this > 5) then {_this select 5} else {true};
_processDelete = [true,_this select 5] select (count _this > 5);
_PlayerUID = getPlayerUID _activatingPlayer;
_exitReason = [_this,"DeleteObj",_objPos,_clientKey,_PlayerUID,_activatingPlayer] call server_verifySender;
@@ -18,16 +18,21 @@ if (_exitReason != "") exitWith {diag_log _exitReason};
if (isServer) then {
if (_processDelete) then {deleteVehicle _objPos};
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 object with ID: %3",(_activatingPlayer call fa_plr2str), _PlayerUID, _id];
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 object with UID: %3",(_activatingPlayer call fa_plr2str), _PlayerUID, _uid];
diag_log format["DELETE: Player %1(%2) deleted %4 with UID: %3",(_activatingPlayer call fa_plr2str), _PlayerUID, _uid, _objPos];
};
};
};

View File

@@ -1,10 +1,11 @@
/*
[_objectID,_objectUID] call server_deleteObjDirect;
[_objectID,_objectUID,_obj] call server_deleteObjDirect;
*/
private["_id","_uid","_key"];
private ["_id","_uid","_key","_obj"];
_id = _this select 0;
_uid = _this select 1;
_obj = ["Object",typeof (_this select 2)] select (count _this > 2);
if (isServer) then {
//remove from database
@@ -12,11 +13,11 @@ if (isServer) then {
//Send request
_key = format["CHILD:304:%1:",_id];
_key call server_hiveWrite;
diag_log format["DELETE DIRECT: SERVER deleted object with ID: %1", _id];
diag_log format["DELETE DIRECT: SERVER deleted %2 with ID: %1", _id, _obj];
} else {
//Send request
_key = format["CHILD:310:%1:",_uid];
_key call server_hiveWrite;
diag_log format["DELETE DIRECT: SERVER deleted object with UID: %1", _uid];
diag_log format["DELETE DIRECT: SERVER deleted %2 with UID: %1", _uid, _obj];
};
};

View File

@@ -40,7 +40,7 @@ _uid = _worldspace call dayz_objectUID2;
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _characterID, _worldspace, [], [], 1,_uid];
#ifdef OBJECT_DEBUG
diag_log ("HIVE: WRITE: "+ str(_key));
diag_log ("HIVE: WRITE: "+ str(_key));
#endif
_key call server_hiveWrite;
@@ -78,7 +78,7 @@ if (_outcome != "PASS") then {
clearBackpackCargoGlobal _object;
deleteVehicle _object;
[_objectID,_objectUID] call server_deleteObjDirect;
[_objectID,_objectUID,_object] call server_deleteObjDirect;
//_newobject = createVehicle [_class, [0,0,0], [], 0, "CAN_COLLIDE"];
_newobject = _class createVehicle [0,0,0];

View File

@@ -28,7 +28,7 @@ if(!isNull(_obj)) then {
};
// Remove old object
deleteVehicle _obj;
_proceed = true;
};
@@ -36,23 +36,23 @@ if(isNull(_object)) then {
_proceed = false;
};
if(_objectID == "0" && _objectUID == "0") then {
if(_objectID == "0" && {_objectUID == "0"}) then {
_proceed = false;
} else {
[_objectID,_objectUID] call server_deleteObjDirect;
[_objectID,_objectUID,_obj] call server_deleteObjDirect;
};
_allowed = [_object, "Server"] call check_publishobject;
if (!_allowed || !_proceed) exitWith {
if (!_allowed || !_proceed) exitWith {
if(!isNull(_object)) then {
deleteVehicle _object;
deleteVehicle _object;
};
diag_log ("Invalid object swap by playerUID:" + _playerUID);
};
// Publish variables
_object setVariable ["CharacterID",_charID,true];
//_object setVariable ["ObjectUID",_objectUID,true];
_object setVariable ["OEMPos",(_worldspace select 1),true];
@@ -81,4 +81,4 @@ _object enableSimulation false;
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
diag_log format["PUBLISH: Player %1(%2) upgraded or downgraded object to %3 with UID:%4 @%5",(_activatingPlayer call fa_plr2str),_playerUID,_class,_uid,((_worldspace select 1) call fa_coor2str)];
diag_log format["PUBLISH: Player %1(%2) upgraded or downgraded object to %3 with UID:%4 @%5",(_activatingPlayer call fa_plr2str),_playerUID,_class,_uid,((_worldspace select 1) call fa_coor2str)];

View File

@@ -21,26 +21,26 @@ server_obj_pos = {
};
server_obj_inv = {
private ["_object","_objectID", "_objectUID", "_class","_inventory","_key","_isNormal","_coins","_previous"];
private ["_object","_objectID", "_objectUID", "_class","_inventory","_key","_coins","_previous"];
_object = _this select 0;
_objectID = _this select 1;
_objectUID = _this select 2;
_class = _this select 3;
_inventory = call {
if (DZE_permanentPlot && {_class == "Plastic_Pole_EP1_DZ"}) exitwith {
_object getVariable ["plotfriends", []] //We're replacing the inventory with UIDs for this item
};
};
if (DZE_doorManagement && {_class in DZE_DoorsLocked}) exitwith {
_object getVariable ["doorfriends", []] //We're replacing the inventory with UIDs for this item
};
};
if (_class isKindOf "TrapItems") exitwith {
[["armed",_object getVariable ["armed",false]]]
};
[getWeaponCargo _object, getMagazineCargo _object, getBackpackCargo _object]
};
_previous = str(_object getVariable["lastInventory",[]]);
if (str _inventory != _previous) then {
@@ -132,7 +132,7 @@ server_obj_killed = {
_playerUID = _this select 3;
_clientKey = _this select 4;
_class = _this select 5;
_index = dayz_serverPUIDArray find _playerUID;
_exitReason = call {
@@ -170,5 +170,5 @@ server_obj_killed = {
diag_log format["DELETE: PUID(%1) requested destroy on object %2 ID:%3 UID:%4",_playerUID,_class,_objectID,_objectUID];
};
if (_class in DayZ_removableObjects || {_class in DZE_isRemovable}) then {[_objectID,_objectUID] call server_deleteObjDirect;};
if (_class in DayZ_removableObjects || {_class in DZE_isRemovable}) then {[_objectID,_objectUID,_object] call server_deleteObjDirect;};
};