mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
crafting changes
reverted changes to check Nearby added crafted item count, default is 1. Allows for crafting multiples of the same item (for example 1 plant in and 2 Seeds out) added item return after crafting, this allows the smelting tools to be a recipe requirement that gets refunded to player.
This commit is contained in:
parent
3eb4d63eba
commit
2d4a7a0258
@ -13,12 +13,11 @@
|
||||
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","_doObjectChecks","_find","_nearObjects","_result","_test1","_test2","_tmpResult"];
|
||||
private ["_check","_countAlive","_countOnFire","_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:
|
||||
{
|
||||
@ -50,27 +49,18 @@ switch (_type) do {
|
||||
if (_tmpResult) exitWith {_result = _tmpResult};
|
||||
} forEach _nearObjects;
|
||||
};
|
||||
case 3:
|
||||
{
|
||||
private _has = {_x == _check} count ((magazines player)+(items player));
|
||||
_result = (_has <= _cnt);
|
||||
_doObjectChecks = false;
|
||||
};
|
||||
};
|
||||
|
||||
// exit now if already false
|
||||
if !(_result) exitWith {false};
|
||||
if !(_result) exitWith {false}; //not enough objects
|
||||
|
||||
if (_doObjectChecks && _inflamed > 0) then {
|
||||
if (_inflamed > 0) then {
|
||||
_countOnFire = 0;
|
||||
_countOnFire = {inflamed _x} count _nearObjects;
|
||||
_result = (_cnt <= _countOnFire);
|
||||
};
|
||||
|
||||
// exit now if already false
|
||||
if !(_result) exitWith {false};
|
||||
|
||||
if (_doObjectChecks && _alive > 0) then {
|
||||
if (_alive > 0) then {
|
||||
_countAlive = 0;
|
||||
_countAlive = {alive _x} count _nearObjects;
|
||||
_result = (_cnt <= _countAlive);
|
||||
|
@ -28,7 +28,7 @@ if !(false call EPOCH_crafting_checkResources) exitWith {};
|
||||
//craft button
|
||||
[] spawn {
|
||||
|
||||
private ["_fnc_UILock","_itemCraftTime","_selection","_craftItem","_item","_itemName","_itemCraftTime","_itemRecipeItems","_itemType","_nearbyReq","_hasNearby","_canCraft","_wH","_nearByHolder","_wHPos"];
|
||||
private ["_craftReturn","_needBench","_craftCount","_fnc_UILock","_itemCraftTime","_selection","_craftItem","_item","_itemName","_itemCraftTime","_itemRecipeItems","_itemType","_nearbyReq","_hasNearby","_canCraft","_wH","_nearByHolder","_wHPos"];
|
||||
disableSerialization;
|
||||
|
||||
_fnc_UILock = {
|
||||
@ -50,7 +50,9 @@ if !(false call EPOCH_crafting_checkResources) exitWith {};
|
||||
_itemRecipeItems = _craftItem select 7;
|
||||
_itemType = _craftItem select 13;
|
||||
_nearbyReq = _craftItem select 8;
|
||||
_needBench = {"WorkBench_EPOCH" in (_x select 3 select 1)} count (_craftItem select 8);
|
||||
_needBench = {"WorkBench_EPOCH" in (_x select 3 select 1)} count _nearbyReq;
|
||||
_craftCount = _craftItem param [15,1];
|
||||
_craftReturn = _craftItem param [16,[]];
|
||||
|
||||
for "_c" from 1 to rmx_var_craftQTYOut do {
|
||||
false call _fnc_UILock;
|
||||
@ -72,11 +74,16 @@ if !(false call EPOCH_crafting_checkResources) exitWith {};
|
||||
_nearByBench = nearestObjects [player,["WorkBench_EPOCH"],3];
|
||||
|
||||
if (!(_nearByBench isEqualTo []) && (_needBench > 0)) then { //adds item on top of bench if bench was required
|
||||
(_nearByBench select 0) addItemCargoGlobal [_item,1];
|
||||
(_nearByBench select 0) addItemCargoGlobal [_item,_craftCount];
|
||||
} else {
|
||||
_item call EPOCH_fnc_addItemOverflow;
|
||||
[_item,_craftCount] call EPOCH_fnc_addItemOverflow;
|
||||
};
|
||||
|
||||
// return items
|
||||
{
|
||||
_x call EPOCH_fnc_addItemOverflow;
|
||||
} forEach _craftReturn;
|
||||
|
||||
call EPOCH_crafting_LB_click;
|
||||
};
|
||||
call EPOCH_crafting_LB_defaults;
|
||||
|
@ -14,7 +14,7 @@
|
||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/gui/scripts/craftingv2/EPOCH_crafting_getConfig.sqf
|
||||
*/
|
||||
//[[[cog import generate_private_arrays ]]]
|
||||
private ["_cfg","_Suppressed","_arr","_arrIn","_cCTime","_cDescFull","_cDescShort","_cDisplayName","_cModel","_cName","_cNearbyArr","_cPicture","_cPreviewArr","_cPreviewScale","_cPreviewVector","_cPriority","_cRecipeArr","_cType","_cUsedInArr","_out","_type0","_type1","_type2","_type3"];
|
||||
private ["_Suppressed","_arr","_arrIn","_cCTime","_cDescFull","_cDescShort","_cDisplayName","_cModel","_cName","_cNearbyArr","_cPicture","_cPreviewArr","_cPreviewScale","_cPreviewVector","_cPriority","_cRecipeArr","_cRecipeReturn","_cType","_cUsedInArr","_cfg","_craftCount","_out","_type0","_type1","_type2","_type3"];
|
||||
//[[[end]]]
|
||||
|
||||
_arrIn = _this;
|
||||
@ -46,7 +46,9 @@ _type0 = []; _type1 = []; _type2 = []; _type3 = []; _out = [];
|
||||
_cPreviewVector = getNumber (_x >> "previewVector");
|
||||
_cDescFull = getText (_x >> "descriptionFull");
|
||||
_cType = getNumber (_x >> "type");
|
||||
|
||||
_craftCount = getNumber (_x >> "craftCount");
|
||||
_cRecipeReturn = getArray (_x >> "recipeReturn");
|
||||
|
||||
if !(_Suppressed isequalto []) then {
|
||||
if (_cName in _Suppressed) then {
|
||||
_cRecipeArr = [];
|
||||
@ -61,11 +63,12 @@ _type0 = []; _type1 = []; _type2 = []; _type3 = []; _out = [];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
switch (_cPriority) do {
|
||||
case 0: {_type0 pushBack [_cName,_cDisplayName,_cPicture,_cDescShort,_cModel,_cPriority,_cCTime,_cRecipeArr,_cNearbyArr,_cUsedInArr,_cPreviewArr,_cPreviewScale,_cPreviewVector,_cType,_cDescFull]};
|
||||
case 1: {_type1 pushBack [_cName,_cDisplayName,_cPicture,_cDescShort,_cModel,_cPriority,_cCTime,_cRecipeArr,_cNearbyArr,_cUsedInArr,_cPreviewArr,_cPreviewScale,_cPreviewVector,_cType,_cDescFull]};
|
||||
case 2: {_type2 pushBack [_cName,_cDisplayName,_cPicture,_cDescShort,_cModel,_cPriority,_cCTime,_cRecipeArr,_cNearbyArr,_cUsedInArr,_cPreviewArr,_cPreviewScale,_cPreviewVector,_cType,_cDescFull]};
|
||||
case 3: {_type3 pushBack [_cName,_cDisplayName,_cPicture,_cDescShort,_cModel,_cPriority,_cCTime,_cRecipeArr,_cNearbyArr,_cUsedInArr,_cPreviewArr,_cPreviewScale,_cPreviewVector,_cType,_cDescFull]};
|
||||
case 0: {_type0 pushBack [_cName,_cDisplayName,_cPicture,_cDescShort,_cModel,_cPriority,_cCTime,_cRecipeArr,_cNearbyArr,_cUsedInArr,_cPreviewArr,_cPreviewScale,_cPreviewVector,_cType,_cDescFull,_craftCount,_cRecipeReturn]};
|
||||
case 1: {_type1 pushBack [_cName,_cDisplayName,_cPicture,_cDescShort,_cModel,_cPriority,_cCTime,_cRecipeArr,_cNearbyArr,_cUsedInArr,_cPreviewArr,_cPreviewScale,_cPreviewVector,_cType,_cDescFull,_craftCount,_cRecipeReturn]};
|
||||
case 2: {_type2 pushBack [_cName,_cDisplayName,_cPicture,_cDescShort,_cModel,_cPriority,_cCTime,_cRecipeArr,_cNearbyArr,_cUsedInArr,_cPreviewArr,_cPreviewScale,_cPreviewVector,_cType,_cDescFull,_craftCount,_cRecipeReturn]};
|
||||
case 3: {_type3 pushBack [_cName,_cDisplayName,_cPicture,_cDescShort,_cModel,_cPriority,_cCTime,_cRecipeArr,_cNearbyArr,_cUsedInArr,_cPreviewArr,_cPreviewScale,_cPreviewVector,_cType,_cDescFull,_craftCount,_cRecipeReturn]};
|
||||
};
|
||||
|
||||
} forEach _this;
|
||||
|
@ -19,8 +19,7 @@
|
||||
{
|
||||
{"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}},
|
||||
{{"Inventory", "", "workbench", {3,"SmeltingTools_EPOCH"}, 0, 1, 0, 0}}
|
||||
{{"Water source", "", "water", {2,{"water"}}, 3, 1, 0, 0}}
|
||||
|
||||
};
|
||||
|
||||
@ -42,10 +41,11 @@ class CfgCrafting
|
||||
class Default //className, any object or item
|
||||
{
|
||||
craftTime = 1; //time it takes to craft
|
||||
|
||||
craftCount = 1; // number of crafted items
|
||||
recipe[] = {}; //nested arrays, {{"item", 1}};
|
||||
nearby[] = {}; //nearby requirements - fire, water source, object
|
||||
usedIn[] = {}; //item is an ingredient
|
||||
recipeReturn[] = {}; // items to return after crafting is completed
|
||||
|
||||
previewPosition[] = {0.8125,1,0.285}; //XzY
|
||||
previewScale = 1;
|
||||
@ -1010,8 +1010,9 @@ class CfgCrafting
|
||||
class ItemCopperBar : Item
|
||||
{
|
||||
usedIn[] = {"ItemCables","ItemCopperBar10oz","EnergyPack"};
|
||||
nearby[] = {{"Inventory", "", "workbench", {3,"SmeltingTools_EPOCH"}, 0, 1, 0, 0},{"Fire","","fire",{1,{"ALL"}},3,1,1,0}};
|
||||
recipe[] = {{"ItemCables",1},{"water_epoch",1}};
|
||||
nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0}};
|
||||
recipe[] = {{"ItemCables",1},{"water_epoch",1},{"SmeltingTools_EPOCH",1}};
|
||||
recipeReturn[] = {"SmeltingTools_EPOCH"};
|
||||
previewPosition[] = {0.797144,1,0.27};
|
||||
previewScale = 1.3;
|
||||
previewVector = 2.5;
|
||||
@ -1019,8 +1020,9 @@ class CfgCrafting
|
||||
class ItemCopperBar10oz : Item
|
||||
{
|
||||
usedIn[] = {};
|
||||
nearby[] = {{"Inventory", "", "workbench", {3,"SmeltingTools_EPOCH"}, 0, 1, 0, 0},{"Fire","","fire",{1,{"ALL"}},3,1,1,0}};
|
||||
recipe[] = {{"ItemCopperBar",10},{"water_epoch",1}};
|
||||
nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0}};
|
||||
recipe[] = {{"ItemCopperBar",10},{"water_epoch",1},{"SmeltingTools_EPOCH",1}};
|
||||
recipeReturn[] = {"SmeltingTools_EPOCH"};
|
||||
previewPosition[] = {0.797144,1,0.26};
|
||||
previewScale = 0.7;
|
||||
previewVector = 2.5;
|
||||
@ -1028,8 +1030,9 @@ class CfgCrafting
|
||||
class ItemGoldBar : Item
|
||||
{
|
||||
usedIn[] = {"ItemGoldBar10oz","EnergyPackLg"};
|
||||
nearby[] = {{"Inventory", "", "workbench", {3,"SmeltingTools_EPOCH"}, 0, 1, 0, 0},{"Fire","","fire",{1,{"ALL"}},3,1,1,0}};
|
||||
recipe[] = {{"PartOreGold",2},{"water_epoch",1}};
|
||||
nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0}};
|
||||
recipe[] = {{"PartOreGold",2},{"water_epoch",1},{"SmeltingTools_EPOCH",1}};
|
||||
recipeReturn[] = {"SmeltingTools_EPOCH"};
|
||||
previewPosition[] = {0.8,1,0.26};
|
||||
previewScale = 2.5;
|
||||
previewVector = 2.5;
|
||||
@ -1037,8 +1040,9 @@ class CfgCrafting
|
||||
class ItemSilverBar : Item
|
||||
{
|
||||
usedIn[] = {"ItemSilverBar10oz"};
|
||||
nearby[] = {{"Inventory", "", "workbench", {3,"SmeltingTools_EPOCH"}, 0, 1, 0, 0},{"Fire","","fire",{1,{"ALL"}},3,1,1,0}};
|
||||
recipe[] = {{"PartOreSilver",2},{"water_epoch",1}};
|
||||
nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0}};
|
||||
recipe[] = {{"PartOreSilver",2},{"water_epoch",1},{"SmeltingTools_EPOCH",1}};
|
||||
recipeReturn[] = {"SmeltingTools_EPOCH"};
|
||||
previewPosition[] = {0.8,1,0.26};
|
||||
previewScale = 2.5;
|
||||
previewVector = 2.5;
|
||||
@ -1046,8 +1050,9 @@ class CfgCrafting
|
||||
class ItemGoldBar10oz : Item
|
||||
{
|
||||
usedIn[] = {"ItemBriefcaseGold100oz"};
|
||||
nearby[] = {{"Inventory", "", "workbench", {3,"SmeltingTools_EPOCH"}, 0, 1, 0, 0},{"Fire","","fire",{1,{"ALL"}},3,1,1,0}};
|
||||
recipe[] = {{"ItemGoldBar",10},{"water_epoch",1}};
|
||||
nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0}};
|
||||
recipe[] = {{"ItemGoldBar",10},{"water_epoch",1},{"SmeltingTools_EPOCH",1}};
|
||||
recipeReturn[] = {"SmeltingTools_EPOCH"};
|
||||
previewPosition[] = {0.801715,1,0.331674};
|
||||
previewScale = 1.5;
|
||||
previewVector = 0.3;
|
||||
@ -1055,8 +1060,9 @@ class CfgCrafting
|
||||
class ItemSilverBar10oz : Item
|
||||
{
|
||||
usedIn[] = {"ItemBriefcaseSilver100oz"};
|
||||
nearby[] = {{"Inventory", "", "workbench", {3,"SmeltingTools_EPOCH"}, 0, 1, 0, 0},{"Fire","","fire",{1,{"ALL"}},3,1,1,0}};
|
||||
recipe[] = {{"ItemSilverBar",10},{"water_epoch",1}};
|
||||
nearby[] = {{"Fire","","fire",{1,{"ALL"}},3,1,1,0}};
|
||||
recipe[] = {{"ItemSilverBar",10},{"water_epoch",1},{"SmeltingTools_EPOCH",1}};
|
||||
recipeReturn[] = {"SmeltingTools_EPOCH"};
|
||||
previewPosition[] = {0.801715,1,0.331674};
|
||||
previewScale = 1.5;
|
||||
previewVector = 0.3;
|
||||
|
Loading…
Reference in New Issue
Block a user