From e1577bc4f3fb0ae99660a014ff76d84b98998088 Mon Sep 17 00:00:00 2001 From: "[VB]AWOL" Date: Wed, 7 May 2014 09:44:41 -0500 Subject: [PATCH] Revert to previous code for lock and unlock safes Should fix dupe issues introduced with that newer system --- SQF/dayz_code/compile/player_lockVault.sqf | 19 ++++++++- SQF/dayz_code/compile/player_unlockVault.sqf | 18 ++------ SQF/dayz_server/init/server_functions.sqf | 45 -------------------- 3 files changed, 20 insertions(+), 62 deletions(-) diff --git a/SQF/dayz_code/compile/player_lockVault.sqf b/SQF/dayz_code/compile/player_lockVault.sqf index 790a8347b..1aa880a96 100644 --- a/SQF/dayz_code/compile/player_lockVault.sqf +++ b/SQF/dayz_code/compile/player_lockVault.sqf @@ -58,8 +58,23 @@ if(!isNull _obj) then { _holder setVariable["ObjectUID",_objectUID,true]; _holder setVariable ["OEMPos", _pos, true]; - PVDZE_obj_setlocalVars = [_obj,_holder,player]; - publicVariableServer "PVDZE_obj_setlocalVars"; + _weapons = getWeaponCargo _obj; + _magazines = getMagazineCargo _obj; + _backpacks = getBackpackCargo _obj; + + // remove vault + deleteVehicle _obj; + + // Fill variables with loot + if (count _weapons > 0) then { + _holder setVariable ["WeaponCargo", _weapons, true]; + }; + if (count _magazines > 0) then { + _holder setVariable ["MagazineCargo", _magazines, true]; + }; + if (count _backpacks > 0) then { + _holder setVariable ["BackpackCargo", _backpacks, true]; + }; cutText [format[(localize "str_epoch_player_117"),_text], "PLAIN DOWN"]; }; diff --git a/SQF/dayz_code/compile/player_unlockVault.sqf b/SQF/dayz_code/compile/player_unlockVault.sqf index a41c23135..529f41c02 100644 --- a/SQF/dayz_code/compile/player_unlockVault.sqf +++ b/SQF/dayz_code/compile/player_unlockVault.sqf @@ -60,27 +60,15 @@ if ((_ownerID == dayz_combination) or (_ownerID == dayz_playerUID)) then { _obj setVariable["packing",1]; [1,1] call dayz_HungerThirst; + _weapons = _obj getVariable["WeaponCargo",[]]; + _magazines = _obj getVariable["MagazineCargo",[]]; + _backpacks = _obj getVariable["BackpackCargo",[]]; player playActionNow "Medic"; sleep 1; [player,"tentpack",0,false] call dayz_zombieSpeak; sleep 5; - PVDZE_obj_getlocalVars = [player, _obj]; - - PVDZE_localVarsResult = nil; - - publicVariableServer "PVDZE_obj_getlocalVars"; - - waitUntil {sleep 1; !isNil "PVDZE_localVarsResult"}; - - _weapons = if (typeName (PVDZE_localVarsResult select 0) == "ARRAY") then { (PVDZE_localVarsResult select 0) } else { [] }; - _magazines = if (typeName (PVDZE_localVarsResult select 1) == "ARRAY") then { (PVDZE_localVarsResult select 1) } else { [] }; - _backpacks = if (typeName (PVDZE_localVarsResult select 2) == "ARRAY") then { (PVDZE_localVarsResult select 2) } else { [] }; - _holder = createVehicle [_unlockedClass,_pos,[], 0, "CAN_COLLIDE"]; - if ((isNull _holder) or (isNil "_holder")) then { - _holder = createVehicle [_unlockedClass,_pos,[], 0, "CAN_COLLIDE"]; - }; // Remove locked vault deleteVehicle _obj; _holder setdir _dir; diff --git a/SQF/dayz_server/init/server_functions.sqf b/SQF/dayz_server/init/server_functions.sqf index c6afa2e3b..de34bfa19 100644 --- a/SQF/dayz_server/init/server_functions.sqf +++ b/SQF/dayz_server/init/server_functions.sqf @@ -882,48 +882,3 @@ server_spawnCleanAnimals = { diag_log (format["CLEANUP: Deleted %1 Animals out of %2",_delQtyAnimal,_qty]); }; }; - -server_getLocalObjVars = { - private ["_player","_obj","_objectID","_objectUID","_weapons","_magazines","_backpacks"]; - - _player = _this select 0; - _obj = _this select 1; - - if (isNull _player or isNull _obj) exitWith { diag_log format["ERROR: getLocalObjVars is Null Player: %1 Object: %2 ", _player, _obj] }; - - _objectID = _obj getVariable["ObjectID","0"]; - _objectUID = _obj getVariable["ObjectUID","0"]; - - _weapons = _obj getVariable ["WeaponCargo", false]; - _magazines = _obj getVariable ["MagazineCargo", false]; - _backpacks = _obj getVariable ["BackpackCargo", false]; - - PVDZE_localVarsResult = [_weapons,_magazines,_backpacks]; - (owner _player) publicVariableClient "PVDZE_localVarsResult"; - diag_log format["SAFE UNLOCKED: ID:%1 UID:%2 BY %3(%4)", _objectID, _objectUID, (name _player), (getPlayerUID _player)]; -}; - -server_setLocalObjVars = { - private ["_obj","_holder","_weapons","_magazines","_backpacks","_player","_objectID","_objectUID"]; - - _obj = _this select 0; - _holder = _this select 1; - _player = _this select 2; - - if (isNull _player or isNull _holder or isNull _obj) exitWith { diag_log format["ERROR: setLocalObjVars is Null Player: %1 Object: %2 Holder: %3", _player, _obj, _holder] }; - - _objectID = _obj getVariable["ObjectID","0"]; - _objectUID = _obj getVariable["ObjectUID","0"]; - - _weapons = getWeaponCargo _obj; - _magazines = getMagazineCargo _obj; - _backpacks = getBackpackCargo _obj; - - deleteVehicle _obj; - - _holder setVariable ["WeaponCargo", _weapons]; - _holder setVariable ["MagazineCargo", _magazines]; - _holder setVariable ["BackpackCargo", _backpacks]; - - diag_log format["SAFE LOCKED: ID:%1 UID:%2 BY %3(%4)", _objectID, _objectUID, (name _player), (getPlayerUID _player)]; -};