1
2
3
4
5
6
7
8
9
..
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
local dagger_uses = 16
minetest.register_tool("sorcery:dagger", {
description = "Sacrificial Dagger",
inventory_image = "sorcery_dagger.png",
tool_capabilities = {
full_punch_interval = 1.6,
max_drop_level = 1,
damage_groups = { fleshy = 2 },
................................................................................
})
local dagger_usefn = function(selfharm)
return function(stack,user,pointat)
if (not minetest.is_player(pointat)) and
selfharm == false then
return nil
end
local inv = user:get_inventory()
local btl = ItemStack('vessels:glass_bottle')
if not inv:contains_item('main', btl) then
return nil
end
................................................................................
end
local pos = target:get_pos()
pos.y = pos.y + 1.5
local wear = 65535 / dagger_uses
stack:add_wear(wear)
inv:remove_item('main',btl)
inv:add_item('main',blood)
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
local unholy = ItemStack("sorcery:dagger")
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
..
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
..
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
local dagger_uses = 16
local log = sorcery.logger('tools')
minetest.register_tool("sorcery:dagger", {
description = "Sacrificial Dagger",
inventory_image = "sorcery_dagger.png",
tool_capabilities = {
full_punch_interval = 1.6,
max_drop_level = 1,
damage_groups = { fleshy = 2 },
................................................................................
})
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
if (ctr.has == 'sorcery:blood' or not ctr.has) and
((not ctr.charge) or ctr.charge < (ctr.max or 1)) then
trough = {
pos = trough, ctr = ctr;
def = sorcery.register.liquid.db['sorcery:blood'].containers[ctr.empty or cnn]
}
else
trough = nil
end
end
end
local inv = user:get_inventory()
local btl = ItemStack('vessels:glass_bottle')
if not inv:contains_item('main', btl) then
return nil
end
................................................................................
end
local pos = target:get_pos()
pos.y = pos.y + 1.5
local wear = 65535 / dagger_uses
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
local unholy = ItemStack("sorcery:dagger")
|