Fix 309 error for newly placed safe inventory

See my comments on ae78fde and a3c3ccc

The object_maintenance function is only for vanilla buildables and is
currently not used. It immediately overwrites with a 306 call.
This commit is contained in:
ebaydayz
2016-09-20 13:47:18 -04:00
parent e94a66e9fd
commit e2c2a2a76a
2 changed files with 18 additions and 40 deletions

View File

@@ -86,23 +86,17 @@ _object_inventory = {
}; };
}; };
//_previous = str(_object getVariable["lastInventory",[]]); //causes issues with door/plot management _previous = str(_object getVariable["lastInventory",[]]);
//if (str _inventory != _previous) then { if (str _inventory != _previous) then {
_object setVariable["lastInventory",_inventory]; _object setVariable["lastInventory",_inventory];
if (_objectID == "0") then { if (_objectID == "0") then {
if (Z_SingleCurrency) then { _key = format["CHILD:309:%1:",_objectUID] + str _inventory + ":";
_coins = _object getVariable [Z_MoneyVariable, -1]; //set to invalid value if getVariable fails to prevent overwriting of coins in DB
_key = format["CHILD:309:%1:%2:%3:",_objectUID,_inventory,_coins];
} else {
_key = format["CHILD:309:%1:%2:",_objectUID,_inventory];
};
} else { } else {
if (Z_SingleCurrency) then { _key = format["CHILD:303:%1:",_objectID] + str _inventory + ":";
_coins = _object getVariable [Z_MoneyVariable, -1]; };
_key = format["CHILD:303:%1:%2:%3:",_objectID,_inventory,_coins]; if (Z_SingleCurrency) then {
} else { _coins = _object getVariable [Z_MoneyVariable, -1]; //set to invalid value if getVariable fails to prevent overwriting of coins in DB
_key = format["CHILD:303:%1:%2:",_objectID,_inventory]; _key = _key + str _coins + ":";
};
}; };
#ifdef OBJECT_DEBUG #ifdef OBJECT_DEBUG
@@ -110,7 +104,7 @@ _object_inventory = {
#endif #endif
_key call server_hiveWrite; _key call server_hiveWrite;
//}; };
}; };
_object_damage = { _object_damage = {
@@ -199,20 +193,10 @@ _object_maintenance = {
_variables set [count _variables, ["padlockCombination", _accessArray]]; _variables set [count _variables, ["padlockCombination", _accessArray]];
if (_objectID == "0") then { if (_objectID == "0") then {
if (Z_SingleCurrency) then { //_key = format["CHILD:309:%1:%2:",_objectUID,_ownerArray];
_coins = _object getVariable [Z_MoneyVariable, -1];
_key = format["CHILD:309:%1:%2:%3:",_objectUID,_ownerArray,_coins];
} else {
_key = format["CHILD:309:%1:%2:",_objectUID,_ownerArray];
};
_key = format["CHILD:306:%1:%2:%3:",_objectUID,[],0]; //Wont work just now. _key = format["CHILD:306:%1:%2:%3:",_objectUID,[],0]; //Wont work just now.
} else { } else {
if (Z_SingleCurrency) then { //_key = format["CHILD:303:%1:%2:",_objectID,_ownerArray];
_coins = _object getVariable [Z_MoneyVariable, -1];
_key = format["CHILD:303:%1:%2:%3:",_objectID,_ownerArray,_coins];
} else {
_key = format["CHILD:303:%1:%2:",_objectID,_ownerArray];
};
_key = format["CHILD:306:%1:%2:%3:",_objectID,[],0]; _key = format["CHILD:306:%1:%2:%3:",_objectID,[],0];
}; };
@@ -223,7 +207,7 @@ _object_maintenance = {
}; };
_object_variables = { _object_variables = {
private ["_ownerArray","_key","_accessArray","_variables"]; private ["_ownerArray","_key","_accessArray","_variables","_coins"];
_ownerArray = _object getVariable ["ownerArray",[]]; _ownerArray = _object getVariable ["ownerArray",[]];
_accessArray = _object getVariable ["dayz_padlockCombination",[]]; _accessArray = _object getVariable ["dayz_padlockCombination",[]];
@@ -236,19 +220,13 @@ _object_variables = {
_variables set [count _variables, ["BuildLock", _lockedArray]]; _variables set [count _variables, ["BuildLock", _lockedArray]];
if (_objectID == "0") then { if (_objectID == "0") then {
if (Z_SingleCurrency) then { _key = format["CHILD:309:%1:%2:",_objectUID,_variables];
_coins = _object getVariable [Z_MoneyVariable, -1];
_key = format["CHILD:309:%1:%2:%3:",_objectUID,_variables,_coins];
} else {
_key = format["CHILD:309:%1:%2:",_objectUID,_variables];
};
} else { } else {
if (Z_SingleCurrency) then { _key = format["CHILD:303:%1:%2:",_objectID,_variables];
_coins = _object getVariable [Z_MoneyVariable, -1]; };
_key = format["CHILD:303:%1:%2:%3:",_objectID,_variables,_coins]; if (Z_SingleCurrency) then {
} else { _coins = _object getVariable [Z_MoneyVariable, -1];
_key = format["CHILD:303:%1:%2:",_objectID,_variables]; _key = _key + str _coins + ":";
};
}; };
_key call server_hiveWrite; _key call server_hiveWrite;
}; };

Binary file not shown.