204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
...
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
local inv = meta:get_inventory()
local infusion = inv:get_list('infusion')
local potions = inv:get_list('potions')
local elixir = infusion[1]:get_definition()
local probe = sorcery.spell.probe(pos)
local fx = infuser_mods(pos)
if probe.disjunction then return true end
local potionct = 0
do
local ingredient -- *eyeroll*
if infusion[1]:is_empty() then goto cancel end
ingredient = infusion[1]:get_name()
for i = 1,#potions do
if potions[i]:is_empty() then goto skip end
potionct = potionct + 1
local base = potions[i]:get_name()
local potion = potions[i]:get_definition()
if elixir_can_apply(elixir._proto,potion) then
-- at least one combination makes a valid potion;
-- we can start the infuser
goto start
end
for _,v in pairs(sorcery.register.infusions.db) do
if v.infuse == ingredient and v.into == base then
-- at least one combination makes a valid
-- potion; we can start the infuser
goto start
end
end
::skip:: end
::cancel:: do
infuser_stop(pos)
return false
end
::start::
end
................................................................................
type = "vertical_frames";
aspect_h = 16;
aspect_w = 16;
length = 4.1;
};
}
end
-- for i=0,4 do
spawn('sorcery_spark.png^[multiply:#FF8FDD', 1, 32 * 4)
-- end
-- for i=0,4 do
spawn('sorcery_spark.png^[multiply:#FFB1F6', 0.5, 64 * 4)
-- end
local discharge = sorcery.lib.node.discharger(pos)
if newtime >= infusion_time then
-- finished
local ingredient = infusion[1]:get_name()
local result, residue = sorcery.alchemy.infuse(infusion[1], potions)
for i, r in pairs(result) do
|
>
>
|
>
>
>
|
>
>
>
|
|
|
|
|
|
>
>
|
|
|
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
...
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
local inv = meta:get_inventory()
local infusion = inv:get_list('infusion')
local potions = inv:get_list('potions')
local elixir = infusion[1]:get_definition()
local probe = sorcery.spell.probe(pos)
local fx = infuser_mods(pos)
local sparkle_color = {sorcery.lib.color(255, 0, 145)};
if probe.disjunction then return true end
local potionct = 0
local cancel = true
do
local ingredient -- *eyeroll*
if infusion[1]:is_empty() then goto cancel end
ingredient = infusion[1]:get_name()
for i = 1,#potions do
if potions[i]:is_empty() then goto skip end
potionct = potionct + 1
local base = potions[i]:get_name()
local potion = potions[i]:get_definition()
if elixir_can_apply(elixir._proto,potion) then
-- at least one combination makes a valid potion;
-- we can start the infuser
if elixir._proto.color then
sparkle_color[#sparkle_color+1] = sorcery.lib.color(elixir._proto.color)
end
cancel = false
end
for _,v in pairs(sorcery.register.infusions.db) do
if v.infuse == ingredient and v.into == base then
-- at least one combination makes a valid
-- potion; we can start the infuser
if v.output.data and v.output.data.color then
sparkle_color[#sparkle_color+1] = sorcery.lib.color(v.output.data.color)
end
cancel = false
end
end
::skip:: end
::cancel:: if cancel then
infuser_stop(pos)
return false
end
::start::
end
................................................................................
type = "vertical_frames";
aspect_h = 16;
aspect_w = 16;
length = 4.1;
};
}
end
local spark = sorcery.lib.image('sorcery_spark.png')
for i = 1,4 do
local fac = 1 / i
local _, spc = sorcery.lib.tbl.pick(sparkle_color)
local sp = spark:glow(spc)
spawn(sp:render(), fac, (32/fac) * 4)
end
local discharge = sorcery.lib.node.discharger(pos)
if newtime >= infusion_time then
-- finished
local ingredient = infusion[1]:get_name()
local result, residue = sorcery.alchemy.infuse(infusion[1], potions)
for i, r in pairs(result) do
|