Added Config Crafting inputstrict

This commit is contained in:
Florian Kinder
2014-02-09 03:41:37 +01:00
parent caafc7fbcb
commit e4c9e90442
2 changed files with 48 additions and 45 deletions

View File

@@ -16,6 +16,7 @@ class ItemMixOil : CA_Magazine {
requiretools[] = {};
output[] = {{"ItemJerryMixed",1}};
input[] = {{"ItemMixOil",1},{"ItemJerrycan",1}};
inputstrict = true;
};
};
};

View File

@@ -14,12 +14,13 @@ class ItemActions
requiretools[] = {"ItemToolbox","ItemKnife"}; // (cfgweapons only)
output[] = {{"ItemTent",1}}; // (CfgMagazines, qty)
input[] = {{"ItemCanvas",2},{"ItemPole",2}}; // (CfgMagazines, qty)
inputstrict = true; // (CfgMagazines input without inheritsFrom) Optional
inputweapons[] = {"ItemToolbox"}; // consume toolbox (cfgweapons only)
outputweapons[] = {"ItemToolbox"}; // return toolbox (cfgweapons only)
};
};
*/
private ["_tradeComplete","_onLadder","_canDo","_selectedRecipeOutput","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut","_started","_finished","_animState","_isMedic","_removed","_tobe_removed_total","_textCreate","_textMissing","_selectedRecipeInput","_num_removed","_removed_total","_temp_removed_array","_abort","_reason","_isNear","_missingTools","_hastoolweapon","_selectedRecipeTools","_distance","_crafting","_needNear","_item","_baseClass","_num_removed_weapons","_outputWeapons","_inputWeapons","_randomOutput","_craft_doLoop","_selectedWeapon","_selectedMag","_sfx"];
private ["_tradeComplete","_onLadder","_canDo","_selectedRecipeOutput","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut","_started","_finished","_animState","_isMedic","_removed","_tobe_removed_total","_textCreate","_textMissing","_selectedRecipeInput","_selectedRecipeInputStrict","_num_removed","_removed_total","_temp_removed_array","_abort","_reason","_isNear","_missingTools","_hastoolweapon","_selectedRecipeTools","_distance","_crafting","_needNear","_item","_baseClass","_num_removed_weapons","_outputWeapons","_inputWeapons","_randomOutput","_craft_doLoop","_selectedWeapon","_selectedMag","_sfx"];
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_63") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;
@@ -68,6 +69,7 @@ if (_canDo) then {
_selectedRecipeTools = getArray (configFile >> _baseClass >> _item >> "ItemActions" >> _crafting >> "requiretools");
_selectedRecipeOutput = getArray (configFile >> _baseClass >> _item >> "ItemActions" >> _crafting >> "output");
_selectedRecipeInput = getArray (configFile >> _baseClass >> _item >> "ItemActions" >> _crafting >> "input");
_selectedRecipeInputStrict = if ((isNumber (configFile >> _baseClass >> _item >> "ItemActions" >> _crafting >> "inputstrict")) && (getNumber (configFile >> _baseClass >> _item >> "ItemActions" >> _crafting >> "inputstrict"))) then {true} else {false};
_outputWeapons = getArray (configFile >> _baseClass >> _item >> "ItemActions" >> _crafting >> "outputweapons");
_inputWeapons = getArray (configFile >> _baseClass >> _item >> "ItemActions" >> _crafting >> "inputweapons");
@@ -105,7 +107,7 @@ if (_canDo) then {
_itemIn = _x select 0;
_countIn = _x select 1;
_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player;
_qty = { (_x == _itemIn) || (!_selectedRecipeInputStrict && configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player;
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
@@ -160,7 +162,7 @@ if (_canDo) then {
{
_configParent = configName(inheritsFrom(configFile >> "cfgMagazines" >> _x));
if( (_removed < _countIn) && ((_x == _itemIn) || _configParent == _itemIn)) then {
if( (_removed < _countIn) && ((_x == _itemIn) || (!_selectedRecipeInputStrict && _configParent == _itemIn))) then {
_num_removed = ([player,_x] call BIS_fnc_invRemove);
_removed = _removed + _num_removed;
_removed_total = _removed_total + _num_removed;