diff --git a/SQF/dayz_server/compile/server_updateObject.sqf b/SQF/dayz_server/compile/server_updateObject.sqf index ec557e739..bcf9b9b1d 100644 --- a/SQF/dayz_server/compile/server_updateObject.sqf +++ b/SQF/dayz_server/compile/server_updateObject.sqf @@ -4,6 +4,8 @@ if (isNil "sm_done") exitWith {}; private ["_class","_objectID","_objectUID","_isNotOk","_object","_type","_forced","_totalDmg"]; _object = _this select 0; +if ((isNil "_object") || {isNull _object}) exitWith {diag_log "server_updateObject.sqf _object null or nil, could not update object"}; + _type = _this select 1; _forced = if (count _this > 2) then {_this select 2} else {false}; _totalDmg = if (count _this > 3) then {_this select 3} else {false}; @@ -11,7 +13,6 @@ _isNotOk = false; _objectID = "0"; _objectUID = "0"; -if ((isNil "_object") || {isNull _object}) exitWith {diag_log "server_updateObject.sqf _object null or nil, could not update object"}; _objectID = _object getVariable ["ObjectID","0"]; _objectUID = _object getVariable ["ObjectUID","0"]; _class = typeOf _object; @@ -48,15 +49,15 @@ _object setVariable ["lastUpdate",diag_ticktime,true]; call { if (_type == "all") exitwith { - [_object,_objectID] call server_obj_pos; - [_object,_objectID,_objectUID] call server_obj_inv; + [_object,_objectID,_class] call server_obj_pos; + [_object,_objectID,_objectUID,_class] call server_obj_inv; [_object,_objectID,_objectUID,_forced,_totalDmg] call server_obj_dam; }; if (_type == "position") exitwith { - [_object,_objectID] call server_obj_pos; + [_object,_objectID,_class] call server_obj_pos; }; if (_type == "gear") exitwith { - [_object,_objectID,_objectUID] call server_obj_inv; + [_object,_objectID,_objectUID,_class] call server_obj_inv; }; if (_type == "damage" || {_type == "repair"}) exitwith { [_object,_objectID,_objectUID,_forced,_totalDmg] call server_obj_dam; @@ -70,10 +71,11 @@ call { _playerUID = _this select 4; _clientKey = _this select 5; - [_object,_objectID,_objectUID,_playerUID,_clientKey] call server_obj_killed; + [_object,_objectID,_objectUID,_playerUID,_clientKey,_class] call server_obj_killed; }; if (_type == "coins") exitwith { _object setVariable ["lastInventory",["forceUpdate"]]; [_object,_objectID,_objectUID] call server_obj_inv; }; + ""; }; diff --git a/SQF/dayz_server/compile/server_verifySender.sqf b/SQF/dayz_server/compile/server_verifySender.sqf index f863215ff..8acc15b0b 100644 --- a/SQF/dayz_server/compile/server_verifySender.sqf +++ b/SQF/dayz_server/compile/server_verifySender.sqf @@ -16,20 +16,20 @@ _player = _this select 5; _index = dayz_serverPUIDArray find _playerUID; -_exitReason = switch true do { +_exitReason = call { //If object or player is null distance returns 9999+ //If object or player was moved with setPos on client, position takes a second to update on server //Coordinates can be used in place of object - case (_objPos distance _player > (Z_VehicleDistance + 10)): { + if (_objPos distance _player > (Z_VehicleDistance + 10)) exitwith { format["%1 error: Verification failed, player is too far from object. Distance: %2m/%3m limit PV ARRAY: %4",_function,round (_objPos distance _player),Z_VehicleDistance + 10,_params] }; - case (_index < 0): { + if (_index < 0) exitwith { format["%1 error: PUID NOT FOUND ON SERVER. PV ARRAY: %2",_function,_params] }; - case (((dayz_serverClientKeys select _index) select 0 != owner _player) or ((dayz_serverClientKeys select _index) select 1 != _clientKey)): { + if (((dayz_serverClientKeys select _index) select 0 != owner _player) or ((dayz_serverClientKeys select _index) select 1 != _clientKey)) exitwith { format["%1 error: CLIENT AUTH KEY INCORRECT OR UNRECOGNIZED. PV ARRAY: %2",_function,_params] }; - default {""}; + ""; }; _exitReason diff --git a/SQF/dayz_server/compile/updateObject_functions.sqf b/SQF/dayz_server/compile/updateObject_functions.sqf index 5b7da6b11..9686982ed 100644 --- a/SQF/dayz_server/compile/updateObject_functions.sqf +++ b/SQF/dayz_server/compile/updateObject_functions.sqf @@ -5,7 +5,7 @@ server_obj_pos = { _object = _this select 0; _objectID = _this select 1; - _class = typeOf _object; + _class = _this select 2; _position = getPosATL _object; //_worldspace = [round (direction _object),_position]; @@ -26,27 +26,21 @@ server_obj_inv = { _object = _this select 0; _objectID = _this select 1; _objectUID = _this select 2; - _class = typeOf _object; - - if (_class isKindOf "TrapItems") then { - _inventory = [["armed",_object getVariable ["armed",false]]]; - } else { - _isNormal = true; - - if (DZE_permanentPlot && {_class == "Plastic_Pole_EP1_DZ"}) then { - _isNormal = false; - _inventory = _object getVariable ["plotfriends", []]; //We're replacing the inventory with UIDs for this item - }; - - if (DZE_doorManagement && {_class in DZE_DoorsLocked}) then { - _isNormal = false; - _inventory = _object getVariable ["doorfriends", []]; //We're replacing the inventory with UIDs for this item - }; - - if (_isNormal) then { - _inventory = [getWeaponCargo _object, getMagazineCargo _object, getBackpackCargo _object]; + _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 { @@ -137,8 +131,8 @@ server_obj_killed = { _objectUID = _this select 2; _playerUID = _this select 3; _clientKey = _this select 4; - - _class = typeOf _object; + _class = _this select 5; + _index = dayz_serverPUIDArray find _playerUID; _exitReason = call { @@ -150,10 +144,10 @@ server_obj_killed = { if ((dayz_serverClientKeys select _index) select 1 != _clientKey) exitwith { format["Server_UpdateObject error: CLIENT AUTH KEY INCORRECT OR UNRECOGNIZED. PV ARRAY: %1",_this] }; - if (alive _object && {!(_class isKindOf "TentStorage_base" or _class isKindOf "IC_Tent")}) exitwith { + if (alive _object or {!(_class isKindOf "TentStorage_base" or _class isKindOf "IC_Tent")}) exitwith { format["Server_UpdateObject error: object kill request on living object. PV ARRAY: %1",_this] }; - if (1==1) exitwith {""}; + ""; }; if (_exitReason != "") exitWith {diag_log _exitReason};