commit | author | age
|
ee5c6c
|
1 |
-- Register alloy recipes |
K |
2 |
technic.alloy_recipes = {} |
5d799e
|
3 |
|
ee5c6c
|
4 |
-- Register recipe in a table |
K |
5 |
technic.register_alloy_recipe = function(metal1, count1, metal2, count2, result, count3) |
|
6 |
technic.alloy_recipes[metal1..metal2] = { src1_count = count1, src2_count = count2, dst_name = result, dst_count = count3 } |
|
7 |
if unified_inventory then |
|
8 |
unified_inventory.register_craft( |
|
9 |
{ |
|
10 |
type = "alloy", |
|
11 |
output = result.." "..count3, |
|
12 |
items = {metal1.." "..count1,metal2.." "..count2}, |
|
13 |
width = 2, |
|
14 |
}) |
|
15 |
end |
|
16 |
end |
|
17 |
|
|
18 |
-- Retrieve a recipe given the input metals. |
|
19 |
-- Input parameters are a table from a StackItem |
|
20 |
technic.get_alloy_recipe = function(metal1, metal2) |
|
21 |
-- Check for both combinations of metals and for the right amount in both |
|
22 |
if technic.alloy_recipes[metal1.name..metal2.name] |
|
23 |
and metal1.count >= technic.alloy_recipes[metal1.name..metal2.name].src1_count |
|
24 |
and metal2.count >= technic.alloy_recipes[metal1.name..metal2.name].src2_count then |
|
25 |
return technic.alloy_recipes[metal1.name..metal2.name] |
|
26 |
elseif technic.alloy_recipes[metal2.name..metal1.name] |
|
27 |
and metal2.count >= technic.alloy_recipes[metal2.name..metal1.name].src1_count |
|
28 |
and metal1.count >= technic.alloy_recipes[metal2.name..metal1.name].src2_count then |
|
29 |
return technic.alloy_recipes[metal2.name..metal1.name] |
|
30 |
else |
|
31 |
return nil |
|
32 |
end |
|
33 |
end |
|
34 |
|
|
35 |
technic.register_alloy_recipe("technic:copper_dust", 3, "technic:tin_dust", 1, "technic:bronze_dust", 4) |
|
36 |
technic.register_alloy_recipe("moreores:copper_ingot",3, "moreores:tin_ingot", 1, "moreores:bronze_ingot", 4) |
|
37 |
technic.register_alloy_recipe("technic:iron_dust", 3, "technic:chromium_dust", 1, "technic:stainless_steel_dust", 4) |
|
38 |
technic.register_alloy_recipe("default:steel_ingot", 3, "technic:chromium_ingot",1, "technic:stainless_steel_ingot",4) |
|
39 |
technic.register_alloy_recipe("technic:copper_dust", 2, "technic:zinc_dust", 1, "technic:brass_dust", 3) |
|
40 |
technic.register_alloy_recipe("moreores:copper_ingot",2, "technic:zinc_ingot", 1, "technic:brass_ingot", 3) |
|
41 |
technic.register_alloy_recipe("default:sand", 2, "technic:coal_dust", 2, "technic:silicon_wafer", 1) |
|
42 |
technic.register_alloy_recipe("technic:silicon_wafer",1, "technic:gold_dust", 1, "technic:doped_silicon_wafer", 1) |
|
43 |
|
|
44 |
-------------------------------------- |
|
45 |
-- LEGACY CODE - some other mods might depend on this - Register the same recipes as above... |
|
46 |
-------------------------------------- |
|
47 |
alloy_recipes = {} |
|
48 |
registered_recipes_count = 1 |
5d799e
|
49 |
|
R |
50 |
function register_alloy_recipe (string1,count1, string2,count2, string3,count3) |
ee5c6c
|
51 |
alloy_recipes[registered_recipes_count]={} |
K |
52 |
alloy_recipes[registered_recipes_count].src1_name=string1 |
|
53 |
alloy_recipes[registered_recipes_count].src1_count=count1 |
|
54 |
alloy_recipes[registered_recipes_count].src2_name=string2 |
|
55 |
alloy_recipes[registered_recipes_count].src2_count=count2 |
|
56 |
alloy_recipes[registered_recipes_count].dst_name=string3 |
|
57 |
alloy_recipes[registered_recipes_count].dst_count=count3 |
|
58 |
registered_recipes_count=registered_recipes_count+1 |
|
59 |
alloy_recipes[registered_recipes_count]={} |
|
60 |
alloy_recipes[registered_recipes_count].src1_name=string2 |
|
61 |
alloy_recipes[registered_recipes_count].src1_count=count2 |
|
62 |
alloy_recipes[registered_recipes_count].src2_name=string1 |
|
63 |
alloy_recipes[registered_recipes_count].src2_count=count1 |
|
64 |
alloy_recipes[registered_recipes_count].dst_name=string3 |
|
65 |
alloy_recipes[registered_recipes_count].dst_count=count3 |
|
66 |
registered_recipes_count=registered_recipes_count+1 |
|
67 |
if unified_inventory then |
|
68 |
unified_inventory.register_craft({ |
19c9a0
|
69 |
type = "alloy", |
S |
70 |
output = string3.." "..count3, |
|
71 |
items = {string1.." "..count1,string2.." "..count2}, |
|
72 |
width = 2, |
|
73 |
}) |
ee5c6c
|
74 |
end |
5d799e
|
75 |
end |
R |
76 |
|
|
77 |
register_alloy_recipe ("technic:copper_dust",3, "technic:tin_dust",1, "technic:bronze_dust",4) |
2d168e
|
78 |
register_alloy_recipe ("default:copper_ingot",3, "moreores:tin_ingot",1, "default:bronze_ingot",4) |
5d799e
|
79 |
register_alloy_recipe ("technic:iron_dust",3, "technic:chromium_dust",1, "technic:stainless_steel_dust",4) |
R |
80 |
register_alloy_recipe ("default:steel_ingot",3, "technic:chromium_ingot",1, "technic:stainless_steel_ingot",4) |
|
81 |
register_alloy_recipe ("technic:copper_dust",2, "technic:zinc_dust",1, "technic:brass_dust",3) |
2d168e
|
82 |
register_alloy_recipe ("default:copper_ingot",2, "technic:zinc_ingot",1, "technic:brass_ingot",3) |
5d799e
|
83 |
register_alloy_recipe ("default:sand",2, "technic:coal_dust",2, "technic:silicon_wafer",1) |
8e03d7
|
84 |
register_alloy_recipe ("technic:silicon_wafer",1, "technic:gold_dust",1, "technic:doped_silicon_wafer",1) |
19c9a0
|
85 |
|