Index: keg.lua ================================================================== --- keg.lua +++ keg.lua @@ -13,15 +13,13 @@ local measure = liq.measure or function(u) return string.format('%s drams', u*63.9) end return { - title = string.format('Keg of %s', liq.name); + title = string.format('%s Keg', sorcery.lib.str.capitalize(liq.name)); color = sorcery.lib.color(liq.color); - props = { - {title = 'Contains', desc = measure(m:get_int('charge'))}; - } + desc = string.format('%s of %s', measure(m:get_int('charge')), liq.name); }; else return { title = 'Empty Keg', props = {} } end end local log = sorcery.logger('keg') minetest.register_node('sorcery:keg', { @@ -67,13 +65,14 @@ on_rightclick = function(pos, node, user, stack) local m = minetest.get_meta(pos) local update = function() local c = kegcaption(m) local str = c.title - for _,p in pairs(c.props) do + if c.desc then str = str .. '\n(' .. c.desc .. ')' end + if c.props then for _,p in pairs(c.props) do -- future-proofing str = str .. string.format('\n(%s: %s)', p.title, p.desc) - end + end end m:set_string('infotext', str) end local noise = function(amt) minetest.sound_play('default_water_footstep', { gain = 0.5 + amt / 9.0; @@ -191,5 +190,17 @@ end end end; }) + +minetest.register_craft { + output = "sorcery:keg"; + recipe = { + {'', 'basic_materials:steel_bar', 'screwdriver:screwdriver'}; + {'sorcery:screw_bronze', 'default:bronze_ingot', 'sorcery:screw_bronze'}; + {'', 'xdecor:barrel', ''}; + }; + replacements = { + {'screwdriver:screwdriver', 'screwdriver:screwdriver'}; + }; +} Index: liquid.lua ================================================================== --- liquid.lua +++ liquid.lua @@ -1,15 +1,16 @@ -- liquid.lua -- the liquid registry is used to keep track of abstract liquids, -- their properties, and their representation in-game. sorcery.registry.mk('liquid', false) +sorcery.liquid = {} --- pre-register liquids used in Sorcery and common ones sorcery depends on +-- pre-register basic liquids used in Sorcery and common ones sorcery depends on sorcery.register.liquid.link('default:water', { - name = 'Water'; + name = 'water'; kind = 'default:drink'; color = {10,85,255}; proto = nil; src = 'default:water_source'; containers = { @@ -17,11 +18,11 @@ ['bucket:bucket_empty'] = 'bucket:bucket_water'; }; }) sorcery.register.liquid.link('farming:ethanol', { - name = 'Ethanol'; + name = 'ethanol'; kind = 'default:fuel'; color = {175,185,130}; proto = nil; measure = function(u) return string.format('%s pints', u * 5) end; containers = { @@ -28,14 +29,14 @@ ['vessels:glass_bottle'] = 'farming:ethanol_bottle'; }; }) sorcery.register.liquid.link('sorcery:blood', { - name = 'Blood'; + name = 'blood'; kind = 'sorcery:reagent'; color = {255,10,30}; proto = nil; measure = function(u) return string.format('%s cc', u * 236.5) end; containers = { ['vessels:glass_bottle'] = 'sorcery:blood'; }; }) Index: potions.lua ================================================================== --- potions.lua +++ potions.lua @@ -115,15 +115,34 @@ local desc = 'A ' .. ((glow and 'glowing ') or '') .. 'bottle of ' .. string.lower(n) .. ((kind == 'sparkle' and ', fiercely bubbling') or '') .. ' liquid' local fullname = n .. ' Potion' + sorcery.register.liquid.link('sorcery:'..id, { + name = 'Serene Potion'; + color = v.color; + proto = v; + kind = 'sorcery:potion'; + measure = function(amt) return string.format('%s draughts', amt / 3) end; + containers = { + ['vessels:glass_bottle'] = 'sorcery:' .. id; + }; + }) sorcery.register_potion(id, fullname, desc, color, kind, glow, { - _proto = v; groups = { sorcery_potion = 1; sorcery_magical = 1; + }; + _proto = v; + _sorcery = { + container = { + type = 'vessel'; + hold = 'liquid'; + has = 'sorcery:' .. id; + empty = 'vessels:glass_bottle'; + charge = 3; + }; }; }) create_infusion_recipe(id,v,'sorcery:potion_serene',{data=v,name=fullname}) end)