diff --git a/dayz_code/actions/vault_pitch.sqf b/dayz_code/actions/vault_pitch.sqf index a10026092..75b0ceee3 100644 --- a/dayz_code/actions/vault_pitch.sqf +++ b/dayz_code/actions/vault_pitch.sqf @@ -49,11 +49,13 @@ if (!_isOk) then { //place tent (local) _tent = createVehicle ["VaultStorageLocked", _location, [], 0, "CAN_COLLIDE"]; _tent setdir _dir; + _location = getPosATL _tent; _tent setpos _location; player reveal _tent; - _location = getPosATL _tent; + _tent setVariable ["characterID",dayz_characterID,true]; + _tent setVariable ["OEMPos",_location,true]; //player setVariable ["tentUpdate",["Land_A_tent",_dir,_location,[dayz_tentWeapons,dayz_tentMagazines,dayz_tentBackpacks]],true]; diff --git a/dayz_code/compile/player_checkStealth.sqf b/dayz_code/compile/player_checkStealth.sqf index d2328c56e..97e3b843c 100644 --- a/dayz_code/compile/player_checkStealth.sqf +++ b/dayz_code/compile/player_checkStealth.sqf @@ -1,4 +1,4 @@ -private["_vel","_speed","_scalePose","_scaleMvmt","_scaleLight","_scaleAlert","_anim","_anim4","_initial","_isDay","_nearFlare","_scaler","_pos"]; +private["_vel","_speed","_scalePose","_scaleMvmt","_scaleLight","_scaleAlert","_anim","_anim4","_initial","_isDay","_nearFlare","_nearFire","_nearLight","_scaler","_pos"]; _vel = velocity (vehicle player); _speed = (_vel distance [0,0,0]); _pos = getPosATL player; @@ -57,6 +57,11 @@ if (_scaleLight < 0.9) then { _scaleLight = ((_scaler / 30) * 2) + _scaleLight; }; }; + _nearLight = nearestObject [(vehicle player),"StreetLamp"]; + if (!isNull _nearLight) then { + _scaler = 50 - (_nearLight distance (vehicle player)); + _scaleLight = ((_scaler / 50) * 2) + _scaleLight; + }; _nearFire = nearestObject [(vehicle player),"Land_Fire"]; if (!isNull _nearFire) then { _scaler = 50 - (_nearFire distance (vehicle player)); diff --git a/dayz_code/compile/player_lockVault.sqf b/dayz_code/compile/player_lockVault.sqf index 24f38feed..bf3aaf4b8 100644 --- a/dayz_code/compile/player_lockVault.sqf +++ b/dayz_code/compile/player_lockVault.sqf @@ -19,7 +19,8 @@ if(_ownerID == dayz_characterID) then { _obj setVariable["packing",1]; _dir = direction _obj; - _pos = getposATL _obj; + // _pos = getposATL _obj; + _pos = _obj getVariable["OEMPos",(getposATL _obj)]; [player,"tentpack",0,false] call dayz_zombieSpeak; sleep 3; @@ -32,25 +33,25 @@ if(_ownerID == dayz_characterID) then { _holder setVariable["CharacterID",_ownerID,true]; _holder setVariable["ObjectID",_objectID,true]; _holder setVariable["ObjectUID",_objectUID,true]; + _holder setVariable ["OEMPos", _pos, true]; _weapons = getWeaponCargo _obj; _magazines = getMagazineCargo _obj; _backpacks = getBackpackCargo _obj; - // dayzDeleteObj = [_objectID,_objectUID]; - // publicVariableServer "dayzDeleteObj"; - // if (isServer) then { - // dayzDeleteObj call local_deleteObj; - // }; - - deleteVehicle _obj; + // remove vault + deleteVehicle _obj; - - // Fill variables with loot - _holder setVariable ["WeaponCargo", _weapons, true]; - _holder setVariable ["MagazineCargo", _magazines, true]; - _holder setVariable ["BackpackCargo", _backpacks, true]; + 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 ["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 193f568c9..0b46ab73a 100644 --- a/dayz_code/compile/player_unlockVault.sqf +++ b/dayz_code/compile/player_unlockVault.sqf @@ -19,7 +19,8 @@ if(_ownerID == dayz_characterID) then { _obj setVariable["packing",1]; _dir = direction _obj; - _pos = getposATL _obj; + // _pos = getposATL _obj; + _pos = _obj getVariable["OEMPos",(getposATL _obj)]; [player,"tentpack",0,false] call dayz_zombieSpeak; sleep 3; @@ -32,47 +33,47 @@ if(_ownerID == dayz_characterID) then { _holder setVariable["CharacterID",_ownerID,true]; _holder setVariable["ObjectID",_objectID,true]; _holder setVariable["ObjectUID",_objectUID,true]; + _holder setVariable ["OEMPos", _pos, true]; _weapons = _obj getVariable["WeaponCargo",[]]; _magazines = _obj getVariable["MagazineCargo",[]]; _backpacks = _obj getVariable["BackpackCargo",[]]; - // dayzDeleteObj = [_objectID,_objectUID]; - // publicVariableServer "dayzDeleteObj"; - // if (isServer) then { - // dayzDeleteObj call local_deleteObj; - // }; - + // Remove locked vault deleteVehicle _obj; - + if (count _weapons > 0) then { + //Add weapons + _objWpnTypes = _weapons select 0; + _objWpnQty = _weapons select 1; + _countr = 0; + { + _holder addweaponcargoGlobal [_x,(_objWpnQty select _countr)]; + _countr = _countr + 1; + } forEach _objWpnTypes; + }; - //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; + if (count _magazines > 0) then { + //Add Magazines + _objWpnTypes = _magazines select 0; + _objWpnQty = _magazines select 1; + _countr = 0; + { + _holder addmagazinecargoGlobal [_x,(_objWpnQty select _countr)]; + _countr = _countr + 1; + } forEach _objWpnTypes; + }; - //Add Backpacks - _objWpnTypes = _backpacks select 0; - _objWpnQty = _backpacks select 1; - _countr = 0; - { - _holder addbackpackcargoGlobal [_x,(_objWpnQty select _countr)]; - _countr = _countr + 1; - } forEach _objWpnTypes; + if (count _backpacks > 0) then { + //Add Backpacks + _objWpnTypes = _backpacks select 0; + _objWpnQty = _backpacks select 1; + _countr = 0; + { + _holder addbackpackcargoGlobal [_x,(_objWpnQty select _countr)]; + _countr = _countr + 1; + } forEach _objWpnTypes; + }; cutText ["Your vault has been unlocked", "PLAIN DOWN"]; } else { diff --git a/dayz_server/system/server_monitor.sqf b/dayz_server/system/server_monitor.sqf index 8998dd994..81dd07c98 100644 --- a/dayz_server/system/server_monitor.sqf +++ b/dayz_server/system/server_monitor.sqf @@ -86,14 +86,7 @@ diag_log "HIVE: Starting"; clearWeaponCargoGlobal _object; clearMagazineCargoGlobal _object; - if (_object isKindOf "TentStorage") then { - _pos set [2,0]; - _object setpos _pos; - }; - if (_object isKindOf "VaultStorageLocked") then { - _pos set [2,0]; - _object setpos _pos; - }; + _object setpos _pos; _object setdir _dir; _object setDamage _damage; @@ -103,6 +96,7 @@ diag_log "HIVE: Starting"; _object setVariable ["WeaponCargo", (_intentory select 0), true]; _object setVariable ["MagazineCargo", (_intentory select 1), true]; _object setVariable ["BackpackCargo", (_intentory select 2), true]; + _object setVariable ["OEMPos", _pos, true]; } else { //Add weapons