From c55f242fd37ff64ebbe8b3222c5990285fe2f626 Mon Sep 17 00:00:00 2001 From: A Clark Date: Sun, 25 Nov 2012 06:31:26 -0600 Subject: [PATCH] more vault fixes --- dayz_code/actions/vault_pack.sqf | 1 - dayz_code/compile/player_lockVault.sqf | 35 ++------ dayz_code/compile/player_unlockVault.sqf | 9 +- dayz_equip/config.cpp | 7 +- dayz_server/system/server_monitor.sqf | 102 ++++++++++++----------- 5 files changed, 70 insertions(+), 84 deletions(-) diff --git a/dayz_code/actions/vault_pack.sqf b/dayz_code/actions/vault_pack.sqf index 051440ac9..b350dff28 100644 --- a/dayz_code/actions/vault_pack.sqf +++ b/dayz_code/actions/vault_pack.sqf @@ -1,4 +1,3 @@ private["_obj","_bag","_pos"]; -hintSilent format["DEBUG: %1",_this]; _obj = _this select 3; _obj spawn player_packVault; diff --git a/dayz_code/compile/player_lockVault.sqf b/dayz_code/compile/player_lockVault.sqf index 4928ab796..24f38feed 100644 --- a/dayz_code/compile/player_lockVault.sqf +++ b/dayz_code/compile/player_lockVault.sqf @@ -26,6 +26,7 @@ if(_ownerID == dayz_characterID) then { //place tent (local) _holder = createVehicle ["VaultStorageLocked",_pos,[], 0, "CAN_COLLIDE"]; _holder setdir _dir; + _holder setpos _pos; player reveal _holder; _holder setVariable["CharacterID",_ownerID,true]; @@ -42,34 +43,14 @@ if(_ownerID == dayz_characterID) then { // dayzDeleteObj call local_deleteObj; // }; - deleteVehicle _obj; - - //Add weapons - _objWpnTypes = _weapons select 0; - _objWpnQty = _weapons select 1; - _countr = 0; - { - _holder addweaponcargoGlobal [_x,(_objWpnQty select _countr)]; - _countr = _countr + 1; - } forEach _objWpnTypes; - - //Add Magazines - _objWpnTypes = _magazines select 0; - _objWpnQty = _magazines select 1; - _countr = 0; - { - _holder addmagazinecargoGlobal [_x,(_objWpnQty select _countr)]; - _countr = _countr + 1; - } forEach _objWpnTypes; + deleteVehicle _obj; - //Add Backpacks - _objWpnTypes = _backpacks select 0; - _objWpnQty = _backpacks select 1; - _countr = 0; - { - _holder addbackpackcargoGlobal [_x,(_objWpnQty select _countr)]; - _countr = _countr + 1; - } forEach _objWpnTypes; + + + // Fill variables with loot + _holder setVariable ["WeaponCargo", _weapons, true]; + _holder setVariable ["MagazineCargo", _magazines, true]; + _holder setVariable ["BackpackCargo", _backpacks, true]; cutText ["Your vault has been locked", "PLAIN DOWN"]; } else { diff --git a/dayz_code/compile/player_unlockVault.sqf b/dayz_code/compile/player_unlockVault.sqf index 9d8d1a92f..193f568c9 100644 --- a/dayz_code/compile/player_unlockVault.sqf +++ b/dayz_code/compile/player_unlockVault.sqf @@ -26,15 +26,16 @@ if(_ownerID == dayz_characterID) then { //place tent (local) _holder = createVehicle ["VaultStorage",_pos,[], 0, "CAN_COLLIDE"]; _holder setdir _dir; + _holder setpos _pos; player reveal _holder; _holder setVariable["CharacterID",_ownerID,true]; _holder setVariable["ObjectID",_objectID,true]; _holder setVariable["ObjectUID",_objectUID,true]; - _weapons = getWeaponCargo _obj; - _magazines = getMagazineCargo _obj; - _backpacks = getBackpackCargo _obj; + _weapons = _obj getVariable["WeaponCargo",[]]; + _magazines = _obj getVariable["MagazineCargo",[]]; + _backpacks = _obj getVariable["BackpackCargo",[]]; // dayzDeleteObj = [_objectID,_objectUID]; // publicVariableServer "dayzDeleteObj"; @@ -43,6 +44,8 @@ if(_ownerID == dayz_characterID) then { // }; deleteVehicle _obj; + + //Add weapons _objWpnTypes = _weapons select 0; diff --git a/dayz_equip/config.cpp b/dayz_equip/config.cpp index 5fd2fc33a..85dcb3127 100644 --- a/dayz_equip/config.cpp +++ b/dayz_equip/config.cpp @@ -1931,14 +1931,9 @@ class CfgVehicles model = "\dayz_equip\models\safe1.p3d"; destrType = "DestructNo"; armor = 2000; - memoryPointSupply = ""; - supplyRadius = 0; - transportMaxWeapons = 0; transportMaxMagazines = 0; + transportMaxWeapons = 0; transportMaxBackpacks = 0; - transportAmmo = 0; - transportRepair = 0; - transportFuel = 0; }; class CardboardBox: ReammoBox diff --git a/dayz_server/system/server_monitor.sqf b/dayz_server/system/server_monitor.sqf index e3eca8136..8998dd994 100644 --- a/dayz_server/system/server_monitor.sqf +++ b/dayz_server/system/server_monitor.sqf @@ -90,7 +90,7 @@ diag_log "HIVE: Starting"; _pos set [2,0]; _object setpos _pos; }; - if (_object isKindOf "VaultStorage") then { + if (_object isKindOf "VaultStorageLocked") then { _pos set [2,0]; _object setpos _pos; }; @@ -98,57 +98,61 @@ diag_log "HIVE: Starting"; _object setDamage _damage; if (count _intentory > 0) then { - //Add weapons - _objWpnTypes = (_intentory select 0) select 0; - _objWpnQty = (_intentory select 0) select 1; - _countr = 0; - { - _isOK = isClass(configFile >> "CfgWeapons" >> _x); - if (_isOK) then { - _block = getNumber(configFile >> "CfgWeapons" >> _x >> "stopThis") == 1; - if (!_block) then { - _object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)]; - }; - }; - _countr = _countr + 1; - } forEach _objWpnTypes; - - //Add Magazines - _objWpnTypes = (_intentory select 1) select 0; - _objWpnQty = (_intentory select 1) select 1; - _countr = 0; - { - _isOK = isClass(configFile >> "CfgMagazines" >> _x); - if (_isOK) then { - _block = getNumber(configFile >> "CfgMagazines" >> _x >> "stopThis") == 1; - if (!_block) then { - _object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)]; - }; - }; - _countr = _countr + 1; - } forEach _objWpnTypes; + if (_object isKindOf "VaultStorageLocked") then { + // Fill variables with loot + _object setVariable ["WeaponCargo", (_intentory select 0), true]; + _object setVariable ["MagazineCargo", (_intentory select 1), true]; + _object setVariable ["BackpackCargo", (_intentory select 2), true]; + } else { - //Add Backpacks - _objWpnTypes = (_intentory select 2) select 0; - _objWpnQty = (_intentory select 2) select 1; - _countr = 0; - { - _isOK = isClass(configFile >> "CfgVehicles" >> _x); - if (_isOK) then { - _block = getNumber(configFile >> "CfgVehicles" >> _x >> "stopThis") == 1; - if (!_block) then { - _object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)]; + //Add weapons + _objWpnTypes = (_intentory select 0) select 0; + _objWpnQty = (_intentory select 0) select 1; + _countr = 0; + { + _isOK = isClass(configFile >> "CfgWeapons" >> _x); + if (_isOK) then { + _block = getNumber(configFile >> "CfgWeapons" >> _x >> "stopThis") == 1; + if (!_block) then { + _object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)]; + }; }; - }; - _countr = _countr + 1; - } forEach _objWpnTypes; + _countr = _countr + 1; + } forEach _objWpnTypes; + + //Add Magazines + _objWpnTypes = (_intentory select 1) select 0; + _objWpnQty = (_intentory select 1) select 1; + _countr = 0; + { + _isOK = isClass(configFile >> "CfgMagazines" >> _x); + if (_isOK) then { + _block = getNumber(configFile >> "CfgMagazines" >> _x >> "stopThis") == 1; + if (!_block) then { + _object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)]; + }; + }; + _countr = _countr + 1; + } forEach _objWpnTypes; + + //Add Backpacks + _objWpnTypes = (_intentory select 2) select 0; + _objWpnQty = (_intentory select 2) select 1; + _countr = 0; + { + _isOK = isClass(configFile >> "CfgVehicles" >> _x); + if (_isOK) then { + _block = getNumber(configFile >> "CfgVehicles" >> _x >> "stopThis") == 1; + if (!_block) then { + _object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)]; + }; + }; + _countr = _countr + 1; + } forEach _objWpnTypes; + }; }; if (_object isKindOf "AllVehicles") then { - if(_ownerID != 0) then { - _object setVehicleInit "this lock true; this lockCargo true;"; - processInitCommands; - }; { _selection = _x select 0; _dam = _x select 1; @@ -161,6 +165,10 @@ diag_log "HIVE: Starting"; _position = ([(getPosATL _object),0,100,10,0,500,0] call BIS_fnc_findSafePos); _object setPosATL _position; }; + + if(_ownerID != "0") then { + _object setvehiclelock "locked"; + }; _object call fnc_vehicleEventHandler; _totalvehicles = _totalvehicles + 1; };