mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 20:13:13 +03:00
fixed crafting for different subclasses of ItemSodaEmpty
Signed-off-by: aeinstein <mb@2lss.de>
This commit is contained in:
@@ -28,6 +28,22 @@ TradeInprogress = true;
|
|||||||
"TrashTinCan",
|
"TrashTinCan",
|
||||||
"TrashJackDaniels",
|
"TrashJackDaniels",
|
||||||
"ItemSodaEmpty",
|
"ItemSodaEmpty",
|
||||||
|
"ItemSodaCokeEmpty",
|
||||||
|
"ItemSodaPepsiEmpty",
|
||||||
|
|
||||||
|
== community stuff Trash
|
||||||
|
"ItemSodaMdewEmpty",
|
||||||
|
"ItemSodaMtngreenEmpty",
|
||||||
|
"ItemSodaR4z0rEmpty",
|
||||||
|
"ItemSodaClaysEmpty",
|
||||||
|
"ItemSodaSmashtEmpty",.
|
||||||
|
"ItemSodaDrwasteEmpty",.
|
||||||
|
"ItemSodaLemonadeEmpty",.
|
||||||
|
"ItemSodaLvgEmpty",.
|
||||||
|
"ItemSodaMzlyEmpty",.
|
||||||
|
"ItemSodaRabbitEmpty"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
== Raw Meats
|
== Raw Meats
|
||||||
"FoodSteakRaw",
|
"FoodSteakRaw",
|
||||||
@@ -58,16 +74,21 @@ _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
|
|||||||
|
|
||||||
// reqire fire target
|
// reqire fire target
|
||||||
if (inflamed cursorTarget and _canDo) then {
|
if (inflamed cursorTarget and _canDo) then {
|
||||||
|
// Bad way to define static loot in library functions
|
||||||
|
// Better initially walkthrough all items which have output = _create
|
||||||
|
// and also fetch output quantity from config.
|
||||||
|
// best way: defining input and output with ratio in configFile
|
||||||
|
|
||||||
_recipe_ItemTinBar = [
|
_recipe_ItemTinBar = [
|
||||||
[ ["ItemTinBar",1] ],
|
[ ["ItemTinBar",1] ],
|
||||||
[ ["TrashTinCan",6] ]
|
[ ["TrashTinCan",6] ]
|
||||||
];
|
];
|
||||||
|
|
||||||
_recipe_ItemAluminumBar = [
|
_recipe_ItemAluminumBar = [
|
||||||
[ ["ItemAluminumBar",1] ],
|
[ ["ItemAluminumBar",1] ],
|
||||||
[ ["ItemSodaEmpty",6] ]
|
[ ["ItemSodaEmpty",6] ]
|
||||||
];
|
];
|
||||||
|
|
||||||
_recipe_ItemBronzeBar = [
|
_recipe_ItemBronzeBar = [
|
||||||
[ ["ItemBronzeBar",1] ],
|
[ ["ItemBronzeBar",1] ],
|
||||||
[ ["ItemCopperBar",3],["ItemTinBar",3] ]
|
[ ["ItemCopperBar",3],["ItemTinBar",3] ]
|
||||||
@@ -108,17 +129,12 @@ if (inflamed cursorTarget and _canDo) then {
|
|||||||
[ ["ItemSandbag",3],["ItemWire",1],["ItemTankTrap",1] ]
|
[ ["ItemSandbag",3],["ItemWire",1],["ItemTankTrap",1] ]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//_recipe_FoodChickenNoodle = [["FoodchickenRaw",1],["FoodCanPasta",1],["ItemWaterbottle",1]];
|
//_recipe_FoodChickenNoodle = [["FoodchickenRaw",1],["FoodCanPasta",1],["ItemWaterbottle",1]];
|
||||||
//_recipe_FoodBeefBakedBeans = [["FoodbeefRaw",1],["FoodCanBakedBeans",1]];
|
//_recipe_FoodBeefBakedBeans = [["FoodbeefRaw",1],["FoodCanBakedBeans",1]];
|
||||||
|
|
||||||
//Add new item
|
//Add new item
|
||||||
_item = _this;
|
_item = _this;
|
||||||
_config = configFile >> "cfgMagazines" >> _item;
|
_create = getArray (configFile >> "cfgMagazines" >> _item >> "ItemActions" >> "Crafting" >> "output") select 0;
|
||||||
_create = getArray (_config >> "ItemActions" >> "Crafting" >> "output") select 0;
|
|
||||||
|
|
||||||
_selectedRecipeArray = call compile format["_recipe_%1;",_create];
|
_selectedRecipeArray = call compile format["_recipe_%1;",_create];
|
||||||
|
|
||||||
@@ -132,18 +148,20 @@ if (inflamed cursorTarget and _canDo) then {
|
|||||||
{
|
{
|
||||||
_itemIn = _x select 0;
|
_itemIn = _x select 0;
|
||||||
_countIn = _x select 1;
|
_countIn = _x select 1;
|
||||||
|
|
||||||
diag_log format["Recipe Check: %1 %2", _itemIn,_countIn];
|
diag_log format["Recipe Check: %1 %2", _itemIn,_countIn];
|
||||||
|
|
||||||
if (!(_itemIn in magazines player)) exitWith { _missing = _itemIn; _missingQty = _countIn; _proceed = false; };
|
// not neccessary
|
||||||
|
//if (!(_itemIn in magazines player)) exitWith { _missing = _itemIn; _missingQty = _countIn; _proceed = false; };
|
||||||
|
|
||||||
_qty = {_x == _itemIn} count magazines player;
|
// match against class and parentClass
|
||||||
|
_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player;
|
||||||
|
|
||||||
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
|
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
|
||||||
|
|
||||||
} forEach _selectedRecipe;
|
} forEach _selectedRecipe;
|
||||||
|
|
||||||
if (_proceed) then {
|
if (_proceed) then {
|
||||||
|
|
||||||
player playActionNow "Medic";
|
player playActionNow "Medic";
|
||||||
sleep 1;
|
sleep 1;
|
||||||
[player,"repair",0,false] call dayz_zombieSpeak;
|
[player,"repair",0,false] call dayz_zombieSpeak;
|
||||||
@@ -156,10 +174,19 @@ if (inflamed cursorTarget and _canDo) then {
|
|||||||
_countIn = _x select 1;
|
_countIn = _x select 1;
|
||||||
diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];
|
diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];
|
||||||
|
|
||||||
for "_x" from 1 to _countIn do {
|
_removed = 0; // count of removed items
|
||||||
player removeMagazine _itemIn;
|
|
||||||
|
{
|
||||||
|
if( (_removed < _countIn)
|
||||||
|
&& ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)
|
||||||
|
) then {
|
||||||
|
diag_log format["removing: %1 kindOf: %2", _x, _itemIn];
|
||||||
|
player removeMagazine _x;
|
||||||
|
_removed = _removed +1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} forEach magazines player;
|
||||||
|
|
||||||
} forEach _selectedRecipe;
|
} forEach _selectedRecipe;
|
||||||
|
|
||||||
// Put items
|
// Put items
|
||||||
@@ -179,9 +206,10 @@ if (inflamed cursorTarget and _canDo) then {
|
|||||||
|
|
||||||
// Add crafted item
|
// Add crafted item
|
||||||
cutText [format["Crafted Item: %1 x %2",_textCreate,_countOut], "PLAIN DOWN"];
|
cutText [format["Crafted Item: %1 x %2",_textCreate,_countOut], "PLAIN DOWN"];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
|
_textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
|
||||||
cutText [format["Missing component: %1 x %2",_textMissing,_missingQty], "PLAIN DOWN"];
|
cutText [format["Missing %1 more of %2",_missingQty, _textMissing], "PLAIN DOWN"];
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
cutText ["Crafting needs a fire", "PLAIN DOWN"];
|
cutText ["Crafting needs a fire", "PLAIN DOWN"];
|
||||||
|
|||||||
Reference in New Issue
Block a user