forked from FozLand/fishing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcraft.lua
129 lines (114 loc) · 3.02 KB
/
craft.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
48
49
50
51
52
53
54
55
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
-- Raw Fish (Thanks to Altairas for her Fish image on DeviantArt)
minetest.register_craftitem("fishing:fish_raw", {
description = "Raw Fish",
inventory_image = "fish_raw.png",
on_use = minetest.item_eat(2),
})
-- Cooked Fish
minetest.register_craftitem("fishing:fish_cooked", {
description = "Cooked Fish",
inventory_image = "fish_cooked.png",
on_use = minetest.item_eat(5),
})
-- Worm
minetest.register_craftitem("fishing:worm", {
description = "Worm",
inventory_image = "worm.png",
})
-- Fishing Rod
minetest.register_craftitem("fishing:fishing_rod", {
description = "Fishing Rod",
inventory_image = "fishing_rod.png",
stack_max = 1,
liquids_pointable = true,
})
-- Fishing Rod (Baited)
minetest.register_craftitem("fishing:fishing_rod_baited", {
description = "Baited Fishing Rod",
inventory_image = "fishing_rod_baited.png",
wield_image = "fishing_rod_wield.png",
stack_max = 1,
liquids_pointable = true,
on_use = function (itemstack, user, pointed_thing)
if pointed_thing and pointed_thing.under then
local node = minetest.env:get_node(pointed_thing.under)
if string.find(node.name, "default:water_source") then
if math.random(1, 70) < 5 then
local inv = user:get_inventory()
if inv:room_for_item( 'main', {name="fishing:fish_raw"} ) then
inv:add_item( 'main', {name="fishing:fish_raw"} )
return { name="fishing:fishing_rod" }
else
minetest.chat_send_player(user:get_player_name(), 'The fish got away! Your inventory was full')
end
end
end
end
end,
})
-- Fishing Rod
minetest.register_craft({
output = "fishing:fishing_rod",
recipe = {
{"","","default:stick"},
{"", "default:stick", "farming:string"},
{"default:stick", "", "farming:string"},
}
})
-- Sift through 4 Dirt Blocks to find Worm
minetest.register_craft({
output = "fishing:worm",
recipe = {
{"default:dirt","default:dirt"},
{"default:dirt","default:dirt"},
}
})
-- Cooking Fish
minetest.register_craft({
type = "cooking",
output = "fishing:fish_cooked",
recipe = "fishing:fish_raw",
cooktime = 2,
})
-- Baiting Fishing Rod
minetest.register_craft({
type = "shapeless",
output = "fishing:fishing_rod_baited",
recipe = {"fishing:fishing_rod", "fishing:worm"},
})
-- Sashimi (Thanks to Natalia Grosner for letting me use the sashimi image)
minetest.register_craftitem('fishing:sashimi', {
description = 'Sashimi',
inventory_image = 'sashimi.png',
groups = {
not_in_creative_inventory = 1
},
on_use = minetest.item_eat(4),
})
minetest.register_craft({
output = 'fishing:sashimi 2',
recipe = {
{'fishing:seaweed','fishing:fish_raw','fishing:seaweed'},
}
})
-- Dyes
minetest.register_craft( {
type = 'shapeless',
output = 'dye:pink 3',
recipe = {'fishing:coral4'},
})
minetest.register_craft( {
type = 'shapeless',
output = 'dye:orange 3',
recipe = {'fishing:coral3',},
})
minetest.register_craft( {
type = 'shapeless',
output = 'dye:cyan 3',
recipe = {'fishing:coral2',},
})
minetest.register_craft( {
type = 'shapeless',
output = 'dye:dark_green 3',
recipe = {'fishing:seaweed',},
})