mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-15 13:26:39 +03:00
missed from 0.934
This commit is contained in:
105
dayz_code/actions/player_craftItem.sqf
Normal file
105
dayz_code/actions/player_craftItem.sqf
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* 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"];
|
||||||
|
|
||||||
|
// Recipes
|
||||||
|
|
||||||
|
// 6 Tin cans = Tin Bar
|
||||||
|
// 6 Aluminum cans = Aluminum Bar
|
||||||
|
|
||||||
|
/*
|
||||||
|
== Canned Foods
|
||||||
|
"FoodCanBakedBeans",
|
||||||
|
"FoodCanSardines",
|
||||||
|
"FoodCanFrankBeans",
|
||||||
|
"FoodCanPasta",
|
||||||
|
"FoodBioMeat"
|
||||||
|
|
||||||
|
== Drinks
|
||||||
|
"ItemSodaCoke",
|
||||||
|
"ItemSodaPepsi",
|
||||||
|
|
||||||
|
== Trash
|
||||||
|
"TrashTinCan",
|
||||||
|
"TrashJackDaniels",
|
||||||
|
"ItemSodaEmpty",
|
||||||
|
|
||||||
|
== Raw Meats
|
||||||
|
"FoodSteakRaw",
|
||||||
|
"FoodmeatRaw",
|
||||||
|
"FoodbeefRaw",
|
||||||
|
"FoodmuttonRaw",
|
||||||
|
"FoodchickenRaw",
|
||||||
|
"FoodrabbitRaw",
|
||||||
|
"FoodbaconRaw"
|
||||||
|
|
||||||
|
== Cooked Meats
|
||||||
|
"FoodSteakCooked",
|
||||||
|
"FoodmeatCooked",
|
||||||
|
"FoodbeefCooked",
|
||||||
|
"FoodmuttonCooked",
|
||||||
|
"FoodchickenCooked",
|
||||||
|
"FoodrabbitCooked",
|
||||||
|
"FoodbaconCooked"
|
||||||
|
*/
|
||||||
|
|
||||||
|
// New items:
|
||||||
|
// ItemTinBar
|
||||||
|
// FoodChickenNoodle
|
||||||
|
// FoodBeefBakedBeans
|
||||||
|
// ItemSalt
|
||||||
|
|
||||||
|
// ["reqires","fire"]
|
||||||
|
|
||||||
|
|
||||||
|
_recipe_ItemTinBar = [["TrashTinCan",6]];
|
||||||
|
_recipe_ItemAluminumBar = [["ItemSodaEmpty",6]];
|
||||||
|
|
||||||
|
_recipe_FoodChickenNoodle = [["FoodchickenRaw",1],["FoodCanPasta",1],["ItemWaterbottle",1]];
|
||||||
|
_recipe_FoodBeefBakedBeans = [["FoodbeefRaw",1],["FoodCanBakedBeans",1]];
|
||||||
|
|
||||||
|
//Add new item
|
||||||
|
_item = _this;
|
||||||
|
_config = configFile >> "cfgMagazines" >> _item;
|
||||||
|
_create = getArray (_config >> "ItemActions" >> "Crafting" >> "output") select 0;
|
||||||
|
|
||||||
|
_selectedRecipe = call compile format["_recipe_%1;",_create];
|
||||||
|
diag_log format["Selected Recipe: %1", _selectedRecipe];
|
||||||
|
|
||||||
|
_proceed = true;
|
||||||
|
|
||||||
|
{
|
||||||
|
_itemIn = _x select 0;
|
||||||
|
_countIn = _x select 1;
|
||||||
|
diag_log format["Recipe Check: %1 %2", _itemIn,_countIn];
|
||||||
|
|
||||||
|
if (!(_itemIn in magazines player)) exitWith { _missing = _itemIn; _missingQty = _countIn; _proceed = false; };
|
||||||
|
|
||||||
|
_qty = {_x == _itemIn} count magazines player;
|
||||||
|
|
||||||
|
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
|
||||||
|
|
||||||
|
} forEach _selectedRecipe;
|
||||||
|
|
||||||
|
if (_proceed) then {
|
||||||
|
|
||||||
|
// Take items
|
||||||
|
{
|
||||||
|
_itemIn = _x select 0;
|
||||||
|
_countIn = _x select 1;
|
||||||
|
diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];
|
||||||
|
|
||||||
|
for "_x" from 1 to _countIn do {
|
||||||
|
player removeMagazine _itemIn;
|
||||||
|
};
|
||||||
|
|
||||||
|
} forEach _selectedRecipe;
|
||||||
|
|
||||||
|
// 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"];
|
||||||
|
};
|
||||||
@@ -73,6 +73,7 @@ if (!isDedicated) then {
|
|||||||
player_countmagazines = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_countmagazines.sqf";
|
player_countmagazines = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_countmagazines.sqf";
|
||||||
player_addToolbelt = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_addToolbelt.sqf";
|
player_addToolbelt = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_addToolbelt.sqf";
|
||||||
player_reloadMag = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_reloadMags.sqf";
|
player_reloadMag = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_reloadMags.sqf";
|
||||||
|
player_craftItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem.sqf";
|
||||||
player_tentPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\tent_pitch.sqf";
|
player_tentPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\tent_pitch.sqf";
|
||||||
player_vaultPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\vault_pitch.sqf";
|
player_vaultPitch = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\vault_pitch.sqf";
|
||||||
player_drink = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_drink.sqf";
|
player_drink = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_drink.sqf";
|
||||||
|
|||||||
@@ -1358,6 +1358,17 @@ class CfgMagazines
|
|||||||
picture = "\dayz_equip\textures\equip_soda_rbull_ca.paa";
|
picture = "\dayz_equip\textures\equip_soda_rbull_ca.paa";
|
||||||
descriptionShort = "$STR_EQUIP_NAME_37";
|
descriptionShort = "$STR_EQUIP_NAME_37";
|
||||||
};
|
};
|
||||||
|
class ItemBriefcase: CA_Magazine
|
||||||
|
{
|
||||||
|
scope = 2;
|
||||||
|
count = 1;
|
||||||
|
type = "(256 * 3)";
|
||||||
|
displayName = "Briefcase";
|
||||||
|
// model = "\misc3\briefcase.p3d";
|
||||||
|
picture = "\dayz_equip\textures\equip_bar_gold_CA.paa";
|
||||||
|
// TODO: Needs picture and model
|
||||||
|
descriptionShort = "Briefcase full of Gold Bars";
|
||||||
|
};
|
||||||
class ItemGoldBar: CA_Magazine
|
class ItemGoldBar: CA_Magazine
|
||||||
{
|
{
|
||||||
scope = 2;
|
scope = 2;
|
||||||
@@ -1395,10 +1406,21 @@ class CfgMagazines
|
|||||||
count = 1;
|
count = 1;
|
||||||
type = 256;
|
type = 256;
|
||||||
displayName = "Aluminum";
|
displayName = "Aluminum";
|
||||||
model = "\dayz_equip\models\silver_bar.p3d";
|
model = "\dayz_equip\models\aluminum_bar.p3d";
|
||||||
picture = "\dayz_equip\textures\equip_bar_silver_CA.paa";
|
picture = "\dayz_equip\textures\equip_bar_aluminum_CA.paa";
|
||||||
descriptionShort = "Aluminum Bar";
|
descriptionShort = "Aluminum Bar";
|
||||||
};
|
};
|
||||||
|
class ItemTinBar: CA_Magazine
|
||||||
|
{
|
||||||
|
scope = 2;
|
||||||
|
count = 1;
|
||||||
|
type = 256;
|
||||||
|
displayName = "Tin";
|
||||||
|
model = "\dayz_equip\models\tin_bar.p3d";
|
||||||
|
picture = "\dayz_equip\textures\equip_bar_tin_CA.paa";
|
||||||
|
descriptionShort = "Tin Bar";
|
||||||
|
};
|
||||||
|
|
||||||
class ItemZombieParts: CA_Magazine
|
class ItemZombieParts: CA_Magazine
|
||||||
{
|
{
|
||||||
scope = 2;
|
scope = 2;
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -644,6 +644,15 @@ class cfgMagazines
|
|||||||
picture = "\dayz_equip\textures\equip_tincan_ca.paa";
|
picture = "\dayz_equip\textures\equip_tincan_ca.paa";
|
||||||
descriptionShort = "$STR_EQUIP_DESC_33";
|
descriptionShort = "$STR_EQUIP_DESC_33";
|
||||||
ammo = "TinCan";
|
ammo = "TinCan";
|
||||||
|
class ItemActions
|
||||||
|
{
|
||||||
|
class Crafting
|
||||||
|
{
|
||||||
|
text = "Melt into Bars";
|
||||||
|
script = "spawn player_craftItem;";
|
||||||
|
output[] = {"ItemTinBar"};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
class ItemSodaEmpty: HandGrenade
|
class ItemSodaEmpty: HandGrenade
|
||||||
{
|
{
|
||||||
@@ -653,6 +662,15 @@ class cfgMagazines
|
|||||||
picture = "\dayz_equip\textures\equip_soda_empty_ca.paa";
|
picture = "\dayz_equip\textures\equip_soda_empty_ca.paa";
|
||||||
descriptionShort = "$STR_EQUIP_DESC_35";
|
descriptionShort = "$STR_EQUIP_DESC_35";
|
||||||
ammo = "SodaCan";
|
ammo = "SodaCan";
|
||||||
|
class ItemActions
|
||||||
|
{
|
||||||
|
class Crafting
|
||||||
|
{
|
||||||
|
text = "Melt into Bars";
|
||||||
|
script = "spawn player_craftItem;";
|
||||||
|
output[] = {"ItemAluminumBar"};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
class HandRoadFlare: HandGrenade
|
class HandRoadFlare: HandGrenade
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user