diff --git a/Sources/epoch_code/gui/scripts/craftingv2/EPOCH_crafting_checkNearby.sqf b/Sources/epoch_code/gui/scripts/craftingv2/EPOCH_crafting_checkNearby.sqf index 6149a894..fd3bae80 100644 --- a/Sources/epoch_code/gui/scripts/craftingv2/EPOCH_crafting_checkNearby.sqf +++ b/Sources/epoch_code/gui/scripts/craftingv2/EPOCH_crafting_checkNearby.sqf @@ -13,11 +13,12 @@ https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/scripts/craftingv2/EPOCH_crafting_checkNearby.sqf */ //[[[cog import generate_private_arrays ]]] -private ["_check","_countAlive","_countOnFire","_find","_nearObjects","_result","_test1","_test2","_tmpResult"]; +private ["_check","_countAlive","_countOnFire","_doObjectChecks","_find","_nearObjects","_result","_test1","_test2","_tmpResult"]; //[[[end]]] params ["","","",["_arr",[2,""]],["_dist",0],["_cnt",1],["_inflamed",0],["_alive",0]]; _arr params ["_type","_check"]; _result = false; +_doObjectChecks = true; switch (_type) do { case 0: { @@ -44,23 +45,32 @@ switch (_type) do { _tmpResult = false; { if (alive _x) then { - _tmpResult = [_x, _check] call EPOCH_worldObjectType; + _tmpResult = [_x, _check] call EPOCH_worldObjectType; }; if (_tmpResult) exitWith {_result = _tmpResult}; } forEach _nearObjects; }; + case 3: + { + private _has = {_x == _check} count ((magazines player)+(items player)); + _result = (_has <= _cnt); + _doObjectChecks = false; + }; }; -if !(_result) exitWith {false}; //not enough objects +// exit now if already false +if !(_result) exitWith {false}; -if (_inflamed > 0) then { +if (_doObjectChecks && _inflamed > 0) then { _countOnFire = 0; _countOnFire = {inflamed _x} count _nearObjects; _result = (_cnt <= _countOnFire); }; + +// exit now if already false if !(_result) exitWith {false}; -if (_alive > 0) then { +if (_doObjectChecks && _alive > 0) then { _countAlive = 0; _countAlive = {alive _x} count _nearObjects; _result = (_cnt <= _countAlive); diff --git a/Sources/epoch_config/Configs/cfgCrafting.hpp b/Sources/epoch_config/Configs/cfgCrafting.hpp index b0020d8f..1bfa43dc 100644 --- a/Sources/epoch_config/Configs/cfgCrafting.hpp +++ b/Sources/epoch_config/Configs/cfgCrafting.hpp @@ -19,7 +19,8 @@ { {"Fire", "", "fire", {1,{"ALL"}}, 3, 1, 1, 0}, {"Water source","","water",{0,{"barrelwater_f.p3d", "water_source_f.p3d", "pumpa.p3d", "misc_wellpump.p3d"}},3,1,0,0}, - {{"Water source", "", "water", {2,{"water"}}, 3, 1, 0, 0}} + {{"Water source", "", "water", {2,{"water"}}, 3, 1, 0, 0}}, + {{"Inventory", "", "workbench", {3,"SmeltingTools_EPOCH"}, 0, 1, 0, 0}} }; @@ -1001,7 +1002,7 @@ class CfgCrafting class ItemCopperBar : Item { usedIn[] = {"ItemCables","ItemCopperBar10oz","EnergyPack"}; - nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0}}; + nearby[] = {{"Inventory", "", "workbench", {3,"SmeltingTools_EPOCH"}, 0, 1, 0, 0},{"Fire","","fire",{1,{"ALL"}},3,1,1,0}}; recipe[] = {{"ItemCables",1},{"water_epoch",1}}; previewPosition[] = {0.797144,1,0.27}; previewScale = 1.3; @@ -1010,7 +1011,7 @@ class CfgCrafting class ItemCopperBar10oz : Item { usedIn[] = {}; - nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0}}; + nearby[] = {{"Inventory", "", "workbench", {3,"SmeltingTools_EPOCH"}, 0, 1, 0, 0},{"Fire","","fire",{1,{"ALL"}},3,1,1,0}}; recipe[] = {{"ItemCopperBar",10},{"water_epoch",1}}; previewPosition[] = {0.797144,1,0.26}; previewScale = 0.7; @@ -1019,7 +1020,7 @@ class CfgCrafting class ItemGoldBar : Item { usedIn[] = {"ItemGoldBar10oz","EnergyPackLg"}; - nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0}}; + nearby[] = {{"Inventory", "", "workbench", {3,"SmeltingTools_EPOCH"}, 0, 1, 0, 0},{"Fire","","fire",{1,{"ALL"}},3,1,1,0}}; recipe[] = {{"PartOreGold",2},{"water_epoch",1}}; previewPosition[] = {0.8,1,0.26}; previewScale = 2.5; @@ -1028,7 +1029,7 @@ class CfgCrafting class ItemSilverBar : Item { usedIn[] = {"ItemSilverBar10oz"}; - nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0}}; + nearby[] = {{"Inventory", "", "workbench", {3,"SmeltingTools_EPOCH"}, 0, 1, 0, 0},{"Fire","","fire",{1,{"ALL"}},3,1,1,0}}; recipe[] = {{"PartOreSilver",2},{"water_epoch",1}}; previewPosition[] = {0.8,1,0.26}; previewScale = 2.5; @@ -1037,7 +1038,7 @@ class CfgCrafting class ItemGoldBar10oz : Item { usedIn[] = {"ItemBriefcaseGold100oz"}; - nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0}}; + nearby[] = {{"Inventory", "", "workbench", {3,"SmeltingTools_EPOCH"}, 0, 1, 0, 0},{"Fire","","fire",{1,{"ALL"}},3,1,1,0}}; recipe[] = {{"ItemGoldBar",10},{"water_epoch",1}}; previewPosition[] = {0.801715,1,0.331674}; previewScale = 1.5; @@ -1046,7 +1047,7 @@ class CfgCrafting class ItemSilverBar10oz : Item { usedIn[] = {"ItemBriefcaseSilver100oz"}; - nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0}}; + nearby[] = {{"Inventory", "", "workbench", {3,"SmeltingTools_EPOCH"}, 0, 1, 0, 0},{"Fire","","fire",{1,{"ALL"}},3,1,1,0}}; recipe[] = {{"ItemSilverBar",10},{"water_epoch",1}}; previewPosition[] = {0.801715,1,0.331674}; previewScale = 1.5; diff --git a/changelog.md b/changelog.md index 8b810254..96012329 100644 --- a/changelog.md +++ b/changelog.md @@ -32,6 +32,7 @@ All changes for [Arma 3](https://arma3.com/) [Epoch Mod](https://epochmod.com) a - Initial support for Malden 2035 map released with A3 1.72+. ### Changed +- Crafting recipes can now have item requirements and Crafting metal bars now require Smelting Tools. - Player save and login optimized to use get|setUnitLoadout. - Karma now persists death and moved to community stats. - CBA extended event handler and zeus curator support for Epoch Vehicles. @DirtySanchez