From 1268f55f32ded9f4e5703040f36fb74595933ee7 Mon Sep 17 00:00:00 2001 From: A Man Date: Wed, 23 Oct 2019 12:46:08 +0200 Subject: [PATCH] Fix floating loot after remove, pack or output from fn_dropItem --- CHANGE LOG 1.0.6.3.txt | 5 +-- SQF/dayz_code/actions/remove.sqf | 37 ++++++++++++---------- SQF/dayz_code/compile/fn_dropItem.sqf | 11 ++++--- SQF/dayz_code/compile/player_packTent.sqf | 20 +++++++++--- SQF/dayz_code/compile/player_packVault.sqf | 25 ++++++++------- 5 files changed, 59 insertions(+), 39 deletions(-) diff --git a/CHANGE LOG 1.0.6.3.txt b/CHANGE LOG 1.0.6.3.txt index 7b3c62351..143f0637a 100644 --- a/CHANGE LOG 1.0.6.3.txt +++ b/CHANGE LOG 1.0.6.3.txt @@ -20,9 +20,10 @@ [FIXED] Crafting wooden arrows from wood piles and razors was not possible. (d4b46e4) @AirwavesMan [FIXED] Top snap point for half cinder wall was incorrect. (8f10a36) @ndavalos, @AirwavesMan [FIXED] The RPK-74 magazine could not be used with all AK-74 versions. (82485ea) @AirwavesMan -[FIXED] Multiple Vehicle Upgrades were not possbile. (ac884f2), (a430f79), (c24504a) @F507DMT +[FIXED] Multiple Vehicle Upgrades were not possibile. (ac884f2), (a430f79), (c24504a) @F507DMT [FIXED] Fix an inventory dupe if on water. (a052ba7), (baf92eb) @F507DMT -[FIXED] The pickaxe and the broken pickaxe spawned in the ground on loot spawn. @AirwavesMan +[FIXED] The pickaxe and the broken pickaxe spawned in the ground on loot spawn. (a09bb81a) @AirwavesMan +[FIXED] Fix floating loot from remove, pack and fn_dropItem. @AirwavesMan [UPDATED] Spawning of Zombies and Loot in Safe Zones can now be toggled, disabled by default, see configVariables.sqf/DZE_SafeZoneZombieLoot (6248add, 141b25e) @oiad @_Lance_ [UPDATED] Added notification when status icons are disabled. (e04f0fc) @ebayShopper diff --git a/SQF/dayz_code/actions/remove.sqf b/SQF/dayz_code/actions/remove.sqf index a5b0de1e2..31a9130f9 100644 --- a/SQF/dayz_code/actions/remove.sqf +++ b/SQF/dayz_code/actions/remove.sqf @@ -4,7 +4,7 @@ dayz_actionInProgress = true; delete object from db with extra waiting by [VB]AWOL parameters: _obj */ -private ["_obj","_objectID","_objectUID","_finished","_isOk","_proceed","_counter","_limit","_objType","_itemOut","_countOut","_selectedRemoveOutput","_nearestPole","_ownerID","_refundpart","_isWreck","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_radius","_isWreckBuilding","_nameVehicle","_isModular","_success","_lootGroupIndex","_output"]; +private ["_plotcheck","_PlayerNear","_isMine","_obj","_objectID","_objectUID","_finished","_isOk","_proceed","_counter","_limit","_objType","_itemOut","_countOut","_selectedRemoveOutput","_nearestPole","_refundpart","_isWreck","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_isWreckBuilding","_nameVehicle","_isModular","_success","_lootGroupIndex","_output"]; player removeAction s_player_deleteBuild; s_player_deleteBuild = 1; @@ -38,7 +38,6 @@ _isRemovable = _objType in DZE_isRemovable; _isWreckBuilding = _objType in DZE_isWreckBuilding; _isMine = _objType in ["Land_iron_vein_wreck","Land_silver_vein_wreck","Land_gold_vein_wreck"]; _isModular = _obj isKindOf "ModularItems"; -_distance = DZE_PlotPole select 0; _PlayerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 10]) > 1; if (_PlayerNear && (_isMine or _objType == "Land_ammo_supply_wreck")) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;}; @@ -58,6 +57,8 @@ _IsNearPlot = _plotcheck select 1; _nearestPole = _plotcheck select 2; if(_IsNearPlot >= 1) then { + private ["_buildcheck","_isowner","_isfriendly"]; + // Since there are plot poles nearby we need to check ownership && friend status _buildcheck = [player, _nearestPole] call FNC_check_access; _isowner = _buildcheck select 0; @@ -89,7 +90,7 @@ while {_isOk} do { _isOk = false; _proceed = false; }; - + format[localize "str_epoch_player_163",_nameVehicle,(_counter + 1),_limit] call dayz_rollingMessages; [player,"repair",0,false,20] call dayz_zombieSpeak; @@ -150,7 +151,7 @@ if (_proceed && _success) then { // Double check that object is not null if(!isNull(_obj)) then { _ipos = getPosATL _obj; - + if(!_isWreck && !_isWreckBuilding) then { //Server performs deleteVehicle PVDZ_obj_Destroy = [_objectID,_objectUID,player,_obj,dayz_authKey]; @@ -158,7 +159,7 @@ if (_proceed && _success) then { } else { deleteVehicle _obj; }; - + if (_isWreckBuilding) then { PVDZ_send = [player,"RemoveObject",_ipos]; publicVariableServer "PVDZ_send"; @@ -194,10 +195,10 @@ if (_proceed && _success) then { if ({_objType in _x} count DZE_modularConfig > 0) then { { private ["_class", "_refund"]; - + _class = _x select 0; _refund = _x select 1; - + if (_objType == _class) then { {_selectedRemoveOutput set [count _selectedRemoveOutput,_x];} forEach _refund; }; @@ -214,14 +215,10 @@ if (_proceed && _success) then { [localize "str_epoch_player_90",1] call dayz_rollingMessages; }; - if (_ipos select 2 < 0) then { - _ipos set [2,0]; - }; - - _radius = 1; - if (_isMine) then { if((random 10) <= 4) then { + private ["_gems","_weights","_gemSelected"]; + _gems = []; _weights = []; { @@ -235,7 +232,16 @@ if (_proceed && _success) then { // give refund items if((count _selectedRemoveOutput) > 0 && !_preventRefund) then { - _item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"]; + private "_posPlayer"; + + _posPlayer = getPosATL player; + _iPos set [2,_posPlayer select 2]; + + if (_iPos select 2 < 0) then { + _iPos set [2,0]; + }; + + _item = "WeaponHolder" createVehicle [0,0,0]; { _itemOut = _x select 0; _countOut = _x select 1; @@ -254,7 +260,6 @@ if (_proceed && _success) then { } count _selectedRemoveOutput; _item setposATL _iPos; - player reveal _item; DZE_GearCheckBypass = true; //Bypass gear menu checks since dialog will always open on item player action ["Gear", _item]; @@ -265,4 +270,4 @@ if (_proceed && _success) then { }; dayz_actionInProgress = false; -s_player_deleteBuild = -1; \ No newline at end of file +s_player_deleteBuild = -1; diff --git a/SQF/dayz_code/compile/fn_dropItem.sqf b/SQF/dayz_code/compile/fn_dropItem.sqf index 758f84537..076f9dbfa 100644 --- a/SQF/dayz_code/compile/fn_dropItem.sqf +++ b/SQF/dayz_code/compile/fn_dropItem.sqf @@ -17,15 +17,18 @@ _nearByPile= nearestObjects [_pos, ["WeaponHolder","WeaponHolderBase"],PILE_SEAR if (count _nearByPile == 0) then { //No weapon holders found in the radius, spawn a new one - _holder = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"]; + _holder = "WeaponHolder" createVehicle [0,0,0]; + _holder setPosATL _pos; } else { //Found a near by weapon holder lets select it. _holder = _nearByPile select 0; - + if (!_manualPos) then { + private "_objects"; + //check to make sure the player can see the selected weapon holder. _objects = lineIntersectsWith [(_holder modeltoWorld PILE_OFFSET), _pos, player, _holder, true]; - + //Can you see the current selected weapon holder if (count _objects > 0) then { //Unable to see the current selected weapon holder within the radius lets create a new one. @@ -42,4 +45,4 @@ switch _type do { }; //Revel the item -player reveal _holder; \ No newline at end of file +player reveal _holder; diff --git a/SQF/dayz_code/compile/player_packTent.sqf b/SQF/dayz_code/compile/player_packTent.sqf index f334e1fc9..a021679c8 100644 --- a/SQF/dayz_code/compile/player_packTent.sqf +++ b/SQF/dayz_code/compile/player_packTent.sqf @@ -4,7 +4,7 @@ if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_actionInProgress = true; -private ["_alreadyPacking","_backpacks","_bag","_campItems","_dir","_holder","_magazines","_obj","_objectID","_objectUID","_ownerID","_packobj","_playerNear","_pos","_weapons","_finished"]; +private ["_alreadyPacking","_backpacks","_bag","_campItems","_dir","_holder","_magazines","_obj","_objectID","_objectUID","_ownerID","_packobj","_playerNear","_pos","_weapons","_finished","_posPlayer"]; _obj = _this; _ownerID = _obj getVariable["CharacterID","0"]; @@ -42,13 +42,21 @@ if (_ownerID in [dayz_characterID,dayz_playerUID] or typeOf _obj in _campItems) if (isNull _obj) exitWith {}; if (!_finished) exitWith {_obj setVariable["packing",0,true];}; + _posPlayer = getPosATL player; + _pos set [2,_posPlayer select 2]; + + if (_pos select 2 < 0) then { + _pos set [2,0]; + }; + //place tent (local) - _bag = createVehicle [_packobj, _pos, [], 0, "CAN_COLLIDE"]; + _bag = _packobj createVehicle [0,0,0]; _bag setDir _dir; - player reveal _bag; - - _holder = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"]; + _bag setPosATL _pos; + _holder = "WeaponHolder" createVehicle [0,0,0]; + _holder setPosATL _pos; + _weapons = getWeaponCargo _obj; _magazines = getMagazineCargo _obj; _backpacks = getBackpackCargo _obj; @@ -59,6 +67,8 @@ if (_ownerID in [dayz_characterID,dayz_playerUID] or typeOf _obj in _campItems) [_weapons,_magazines,_backpacks,_holder] call fn_addCargo; + player reveal _holder; + localize "str_success_tent_pack" call dayz_rollingMessages; } else { localize "str_fail_tent_pack" call dayz_rollingMessages; diff --git a/SQF/dayz_code/compile/player_packVault.sqf b/SQF/dayz_code/compile/player_packVault.sqf index f7d5cd698..767c57d68 100644 --- a/SQF/dayz_code/compile/player_packVault.sqf +++ b/SQF/dayz_code/compile/player_packVault.sqf @@ -1,10 +1,11 @@ +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; +dayz_actionInProgress = true; + /* [_obj] spawn player_packVault; */ -private ["_obj","_ownerID","_objectID","_objectUID","_location1","_location2","_packedClass","_text","_playerNear","_finished"]; -if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; -dayz_actionInProgress = true; +private ["_obj","_ownerID","_objectID","_objectUID","_location1","_location2","_packedClass","_text","_playerNear","_finished","_ComboMatch"]; _obj = _this; _packedClass = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "packedClass"); @@ -31,11 +32,11 @@ if (_objectID == "0" && _objectUID == "0") exitWith {dayz_actionInProgress = fal if (!_ComboMatch && (_ownerID != dayz_playerUID)) exitWith { dayz_actionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_119",_text] call dayz_rollingMessages;}; format[localize "str_epoch_player_121",_text] call dayz_rollingMessages; -uiSleep 1; +uiSleep 1; _location1 = getPosATL player; uiSleep 5; _location2 = getPosATL player; - + if(_location1 distance _location2 > 0.1) exitWith { format[localize "str_epoch_player_122",_text] call dayz_rollingMessages; s_player_packvault = -1; @@ -44,22 +45,22 @@ if(_location1 distance _location2 > 0.1) exitWith { if (!isNull _obj && alive _obj) then { [player,"tentpack",0,false] call dayz_zombieSpeak; - + _finished = ["Medic",1] call fn_loopAction; if (isNull _obj or !_finished) exitWith {}; - + ["Working",0,[3,2,4,0]] call dayz_NutritionSystem; - + (findDisplay 106) closeDisplay 0; // Close gear dze_waiting = nil; - + [_packedClass,objNull] call fn_waitForObject; - + PVDZE_handleSafeGear = [player,_obj,2]; - publicVariableServer "PVDZE_handleSafeGear"; + publicVariableServer "PVDZE_handleSafeGear"; //wait for response from server to verify pack was logged and gear added before proceeding waitUntil {!isNil "dze_waiting"}; - + format[localize "str_epoch_player_123",_text] call dayz_rollingMessages; }; s_player_packvault = -1;