Update server_updateObject from private to local

This commit is contained in:
AirwavesMan
2020-11-21 10:18:37 +01:00
parent e2c88a4ec7
commit d1ae3f1d00
2 changed files with 49 additions and 54 deletions

View File

@@ -1,21 +1,20 @@
// [_object,_type] spawn server_updateObject;
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
if (isNil "sm_done") exitWith {};
private ["_class","_objectID","_objectUID","_isNotOk","_object","_type","_forced","_totalDmg"];
//if (isNil "sm_done") exitWith {diag_log "sm_done is nil";};
_object = _this select 0;
if ((isNil "_object") || {isNull _object}) exitWith {diag_log "server_updateObject.sqf _object null or nil, could not update object"};
local _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};
_isNotOk = false;
_objectID = "0";
_objectUID = "0";
local _type = _this select 1;
local _forced = if (count _this > 2) then {_this select 2} else {false};
local _totalDmg = if (count _this > 3) then {_this select 3} else {false};
local _isNotOk = false;
local _objectID = "0";
local _objectUID = "0";
_objectID = _object getVariable ["ObjectID","0"];
_objectUID = _object getVariable ["ObjectUID","0"];
_class = typeOf _object;
local _class = typeOf _object;
if (typeName _objectID != "STRING" || {typeName _objectUID != "STRING"}) then {
#ifdef OBJECT_DEBUG
@@ -59,7 +58,7 @@ call {
if (_type == "gear") exitwith {
[_object,_objectID,_objectUID,_class] call server_obj_inv;
};
if (_type == "damage" || {_type == "repair"}) exitwith {
if (_type == "damage" || _type == "repair") exitwith {
[_object,_objectID,_objectUID,_forced,_totalDmg] call server_obj_dam;
};
if (_type == "killed") exitwith {

View File

@@ -1,18 +1,16 @@
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
server_obj_pos = {
private ["_object","_objectID","_class","_position","_worldspace","_fuel","_key"];
local _object = _this select 0;
local _objectID = _this select 1;
local _class = _this select 2;
_object = _this select 0;
_objectID = _this select 1;
_class = _this select 2;
_position = getPosATL _object;
local _position = getPosATL _object;
//_worldspace = [round (direction _object),_position];
_worldspace = [getDir _object, _position] call AN_fnc_formatWorldspace; // Precise Base Building 1.0.5
_fuel = [0, fuel _object] select (_class isKindOf "AllVehicles");
local _worldspace = [getDir _object, _position] call AN_fnc_formatWorldspace; // Precise Base Building 1.0.5
local _fuel = [0, fuel _object] select (_class isKindOf "AllVehicles");
_key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];
local _key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];
_key call server_hiveWrite;
#ifdef OBJECT_DEBUG
@@ -21,14 +19,12 @@ server_obj_pos = {
};
server_obj_inv = {
private ["_object","_objectID", "_objectUID", "_class","_inventory","_key","_coins","_previous"];
local _object = _this select 0;
local _objectID = _this select 1;
local _objectUID = _this select 2;
local _class = _this select 3;
_object = _this select 0;
_objectID = _this select 1;
_objectUID = _this select 2;
_class = _this select 3;
_inventory = call {
local _inventory = call {
if (DZE_permanentPlot && {_class == "Plastic_Pole_EP1_DZ"}) exitwith {
_object getVariable ["plotfriends", []] //We're replacing the inventory with UIDs for this item
};
@@ -42,8 +38,9 @@ server_obj_inv = {
};
_previous = str(_object getVariable["lastInventory",[]]);
local _previous = str(_object getVariable["lastInventory",[]]);
if (str _inventory != _previous) then {
local _key = "";
_object setVariable ["lastInventory",_inventory];
if (_objectID == "0") then {
_key = format["CHILD:309:%1:",_objectUID] + str _inventory + ":";
@@ -52,7 +49,7 @@ server_obj_inv = {
};
if (Z_SingleCurrency) then {
_coins = _object getVariable ["cashMoney", -1]; //set to invalid value if getVariable fails to prevent overwriting of coins in DB
local _coins = _object getVariable ["cashMoney", -1]; //set to invalid value if getVariable fails to prevent overwriting of coins in DB
_key = _key + str _coins + ":";
};
@@ -66,23 +63,22 @@ server_obj_inv = {
server_obj_dam = {
//Allow dmg process
private ["_object","_objectID", "_objectUID","_forced","_totalDmg","_recorddmg","_hitpoints","_array","_hit","_key","_damage","_allFixed","_lastUpdate"];
_object = _this select 0;
_objectID = _this select 1;
_objectUID = _this select 2;
_forced = _this select 3;
_totalDmg = _this select 4;
local _object = _this select 0;
local _objectID = _this select 1;
local _objectUID = _this select 2;
local _forced = _this select 3;
local _totalDmg = _this select 4;
_recorddmg = false;
_hitpoints = _object call vehicle_getHitpoints;
_damage = damage _object;
_array = [];
_allFixed = true;
_lastUpdate = _object getVariable ["lastUpdate",diag_tickTime];
local _recorddmg = false;
local _hitpoints = _object call vehicle_getHitpoints;
local _damage = damage _object;
local _array = [];
local _allFixed = true;
local _lastUpdate = _object getVariable ["lastUpdate",diag_tickTime];
{
_hit = [_object,_x] call object_getHit;
local _hit = [_object,_x] call object_getHit;
if ((_hit select 0) > 0) then {
_allFixed = false;
@@ -110,6 +106,7 @@ server_obj_dam = {
};
if (_recorddmg) then {
local _key = "";
if (_objectID == "0") then {
_key = format["CHILD:306:%1:",_objectUID] + str _array + ":" + str _damage + ":";
} else {
@@ -124,18 +121,17 @@ server_obj_dam = {
};
server_obj_killed = {
private ["_object", "_objectID", "_objectUID", "_class","_clientKey","_exitReason","_index","_key","_playerUID"];
local _object = _this select 0;
local _objectID = _this select 1;
local _objectUID = _this select 2;
local _playerUID = _this select 3;
local _clientKey = _this select 4;
local _class = _this select 5;
local _key = "";
_object = _this select 0;
_objectID = _this select 1;
_objectUID = _this select 2;
_playerUID = _this select 3;
_clientKey = _this select 4;
_class = _this select 5;
local _index = dayz_serverPUIDArray find _playerUID;
_index = dayz_serverPUIDArray find _playerUID;
_exitReason = call {
local _exitReason = call {
//Can't use owner because player may already be dead, can't use distance because player may be far from vehicle wreck
if (_clientKey == dayz_serverKey) exitwith {""};
if (_index < 0) exitwith {