From 1ade44eb3589aeb1a4576c64979348d9402a01fd Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Tue, 16 Feb 2016 17:23:57 -0500 Subject: [PATCH] Fix for crafting multiple SledgeHammers Revision of https://github.com/EpochModTeam/DayZ-Epoch/pull/1567 Thanks @Namindu --- SQF/dayz_code/actions/player_craftItem.sqf | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/SQF/dayz_code/actions/player_craftItem.sqf b/SQF/dayz_code/actions/player_craftItem.sqf index 40ccf60e7..92a8677df 100644 --- a/SQF/dayz_code/actions/player_craftItem.sqf +++ b/SQF/dayz_code/actions/player_craftItem.sqf @@ -221,34 +221,38 @@ if (_canDo) then { _craft_doLoop = false; }; { - player addWeapon _x; + if ((_x == "ItemSledge") && {_x in items player}) then { + _bag = unitBackpack player; + if (!isNull _bag) then { + systemChat format[(localize "str_epoch_player_313"),_x]; + _bag addWeaponCargoGlobal [_x,1]; + } else { + systemChat format[(localize "str_epoch_player_314"),_x]; + _object = createVehicle ["WeaponHolder",position player,[],0,"CAN_COLLIDE"]; + _object setVariable ["permaLoot",true]; + _object addWeaponCargoGlobal [_x,1]; + }; + } else { + player addWeapon _x; + }; } forEach _outputWeapons; { - _itemOut = _x select 0; _countOut = _x select 1; - if (_itemOut == "ItemWaterbottleUnfilled") then { - if (_waterLevel > 0) then { _itemOut = format["ItemWaterbottle%1oz",_waterLevel]; }; - }; - // diag_log format["Checking for water level: %1", _waterLevel]; - for "_x" from 1 to _countOut do { player addMagazine _itemOut; }; - _textCreate = getText(configFile >> "CfgMagazines" >> _itemOut >> "displayName"); - // Add crafted item cutText [format[(localize "str_epoch_player_150"),_textCreate,_countOut], "PLAIN DOWN"]; // sleep here sleep 1; - } forEach _selectedRecipeOutput; _tradeComplete = _tradeComplete+1; @@ -257,7 +261,6 @@ if (_canDo) then { } else { // Refund parts since we failed {player addMagazine _x; } forEach _temp_removed_array; - cutText [format[(localize "str_epoch_player_151"),_removed_total,_tobe_removed_total], "PLAIN DOWN"]; }; @@ -285,4 +288,4 @@ if (_canDo) then { } else { cutText [(localize "str_epoch_player_64"), "PLAIN DOWN"]; }; -DZE_ActionInProgress = false; \ No newline at end of file +DZE_ActionInProgress = false;