Differences From
Artifact [a94be8d51a]:
19 19 -- factor by which wear is increased when grinding
20 20 -- above your paygrade
21 21
22 22 grind_factor = 10;
23 23 -- adjusts the amount of time it takes to grind
24 24 -- metal into powder
25 25
26 - grind_wear = 2000;
26 + grind_wear = 1000;
27 27 -- amount of damage done to a grind head grinding
28 28 -- metal of equal hardness. increased or decreased
29 29 -- depending on differential
30 30
31 31 grind_torque_factor = 0.1;
32 32 -- how many points of hardness translate into how
33 33 -- much ley-current needed (per second)
................................................................................
232 232 local grind_wear = {}
233 233 local grinders_present = false
234 234 grinders_on = {false,false}
235 235 for i=1,inv:get_size('grinder') do
236 236 local gh = inv:get_stack('grinder',i)
237 237 if not gh:is_empty() then
238 238 grinders_present = true
239 - local hh = sorcery.data.metals[gh:get_definition()._proto.metal].hardness
239 + local gproto = gh:get_definition()._proto
240 + local hh = 0
241 + if gproto.metal then
242 + hh = sorcery.data.metals[gproto.metal].hardness
243 + elseif gproto.gem then
244 + hh = sorcery.data.gems[gproto.gem].hardness
245 + end
240 246 local dif = mp.hardness - hh
241 247 local wear
242 248 if dif == 0 then
243 249 wear = constants.grind_wear
244 250 elseif dif < 0 then
245 251 wear = constants.grind_wear * ((dif * -1)/constants.grind_range)
246 252 elseif dif > 0 then
................................................................................
330 336 recipe = {
331 337 {'basic_materials:chain_steel','basic_materials:gear_steel','basic_materials:chain_steel'};
332 338 {'basic_materials:gear_steel', 'basic_materials:steel_bar', 'basic_materials:gear_steel'};
333 339 {'default:tin_ingot','default:steelblock','default:tin_ingot'};
334 340 };
335 341 }
336 342 for name,metal in pairs(sorcery.data.metals) do
343 + if metal.no_tools and not metal.grindhead then goto skip end
337 344 local i,f = metal.parts.ingot, metal.parts.fragment
338 345 local id = 'sorcery:mill_grindhead_' .. name
339 346 minetest.register_tool(id,{
340 347 description = sorcery.lib.str.capitalize(name) .. ' Grinding Head';
341 348 inventory_image = sorcery.lib.image('sorcery_mill_grindhead.png'):multiply(sorcery.lib.color(metal.tone)):render();
342 349 groups = { sorcery_mill_grindhead = 1, sorcery_metallurgy = 1 };
343 350 _proto = {
................................................................................
348 355 output = id;
349 356 recipe = {
350 357 {f,i,f};
351 358 {i,'',i};
352 359 {f,i,f};
353 360 };
354 361 }
355 -end
362 +::skip::end
363 +
364 +for name,gem in pairs(sorcery.data.gems) do
365 + if not gem.tools and not gem.grindhead then goto skip end
366 + local i,f = gem.parts.item, gem.parts.shard
367 + local id = 'sorcery:mill_grindhead_' .. name
368 + minetest.register_tool(id,{
369 + description = sorcery.lib.str.capitalize(name) .. ' Grinding Head';
370 + inventory_image = sorcery.lib.image('sorcery_mill_grindhead.png'):multiply(sorcery.lib.color(gem.tone)):render();
371 + groups = { sorcery_mill_grindhead = 1, sorcery_metallurgy = 1 };
372 + _proto = {
373 + gem = name;
374 + };
375 + });
376 + minetest.register_craft {
377 + output = id;
378 + recipe = {
379 + {f,i,f};
380 + {i,'',i};
381 + {f,i,f};
382 + };
383 + }
384 +::skip::end