From c34c0037b0f1c312f7328bce5fe5ac56ad8510c0 Mon Sep 17 00:00:00 2001 From: vbawol Date: Tue, 12 Feb 2013 22:01:14 -0600 Subject: [PATCH] 0.944 + finished removing crack vault code + fixed crafting system to give multiples back correctly --- dayz_code/actions/player_craftItem.sqf | 49 +++++++++++++++++++++----- dayz_code/compile/fn_selfActions.sqf | 20 ++--------- 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/dayz_code/actions/player_craftItem.sqf b/dayz_code/actions/player_craftItem.sqf index 69072917a..0d499875c 100644 --- a/dayz_code/actions/player_craftItem.sqf +++ b/dayz_code/actions/player_craftItem.sqf @@ -2,7 +2,7 @@ * Crafting by [VB]AWOL * usage: spawn player_craftitem; */ -private["_recipe_ItemTinBar","_recipe_ItemAluminumBar","_recipe_FoodChickenNoodle","_recipe_FoodBeefBakedBeans","_item","_config","_create","_selectedRecipe","_recipe_","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty"]; +private["_onLadder","_canDo","_recipe_ItemTinBar","_recipe_ItemAluminumBar","_recipe_ItemBronzeBar","_recipe_ItemGoldBar10oz","_recipe_ItemGoldBar","_recipe_FoodChickenNoodle","_recipe_FoodBeefBakedBeans","_item","_config","_create","_selectedRecipe","_recipe_","_selectedRecipeOutput","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut"]; // Recipes @@ -56,11 +56,29 @@ _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder); // reqire fire target if (inflamed cursorTarget and _canDo) then { - _recipe_ItemTinBar = [["TrashTinCan",6]]; - _recipe_ItemAluminumBar = [["ItemSodaEmpty",6]]; - _recipe_ItemBronzeBar = [["ItemCopperBar",3],["ItemTinBar",3]]; - _recipe_ItemGoldBar10oz = [["ItemGoldBar",10]]; - _recipe_ItemGoldBar = [["ItemGoldBar10oz",1]]; + + _recipe_ItemTinBar = [ + [ ["ItemTinBar",1]], + [ ["TrashTinCan",6] ] + ]; + _recipe_ItemAluminumBar = [ + [ ["ItemAluminumBar",1]], + [ ["ItemSodaEmpty",6] ] + ]; + _recipe_ItemBronzeBar = [ + [ ["ItemBronzeBar",1] ], + [ ["ItemCopperBar",3],["ItemTinBar",3] ] + ]; + + _recipe_ItemGoldBar10oz = [ + [ ["ItemGoldBar10oz",1] ], + [ ["ItemGoldBar",10] ] + ]; + + _recipe_ItemGoldBar = [ + [ ["ItemGoldBar",10] ], + [ ["ItemGoldBar10oz",1] ] + ]; _recipe_FoodChickenNoodle = [["FoodchickenRaw",1],["FoodCanPasta",1],["ItemWaterbottle",1]]; _recipe_FoodBeefBakedBeans = [["FoodbeefRaw",1],["FoodCanBakedBeans",1]]; @@ -70,7 +88,11 @@ if (inflamed cursorTarget and _canDo) then { _config = configFile >> "cfgMagazines" >> _item; _create = getArray (_config >> "ItemActions" >> "Crafting" >> "output") select 0; - _selectedRecipe = call compile format["_recipe_%1;",_create]; + _selectedRecipeArray = call compile format["_recipe_%1;",_create]; + + _selectedRecipeOutput = _selectedRecipeArray select 0; + _selectedRecipe = _selectedRecipeArray select 1; + diag_log format["Selected Recipe: %1", _selectedRecipe]; _proceed = true; @@ -102,8 +124,19 @@ if (inflamed cursorTarget and _canDo) then { } forEach _selectedRecipe; + // Put items + { + _itemOut = _x select 0; + _countOut = _x select 1; + diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn]; + + for "_x" from 1 to _countIn do { + player addMagazine _itemOut; + }; + + } forEach _selectedRecipeOutput; + // Add crafted item - player addMagazine _create; cutText [format["Crafted Item: %1",_create], "PLAIN DOWN"]; } else { cutText [format["Missing component: %1 x %2",_missing,_missingQty], "PLAIN DOWN"]; diff --git a/dayz_code/compile/fn_selfActions.sqf b/dayz_code/compile/fn_selfActions.sqf index 366943223..4ff294ce6 100644 --- a/dayz_code/compile/fn_selfActions.sqf +++ b/dayz_code/compile/fn_selfActions.sqf @@ -148,8 +148,6 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 6)) s_player_fillfuel = -1; }; - - if(_isPZombie) then { // Pzombie Gut human corpse or animal if ((_isAnimal or _isMan) and !_isHarvested and _canDo) then { @@ -213,22 +211,10 @@ if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 6)) }; //Allow owner to unlock vault - if(cursorTarget isKindOf "VaultStorageLocked" and _canDo and _ownerID != "0" and !UnlockInprogress) then { - if (_ownerID == dayz_playerUID) then { - if (s_player_unlockvault < 0 and (player distance cursorTarget < 3)) then { - s_player_unlockvault = player addAction ["Unlock Vault", "\z\addons\dayz_code\actions\vault_unlock.sqf",cursorTarget, 0, false, true, "",""]; - }; - } else { - if(_hasToolbox) then{ - if (s_player_unlockvault < 0 and (player distance cursorTarget < 3)) then { - s_player_unlockvault = player addAction ["Crack Vault", "\z\addons\dayz_code\actions\vault_unlock.sqf",cursorTarget, 0, false, true, "",""]; - }; - } else { - player removeAction s_player_unlockvault; - s_player_unlockvault = -1; - }; + if(cursorTarget isKindOf "VaultStorageLocked" and _canDo and _ownerID != "0" and _ownerID == dayz_playerUID and !UnlockInprogress) then { + if (s_player_unlockvault < 0 and (player distance cursorTarget < 3)) then { + s_player_unlockvault = player addAction ["Unlock Vault", "\z\addons\dayz_code\actions\vault_unlock.sqf",cursorTarget, 0, false, true, "",""]; }; - } else { player removeAction s_player_unlockvault; s_player_unlockvault = -1;