sorcery  Diff

Differences From Artifact [e866e2741b]:

  • File gems.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: 7479) [annotate] [blame] [check-ins using]

To Artifact [f5bc90eb64]:


52
53
54
55
56
57
58



































59
60
61
62
63

64
65
66
67
68
69
70
..
74
75
76
77
78
79
80

81
82
83
84
85
86
87
			};
		})
	end
	if not gem.foreign_amulet then
		local img = sorcery.lib.image
		local img_stone = img('sorcery_amulet.png'):multiply(sorcery.lib.color(gem.tone))
		local img_sparkle = img('sorcery_amulet_sparkle.png')



































		minetest.register_craftitem(amuletname, {
			description = sorcery.lib.str.capitalize(name) .. ' amulet';
			inventory_image = img_sparkle:blit(img_stone):render();
			wield_scale = { x = 0.6, y = 0.6, z = 0.6 };
			groups = { sorcery_amulet = 1 };

			_sorcery = {
				material = {
					gem = true, id = name, data = gem;
					value = (5 * shards_per_gem) + 4;
				};
				amulet = { base = name };
			};
................................................................................
			local framedid = string.format("%s_frame_%s", amuletname, metalid)
			local img_frame = img(string.format('sorcery_amulet_frame_%s.png',metalid))
			minetest.register_craftitem(framedid, {
				description = string.format("%s-framed %s amulet",sorcery.lib.str.capitalize(metalid), name);
				inventory_image = img_sparkle:blit(img_frame):blit(img_stone):render();
				wield_scale = { x = 0.6, y = 0.6, z = 0.6 };
				groups = { sorcery_amulet = 1 };

				_sorcery = {
					amulet = { base = name, frame = metalid };
				};
			})
			local frag = metal.parts.fragment
			minetest.register_craft {
				output = framedid;







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





>







 







>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
...
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
			};
		})
	end
	if not gem.foreign_amulet then
		local img = sorcery.lib.image
		local img_stone = img('sorcery_amulet.png'):multiply(sorcery.lib.color(gem.tone))
		local img_sparkle = img('sorcery_amulet_sparkle.png')
		local useamulet = function(stack,user,target)
			local sp = sorcery.amulet.getspell(stack)
			if not sp or not sp.cast then return nil end
			local stats = sorcery.amulet.stats(stack)

			local ctx = {
				caster = user;
				target = target;
				stats = stats;
				sound = "xdecor_enchanting"; --FIXME make own sounds
				sparkle = true;
				amulet = stack;
				meta = stack:get_meta(); -- avoid spell boilerplate
				color = sorcery.lib.color(sp.tone);
			}
			print('casting')
			local res = sp.cast(ctx)

			if res == nil or res == true then
				minetest.sound_play(ctx.sound, { 
					pos = user:get_pos();
					gain = 1;
				})
			end
			if ctx.sparkle then
				sorcery.vfx.cast_sparkle(user, ctx.color, stats.power,0.5)
			end
			if res == nil then
				if not minetest.check_player_privs(user, 'sorcery:infinirune') then
					sorcery.amulet.setrune(stack)
				end
			end

			return ctx.amulet
		end;
		minetest.register_craftitem(amuletname, {
			description = sorcery.lib.str.capitalize(name) .. ' amulet';
			inventory_image = img_sparkle:blit(img_stone):render();
			wield_scale = { x = 0.6, y = 0.6, z = 0.6 };
			groups = { sorcery_amulet = 1 };
			on_use = useamulet;
			_sorcery = {
				material = {
					gem = true, id = name, data = gem;
					value = (5 * shards_per_gem) + 4;
				};
				amulet = { base = name };
			};
................................................................................
			local framedid = string.format("%s_frame_%s", amuletname, metalid)
			local img_frame = img(string.format('sorcery_amulet_frame_%s.png',metalid))
			minetest.register_craftitem(framedid, {
				description = string.format("%s-framed %s amulet",sorcery.lib.str.capitalize(metalid), name);
				inventory_image = img_sparkle:blit(img_frame):blit(img_stone):render();
				wield_scale = { x = 0.6, y = 0.6, z = 0.6 };
				groups = { sorcery_amulet = 1 };
				on_use = useamulet;
				_sorcery = {
					amulet = { base = name, frame = metalid };
				};
			})
			local frag = metal.parts.fragment
			minetest.register_craft {
				output = framedid;