-
Notifications
You must be signed in to change notification settings - Fork 7
/
wand.lua
47 lines (42 loc) · 1.13 KB
/
wand.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
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
47
-- base wand
-- register item
minetest.register_craftitem("missions:wand", {
description = "Mission wand",
inventory_image = "missions_wand.png",
on_use = function(itemstack, player, pointed_thing)
if pointed_thing and pointed_thing.type == "node" and pointed_thing.under then
missions.form.wand(pointed_thing.under, player)
end
return itemstack
end
})
--register craft
minetest.register_craft({
output = "missions:wand 3",
recipe = {
{"default:stick", "", "default:obsidian_shard"},
{"", "default:stick", ""},
{"default:mese_crystal_fragment", "", "default:stick"}
}
})
-- converted wands
-- helper table to track which wands are being added
wands = {
["position"] = "position",
["chest"] = "chest-reference",
["mission"] = "mission-reference"
}
for key, value in pairs(wands) do
-- register item
minetest.register_craftitem("missions:wand_" .. key, {
description = "Mission wand with " .. value,
inventory_image = "missions_wand_" .. key .. ".png",
stack_max = 1
})
-- register deconversion
minetest.register_craft({
type = "shapeless",
output = "missions:wand",
recipe = {"missions:wand_" .. key}
})
end