sorcery  Diff

Differences From Artifact [8e18232927]:

To Artifact [378fef1f36]:

  • File gems.lua — part of check-in [3f6a913e4e] at 2020-09-29 12:40:28 on branch trunk — * remove former hacky registration system, replace with consistent and flexible API; rewrite metal/gem generation to take advantage of this new API; tweaks to init system to enable world-local tweaks to lore and sorcery behavior * initial documentation commit * initial steps towards calendar - add default date format, astrolabe; prepare infra for division/melding/transmutation spells, various tweaks and fixes (user: lexi, size: 6366) [annotate] [blame] [check-ins using]

1
2
3
4
5
6
7
8
9
10
11
..
36
37
38
39
40
41
42








43
44
45
46
47
48
49
...
194
195
196
197
198
199
200
201

202
203
204
205
206
207
208
--- gemstones
local shards_per_gem = 9

sorcery.register_gem = function(name,gem)
	local itemname = gem.foreign or 'sorcery:gem_' .. name
	local shardname = gem.foreign_shard or 'sorcery:gem_' .. name .. '_shard'
	local amuletname = gem.foreign_amulet or 'sorcery:gem_' .. name .. '_amulet'

	sorcery.data.gems[name].parts = {
		item = itemname;
		shard = shardname;
................................................................................
			inventory_image = 'sorcery_gem_' .. name .. '_shard.png';
			groups = { gemshard = 1; crystalshard = 1; sorcery_shard = 1; };
			_sorcery = {
				material = {
					gem = true;
					id = name, data = gem;
					raw = true, value = 1;








				};
			};
		})
	end
	if not gem.foreign_amulet then
		minetest.register_craftitem(amuletname, {
			description = sorcery.lib.str.capitalize(name) .. ' amulet';
................................................................................
		minetest.override_item(ore, {drop = newdrops})
		-- might be possible to just edit it in place, since we're
		-- referring to registered_nodes anyway, but i don't want
		-- to chance it; god knows what's going on under the hood
	end
end

for g,v in pairs(sorcery.data.gems) do sorcery.register_gem(g,v) end


sorcery.gem = {
	getdrops = function(fac)
		items = {}
		for g,v in pairs(sorcery.data.gems) do
			items[#items + 1] = {
				rarity = gem.rarity * fac;



|







 







>
>
>
>
>
>
>
>







 







|
>







1
2
3
4
5
6
7
8
9
10
11
..
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
...
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
--- gemstones
local shards_per_gem = 9

local register_gem = function(name,gem)
	local itemname = gem.foreign or 'sorcery:gem_' .. name
	local shardname = gem.foreign_shard or 'sorcery:gem_' .. name .. '_shard'
	local amuletname = gem.foreign_amulet or 'sorcery:gem_' .. name .. '_amulet'

	sorcery.data.gems[name].parts = {
		item = itemname;
		shard = shardname;
................................................................................
			inventory_image = 'sorcery_gem_' .. name .. '_shard.png';
			groups = { gemshard = 1; crystalshard = 1; sorcery_shard = 1; };
			_sorcery = {
				material = {
					gem = true;
					id = name, data = gem;
					raw = true, value = 1;
				};
				recipe = {
					canonical = {
						craft = {
							{'','xdecor:hammer',''};
							{'',itemname,''};
						};
					}
				};
			};
		})
	end
	if not gem.foreign_amulet then
		minetest.register_craftitem(amuletname, {
			description = sorcery.lib.str.capitalize(name) .. ' amulet';
................................................................................
		minetest.override_item(ore, {drop = newdrops})
		-- might be possible to just edit it in place, since we're
		-- referring to registered_nodes anyway, but i don't want
		-- to chance it; god knows what's going on under the hood
	end
end

-- for g,v in pairs(sorcery.data.gems) do sorcery.register_gem(g,v) end
sorcery.register.gems.foreach('sorcery:generate',{},register_gem)

sorcery.gem = {
	getdrops = function(fac)
		items = {}
		for g,v in pairs(sorcery.data.gems) do
			items[#items + 1] = {
				rarity = gem.rarity * fac;