-
Notifications
You must be signed in to change notification settings - Fork 1
/
overrides.lua
198 lines (161 loc) · 6.38 KB
/
overrides.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
--Adding groups
core.override_item("technic:battery", {
groups = {battery = 1},
})
core.override_item("technic:coal_dust", {
groups = {dust_coal = 1},
})
core.override_item("technic:cast_iron_ingot", {
groups = {iron_ingot = 1},
})
core.override_item("elepower_dynamics:iron_ingot", {
groups = {iron = 1, ingot = 1, iron_ingot = 1},
})
core.override_item("technic:lead_dust", {
groups = {dust_lead = 1},
})
core.override_item("technic:lead_ingot", {
groups = {lead_ingot = 1},
})
core.override_item("elepower_dynamics:lead_ingot", {
groups = {lead = 1, ingot = 1, lead_ingot = 1},
})
core.override_item("technic:sawdust", {
groups = {sawdust = 1},
})
core.override_item("elepower_dynamics:wood_dust", {
groups = {dust_wood = 1, dust = 1, sawdust = 1},
})
core.override_item("technic:sulfur_lump", {
groups = {sulfur = 1},
})
core.override_item("technic:sulfur_dust", {
groups = {sulfur = 1},
})
core.override_item("technic:zinc_dust", {
groups = {dust_zinc = 1},
})
core.override_item("technic:zinc_ingot", {
groups = {zinc_ingot = 1},
})
core.override_item("elepower_dynamics:zinc_ingot", {
groups = {zinc = 1, ingot = 1, zinc_ingot = 1},
})
--Batteries
core.clear_craft({
output = "elepower_dynamics:battery",
})
core.clear_craft({
output = "technic:battery",
})
--Coal dust
core.clear_craft({
type = "fuel",
recipe = "technic:coal_dust",
burntime = 50,
})
--iron lump
core.clear_craft({
type = "cooking",
recipe = "default:iron_lump",
})
--Lead strip
core.clear_craft({
output = "basic_materials:lead_strip",
})
--Sawdust
core.clear_craft({
type = "fuel",
recipe = "technic:sawdust",
burntime = 6
})
--Wound coils
core.clear_craft({
output = "elepower_dynamics:wound_copper_coil",
})
core.clear_craft({
output = "elepower_dynamics:wound_silver_coil",
})
--[[Override function to clear the recipes for technic machines
(It may only work for the first recipe with that input name that
it finds, so we may need to add a better function that removes all the inputs instead.)]]
function clear_technic_recipe(recipe_type, recipe_input_name)
core.after(0.1, function() --This has to be called with a delay for the table to load in.
technic.recipes[recipe_type]["recipes"][recipe_input_name] = nil
end)
end
--[[This function accepts two parameters, the recipe type and
the name of the input of the recipe you want to clear
available recipe types:
"grinding"
"alloy"
"extracting"
"freezing"
"separating" This one is for the centrifuge.
"compressing"
"cooking" This one is for the cooking recipes for the electric furnace but you should just be able to use the core.clear_craft to do it too.
The secound parameter is the name of the recipe you want to override. This is the item name of the item you
put into the machine i.e "default:silver_sandstone" which will clear the recipe that uses the silver sandstone as an input.
Example:
clear_technic_recipe("grinding", "defualt:silver_sandstone")
This will clear the grinding recipe that uses the "defualt:silver_sandstone" item as an input.
For alloy recipes this is different as you need to have the names of the inputs like this:
clear_technic_recipe("alloy", "input1/input2")
Example:
clear_technic_recipe("alloy", "technic:coal_dust/technic:raw_latex")
This will clear the alloy recipe with the inputs of technic:coal_dust and technic:raw_latex
]]
--[[New function that does what the above one does but for all inputs in the
given table name and not just the first one it finds.]]
--TO DO:This function needs to be tested.
function clear_technic_recipe_all_inputs(recipe_type, recipe_input_name)
core.after(0.1, function()
local recipe_table = technic.recipes[recipe_type]["recipes"]
for key, recipe in pairs(recipe_table) do
if recipe.input == recipe_input_name then
recipe_table[key] = nil
end
end
end)
end
--Ovverrides elepower machine recipes
function clear_elepower_recipe(craft_type, output_to_remove)
core.after(0.5, function() --TO DO:Find out if this function will still work if we set it to run at 0.1 instead of 0.5 to prevent unwanted recipes from being used when a player first joins a world.
local craft_table = elepm.craft[craft_type]
local output_to_remove_itemstack = ItemStack(output_to_remove)
for i = #craft_table, 1, -1 do
-- Check if the output of the recipe at index i matches with output_to_remove
local output_itemstack = ItemStack(craft_table[i].output)
if output_itemstack:get_name() == output_to_remove_itemstack:get_name() and output_itemstack:get_count() == output_to_remove_itemstack:get_count() then
-- Remove the recipe from the table
table.remove(craft_table, i)
end
end
end)
end
--[[
This function accepts two parameters, the recipe type and the output of the recipe you want to clear.
Recipe types:
"compress"
"grind" The grinding recipe for the depleted fuel rod will not work with this function because it has multiple outputs.
"cooking" This one is for the cooking recipes for the electric furnace, but you should just be able to use the core.clear_craft to do it too.
"can"
"solder"
"alloy"
The secound parameter is the output of the recipe that you want to use i.e
Example:
clear_elepower_recipe("compress", "elepower_dynamics:zinc_plate 2")
This example function goes into the table compress and gets the first thing in the table with an index number of 1 and checks if it has
the specified output. If it does, it removes the item with that index number. If not, then it goes to the next item in the list and checks again.
This function doesn't clear recipes with multiple outputs because it only tests for one output.
]]
clear_elepower_recipe("compress", "default:desert_sandstone")
clear_elepower_recipe("grind", "default:desert_sand 4")
clear_elepower_recipe("grind", "default:gravel 4")
clear_elepower_recipe("compress", "default:sandstone")
clear_elepower_recipe("grind", "default:sand 4")
clear_elepower_recipe("compress", "default:silver_sandstone")
clear_elepower_recipe("grind", "default:silver_sand 4")
if core.get_modpath("technic_recipes") then
clear_elepower_recipe("grind", "farming:flour 2")
end