add item requirements to crafting

making metal bars from gold now require Smelting Tools in players
inventory.
This commit is contained in:
vbawol 2017-10-02 09:54:02 -05:00
parent d2daca6f46
commit da0d2c2ad8
3 changed files with 24 additions and 12 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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