56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
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;
amulet = stack;
meta = stack:get_meta(); -- avoid spell boilerplate
color = sorcery.lib.color(sp.tone);
today = minetest.get_day_count();
heading = {
pos = user:get_pos();
yaw = user:get_look_dir();
pitch = user:get_look_vertical();
angle = user:get_look_horizontal();
eyeheight = user:get_properties().eye_height;
};
|
|
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
|
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 probe = sorcery.spell.probe(user:get_pos())
-- amulets don't work in antimagic fields, though some may want to
-- 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();
pitch = user:get_look_vertical();
angle = user:get_look_horizontal();
eyeheight = user:get_properties().eye_height;
};
|