15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
...
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
local dagger_usefn = function(selfharm)
return function(stack,user,pointat)
if (not minetest.is_player(pointat)) and
selfharm == false then
return nil
end
local trough = minetest.find_node_near(user:get_position(), 2.5, 'group:sorcery_trough', true)
if trough then
local cnn = minetest.get_node(trough).name
local ctr = minetest.registered_nodes[cnn]._sorcery
if (not ctr) or not ctr.container then
log.err('item',cnn,'is marked as a trough, but has no _sorcery.container table')
else
ctr = ctr.container
................................................................................
stack:add_wear(wear)
if not trough then
inv:remove_item('main',btl)
inv:add_item('main',blood)
else
local amt = selfharm and math.random(1,2) or 2
minetest.set_node(trough.pos, {
name = trough.def.make(def.res*amt+ctr.charge,1):get_name()
})
end
target:punch(user, 1.0, caps, nil)
sorcery.vfx.bloodburst(pos)
if math.random(3 + sorcery.enchant.strength(stack,'sanctify') * 6) == 1 then
-- we've used up the consecration
................................................................................
end
end
end
minetest.register_tool("sorcery:dagger_consecrated", {
description = "Consecrated Dagger",
inventory_image = "sorcery_dagger_consecrated.png",
tool_capabilities = {
full_punch_interval = 1.6,
max_drop_level = 1,
damage_groups = { fleshy = 6 },
},
sound = { breaks = "default_tool_breaks" },
groups = { sorcery_sanctify = 2, sword = 1 },
punch_attack_uses = 16,
on_use = dagger_usefn(false),
on_secondary_use = dagger_usefn(true),
})
|
|
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
local dagger_usefn = function(selfharm)
return function(stack,user,pointat)
if (not minetest.is_player(pointat)) and
selfharm == false then
return nil
end
local trough = minetest.find_node_near(user:get_pos(), 2.5, 'group:sorcery_trough', true)
if trough then
local cnn = minetest.get_node(trough).name
local ctr = minetest.registered_nodes[cnn]._sorcery
if (not ctr) or not ctr.container then
log.err('item',cnn,'is marked as a trough, but has no _sorcery.container table')
else
ctr = ctr.container
................................................................................
stack:add_wear(wear)
if not trough then
inv:remove_item('main',btl)
inv:add_item('main',blood)
else
local amt = selfharm and math.random(1,2) or 2
sorcery.liquid.setctr(trough.pos, 'sorcery:blood', (trough.ctr.charge or 0) + (trough.def.res*amt), true)
end
target:punch(user, 1.0, caps, nil)
sorcery.vfx.bloodburst(pos)
if math.random(3 + sorcery.enchant.strength(stack,'sanctify') * 6) == 1 then
-- we've used up the consecration
................................................................................
end
end
end
minetest.register_tool("sorcery:dagger_consecrated", {
description = "Consecrated Dagger",
inventory_image = "sorcery_dagger_consecrated.png^sorcery_dagger_glow.png",
wield_image = "sorcery_dagger_consecrated.png",
tool_capabilities = {
full_punch_interval = 1.6,
max_drop_level = 1,
damage_groups = { fleshy = 6 },
},
sound = { breaks = "default_tool_breaks" },
groups = { sorcery_sanctify = 2, sword = 1 },
punch_attack_uses = 16,
on_use = dagger_usefn(false),
on_secondary_use = dagger_usefn(true),
})
|