sorcery  Diff

Differences From Artifact [ba9d479786]:

  • File itemclass.lua — part of check-in [96c5289a2a] at 2020-10-21 03:35:35 on branch trunk — add rune forges, runes, amulet frames, write sacrifice spell, touch up amulet graphics, enable enchantment of amulets (though spells cannot yet be cast), defuckulate syncresis core icon, unfuckitize sneaky leycalc bug that's probably been the cause of some long-standing wackiness, add item classes, add some more textures, disbungle various other asstastrophes, remove sneaky old debug code, improve library code, add utility for uploading merge requests (user: lexi, size: 5018) [annotate] [blame] [check-ins using]

To Artifact [6e17face1d]:


   124    124   					return {
   125    125   						burntime = c.time;
   126    126   						leftover = di and di[1];
   127    127   					}
   128    128   				end
   129    129   			end;
   130    130   		};
          131  +		vessel = {
          132  +			compat = 'vessels';
          133  +			finagle = { type = 'vessel'; charge = 3; hold = 'liquid' };
          134  +			predicate = function(name)
          135  +				local item = minetest.registered_items[name]
          136  +				if item and item._sorcery and item._sorcery.container then
          137  +					local ct = item._sorcery.container
          138  +					if ct.type == 'vessel' then return sorcery.lib.tbl.merge({
          139  +						charge = 3;
          140  +					}, ct) end
          141  +				end
          142  +			end;
          143  +		};
          144  +		box = {
          145  +			compat = 'boxes';
          146  +			predicate = function(name)
          147  +				local item = minetest.registered_items[name]
          148  +				if item._sorcery and item._sorcery.container then
          149  +					local ct = item._sorcery.container
          150  +					if ct.type == 'box' then return sorcery.lib.tbl.proto(ct, {
          151  +						charge = 8;
          152  +					}) end
          153  +				end
          154  +			end;
          155  +		};
          156  +		bucket = {
          157  +			compat = 'buckets';
          158  +			finagle = { type = 'bucket', hold = 'liquid', charge = 3 * 3, empty = 'bucket:bucket_empty'};
          159  +
          160  +			predicate = function(name)
          161  +				local item = minetest.registered_items[name]
          162  +				if item._sorcery and item._sorcery.container then
          163  +					local ct = item._sorcery.container
          164  +					if ct.type == 'bucket' then return sorcery.lib.tbl.proto(ct, {
          165  +						charge = 3 * 3;
          166  +					}) end
          167  +				end
          168  +			end;
          169  +		};
          170  +		container = {
          171  +			compat = 'containers';
          172  +			subclass = {'vessel', 'box', 'bucket'}
          173  +		};
   131    174   	};
   132    175   	get = function(name,class)
   133    176   		local c = sorcery.itemclass.classes[class]
   134    177   		local o
   135    178   		if not c then return false end
   136    179   		if type(name) ~= 'string' then name = name:get_name() end
   137    180   
................................................................................
   138    181   		if c.predicate then 
   139    182   			o = c.predicate(name)
   140    183   			if o then return o end
   141    184   		end
   142    185   
   143    186   		if c.compat then
   144    187   			o = sorcery.data.compat[c.compat][name]
   145         -			if o then return o end
          188  +			if o then
          189  +				if c.finagle then
          190  +					if type(c.finagle) == 'function' then
          191  +						return sorcery.lib.tbl.proto(c.finagle(o), o)
          192  +					elseif type(o) == 'table' then
          193  +						return sorcery.lib.tbl.merge(c.finagle, o)
          194  +					end
          195  +				end
          196  +				return o
          197  +			end
   146    198   		end
   147    199   
   148    200   		if c.subclass then
   149    201   			for _,s in pairs(c.subclass) do
   150    202   				o = sorcery.itemclass.get(name,s)
   151    203   				if o then
   152    204   					if c.conform and c.conform[s] then