@@ -127,8 +127,51 @@ } end end; }; + vessel = { + compat = 'vessels'; + finagle = { type = 'vessel'; charge = 3; hold = 'liquid' }; + predicate = function(name) + local item = minetest.registered_items[name] + if item and item._sorcery and item._sorcery.container then + local ct = item._sorcery.container + if ct.type == 'vessel' then return sorcery.lib.tbl.merge({ + charge = 3; + }, ct) end + end + end; + }; + box = { + compat = 'boxes'; + predicate = function(name) + local item = minetest.registered_items[name] + if item._sorcery and item._sorcery.container then + local ct = item._sorcery.container + if ct.type == 'box' then return sorcery.lib.tbl.proto(ct, { + charge = 8; + }) end + end + end; + }; + bucket = { + compat = 'buckets'; + finagle = { type = 'bucket', hold = 'liquid', charge = 3 * 3, empty = 'bucket:bucket_empty'}; + + predicate = function(name) + local item = minetest.registered_items[name] + if item._sorcery and item._sorcery.container then + local ct = item._sorcery.container + if ct.type == 'bucket' then return sorcery.lib.tbl.proto(ct, { + charge = 3 * 3; + }) end + end + end; + }; + container = { + compat = 'containers'; + subclass = {'vessel', 'box', 'bucket'} + }; }; get = function(name,class) local c = sorcery.itemclass.classes[class] local o @@ -141,9 +184,18 @@ end if c.compat then o = sorcery.data.compat[c.compat][name] - if o then return o end + if o then + if c.finagle then + if type(c.finagle) == 'function' then + return sorcery.lib.tbl.proto(c.finagle(o), o) + elseif type(o) == 'table' then + return sorcery.lib.tbl.merge(c.finagle, o) + end + end + return o + end end if c.subclass then for _,s in pairs(c.subclass) do