Index: enchanter.lua ================================================================== --- enchanter.lua +++ enchanter.lua @@ -173,11 +173,13 @@ -- determine the power of a particular enchantment on -- an enchanted item. local e = sorcery.enchant.get(stack) local p = 0.0 local ct = 0 - local slots = sorcery.matreg.lookup[stack:get_name()].data.slots + local slots = sorcery.matreg.lookup[stack:get_name()] + if not (slots and slots.data and slots.data.slots) then return p, ct end + slots = slots.data.slots -- TODO handle strength-boosting spells! for _,s in pairs(e.spells) do if s.id == id then p = p + ((s.boost * slots[s.slot].confluence)/10) ct = ct + 1 Index: lathe.lua ================================================================== --- lathe.lua +++ lathe.lua @@ -1,5 +1,7 @@ +-- the math basically needs to be rewritten from scratch by someone who isn't +-- dyscalculic but sorcery.lathe = { techs = { cut = {dmg = true}; intaglio = {consume = true}; }; @@ -39,11 +41,11 @@ local ntimes = math.floor(howmany / (rec.mass or 1)) return { tool = tool, wkpc = wkpc; cost = rec.cost * ntimes; ntimes = ntimes; - tqty = math.floor(howmany / outn), outn = outn; + tqty = math.floor(howmany / outn) * (rec.mass or 1), outn = outn; gqty = ntimes * outn; tech = tech; rec = rec; inv = inv; } Index: liquid.lua ================================================================== --- liquid.lua +++ liquid.lua @@ -107,13 +107,15 @@ if liq then top = top:blit( L.image('sorcery_node_liquid.png'):multiply(L.color(liq.color)) ) else top=top:blit( L.image('sorcery_trough_bottom.png') ) end - local ttlc = function(liq,i) return - liq and string.format('%s Trough', L.str.capitalize(liq.name)), - liq and string.format('%s of %s', liq.measure(i * Q), liq.name) + local ttlc = function(liq,i) + if type(liq) == 'string' then liq = sorcery.register.liquid.db[liq] end + return + liq and string.format('%s Trough', L.str.capitalize(liq.name)), + liq and string.format('%s of %s', liq.measure(i * Q), liq.name) end local trough_title, trough_content = ttlc(liq,i) local function trough_caption(pos,i,l) local trough_title, trough_content = ttlc(l or liq,i) minetest.get_meta(pos):set_string('infotext', i > 0 and string.format( @@ -170,27 +172,46 @@ has = liq and liq.id; charge = liq and Q * i; empty = 'sorcery:trough'; max = constants.bottles_per_trough * Q; set_node_vol = liq and function(pos, vol) + log.act('putting', vol, liq, 'in trough at', pos) vol = math.min(M, math.max(0, math.floor(vol / Q))) minetest.swap_node(pos, {name = lid(vol)}) trough_caption(pos, vol) + return vol * Q end; set_node_liq = function(pos, liq, vol) - log.act('adding', vol, 'to trough at', liq) + log.act('putting', vol, liq, 'in trough at', pos) vol = vol or Q * i local idx = math.min(M, math.floor(vol/Q)) minetest.swap_node(pos, {name = trough_mkid(liq, idx)}) trough_caption(pos, idx, liq) + return idx * Q end } }; }) end end sorcery.liquid.mktrough() + +sorcery.liquid.setctr = function(pos, liq, vol, sameliq) + local n = sorcery.lib.node.force(pos) + if minetest.get_item_group(n.name, 'sorcery_container') ~= 2 then return false end + local def = minetest.registered_items[n.name]._sorcery + if not (def and def.container and def.container.set_node_liq) then + log.err('node',n.name,'marked as liquid container but is missing container.set_node_liq callback') + return false + end + if sameliq then + if def.container.has ~= nil and def.container.has ~= liq then + return false + end + end + return def.container.set_node_liq(pos, liq, vol) +end sorcery.liquid.measure_default = sorcery.liquid.units.dram sorcery.liquid.container = function(liq, ctr) return liq.containers[({ Index: recipes.lua ================================================================== --- recipes.lua +++ recipes.lua @@ -161,15 +161,24 @@ } minetest.register_craft { output = 'sorcery:tuning_disc'; recipe = { - {'sorcery:inverter_coil',ingot('silver'),''}; - {'sorcery:leyline_stabilizer','sorcery:silver_ingot','sorcery:gem_emerald'}; - {'sorcery:inverter_coil',ingot('silver'),''}; + {'','sorcery:gem_emerald',''}; + {'',mtlp('silver','disc'),''}; + {'sorcery:inverter_coil','sorcery:warding_plate','sorcery:inverter_coil'}; }; } + +print(dump{ + output = 'sorcery:tuning_disc'; + recipe = { + {'','sorcery_gem:emerald',''}; + {'',mtlp('silver','disc'),''}; + {'sorcery:inverter_coil','sorcery:warding_plate','sorcery:inverter_coil'}; + }; +}) minetest.register_craft { output = 'sorcery:farcaster'; recipe = { {ingot('gold'),ingot('iridium'),ingot('gold')}; @@ -439,11 +448,11 @@ {'basic_materials:silver_wire', 'basic_materials:empty_spool'}; {'basic_materials:silver_wire', 'basic_materials:empty_spool'}; }) regtech('conduction_plate', 'Conduction Plate', {metal = 1}, { - {'','default:copper_ingot',''}; + {'','sorcery:disc_copper',''}; {'','stairs:slab_stone',''}; {'basic_materials:copper_wire','basic_materials:steel_bar','basic_materials:copper_wire'}; }, 1, { {'basic_materials:copper_wire', 'basic_materials:empty_spool'}; {'basic_materials:copper_wire', 'basic_materials:empty_spool'}; Index: textures/sorcery_disc.png ================================================================== --- textures/sorcery_disc.png +++ textures/sorcery_disc.png cannot compute difference between binary files Index: tools.lua ================================================================== --- tools.lua +++ tools.lua @@ -17,11 +17,11 @@ return function(stack,user,pointat) if (not minetest.is_player(pointat)) and selfharm == false then return nil end - local trough = minetest.find_node_near(user:get_position(), 2.5, 'group:sorcery_trough', true) + local trough = minetest.find_node_near(user:get_pos(), 2.5, 'group:sorcery_trough', true) if trough then local cnn = minetest.get_node(trough).name local ctr = minetest.registered_nodes[cnn]._sorcery if (not ctr) or not ctr.container then log.err('item',cnn,'is marked as a trough, but has no _sorcery.container table') @@ -75,13 +75,11 @@ if not trough then inv:remove_item('main',btl) inv:add_item('main',blood) else local amt = selfharm and math.random(1,2) or 2 - minetest.set_node(trough.pos, { - name = trough.def.make(def.res*amt+ctr.charge,1):get_name() - }) + sorcery.liquid.setctr(trough.pos, 'sorcery:blood', (trough.ctr.charge or 0) + (trough.def.res*amt), true) end target:punch(user, 1.0, caps, nil) sorcery.vfx.bloodburst(pos) @@ -102,11 +100,12 @@ end minetest.register_tool("sorcery:dagger_consecrated", { description = "Consecrated Dagger", - inventory_image = "sorcery_dagger_consecrated.png", + inventory_image = "sorcery_dagger_consecrated.png^sorcery_dagger_glow.png", + wield_image = "sorcery_dagger_consecrated.png", tool_capabilities = { full_punch_interval = 1.6, max_drop_level = 1, damage_groups = { fleshy = 6 }, },