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
125
126
127
128
129
130











































131
132
133
134
135
136
137
...
138
139
140
141
142
143
144
145









146
147
148
149
150
151
152
					return {
						burntime = c.time;
						leftover = di and di[1];
					}
				end
			end;
		};











































	};
	get = function(name,class)
		local c = sorcery.itemclass.classes[class]
		local o
		if not c then return false end
		if type(name) ~= 'string' then name = name:get_name() end

................................................................................
		if c.predicate then 
			o = c.predicate(name)
			if o then return o end
		end

		if c.compat then
			o = sorcery.data.compat[c.compat][name]
			if o then return o end









		end

		if c.subclass then
			for _,s in pairs(c.subclass) do
				o = sorcery.itemclass.get(name,s)
				if o then
					if c.conform and c.conform[s] then







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
>
>
>
>
>
>
>
>
>







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
...
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
					return {
						burntime = c.time;
						leftover = di and di[1];
					}
				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
		if not c then return false end
		if type(name) ~= 'string' then name = name:get_name() end

................................................................................
		if c.predicate then 
			o = c.predicate(name)
			if o then return o end
		end

		if c.compat then
			o = sorcery.data.compat[c.compat][name]
			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
				o = sorcery.itemclass.get(name,s)
				if o then
					if c.conform and c.conform[s] then