| 
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
..
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
..
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
 | 
			-- implement this logic themselves (for instance to check a range)
			if (probe.disjunction and not sp.ignore_disjunction) then return nil end
			local ctx = {
				caster = user;
				target = target;
				stats = stats;
				amulet = stack;
				meta = stack:get_meta(); -- avoid spell boilerplate
				color = sorcery.lib.color(sp.tone);
				today = minetest.get_day_count();
				probe = probe;
				heading = {
					pos   = user:get_pos();
					yaw   = user:get_look_dir();
................................................................................
					angle = user:get_look_horizontal();
					eyeheight = user:get_properties().eye_height;
				};
				sound = "xdecor_enchanting"; --FIXME make own sounds
				sparkle = true;
			}
			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 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;
 |  | 
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
..
82
83
84
85
86
87
88
89
90
91
92
93
94
95
..
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
 | 
			-- implement this logic themselves (for instance to check a range)
			if (probe.disjunction and not sp.ignore_disjunction) then return nil end
			local ctx = {
				caster = user;
				target = target;
				stats = stats;
				wield = stack;
				amulet = stack:get_definition()._sorcery.amulet;
				meta = stack:get_meta(); -- avoid spell boilerplate
				color = sorcery.lib.color(sp.tone);
				today = minetest.get_day_count();
				probe = probe;
				heading = {
					pos   = user:get_pos();
					yaw   = user:get_look_dir();
................................................................................
					angle = user:get_look_horizontal();
					eyeheight = user:get_properties().eye_height;
				};
				sound = "xdecor_enchanting"; --FIXME make own sounds
				sparkle = true;
			}
			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 res == nil then
				if not minetest.check_player_privs(user, 'sorcery:infinirune') then
					sorcery.amulet.setrune(stack)
				end
			end
			return ctx.wield
		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;
 |