summaryrefslogtreecommitdiff
path: root/caverealms_lite/crafting.lua
blob: 52da27712c4712a84d821d3434201798b7d25bdb (plain)
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
--thin ice to water
minetest.register_craft({
	output = "default:water_source",
	type = "shapeless",
	recipe = {"caverealms:thin_ice"}
})

--use for coal dust
minetest.register_craft({
	output = "default:coalblock",
	recipe = {
		{"caverealms:coal_dust","caverealms:coal_dust","caverealms:coal_dust"},
		{"caverealms:coal_dust","caverealms:coal_dust","caverealms:coal_dust"},
		{"caverealms:coal_dust","caverealms:coal_dust","caverealms:coal_dust"}
	}
})

-- DM statue
minetest.register_craft({
	output = "caverealms:dm_statue",
	recipe = {
		{"caverealms:glow_ore","caverealms:hot_cobble","caverealms:glow_ore"},
		{"caverealms:hot_cobble","caverealms:hot_cobble","caverealms:hot_cobble"},
		{"caverealms:hot_cobble","caverealms:hot_cobble","caverealms:hot_cobble"}
	}
})

-- Glow obsidian brick
minetest.register_craft({
	output = "caverealms:glow_obsidian_brick 4",
	recipe = {
		{"caverealms:glow_obsidian", "caverealms:glow_obsidian"},
		{"caverealms:glow_obsidian", "caverealms:glow_obsidian"}
	}
})

minetest.register_craft({
	output = "caverealms:glow_obsidian_brick_2 4",
	recipe = {
		{"caverealms:glow_obsidian_2", "caverealms:glow_obsidian_2"},
		{"caverealms:glow_obsidian_2", "caverealms:glow_obsidian_2"}
	}
})

-- Glow obsidian glass
minetest.register_craft({
	output = "caverealms:glow_obsidian_glass 5",
	recipe = {
		{"default:glass", "default:glass", "default:glass"},
		{"default:glass", "default:glass", "caverealms:glow_obsidian"}
	}
})

minetest.register_craft({
	output = "caverealms:glow_obsidian_glass 5",
	recipe = {
		{"default:glass", "default:glass", "default:glass"},
		{"default:glass", "default:glass", "caverealms:glow_obsidian_2"}
	}
})

-- Requires ethereal:fish_raw
if minetest.get_modpath("ethereal") then

	-- Professional Fishing Rod
	minetest.register_craftitem("caverealms:angler_rod", {
		description = "Pro Fishing Rod",
		inventory_image = "caverealms_angler_rod.png",
		wield_image = "caverealms_angler_rod.png"
	})

	minetest.register_craft({
		output = "caverealms:angler_rod",
		recipe = {
				{"","","default:steel_ingot"},
				{"", "default:steel_ingot", "caverealms:mushroom_gills"},
				{"default:steel_ingot", "", "caverealms:mushroom_gills"},
			}
	})

	-- Glow Bait
	minetest.register_craftitem("caverealms:glow_bait", {
		description = "Glow Bait",
		inventory_image = "caverealms_glow_bait.png",
		wield_image = "caverealms_glow_bait.png",
	})

	minetest.register_craft({
		output = "caverealms:glow_bait 9",
		recipe = {
				{"caverealms:glow_worm_green"},
			}
	})

	-- default ethereal fish
	local fish = {
		{"ethereal:fish_raw"},
	}

	-- Pro Fishing Rod (Baited)
	minetest.register_craftitem("caverealms:angler_rod_baited", {
		description = "Baited Pro Fishing Rod",
		inventory_image = "caverealms_angler_rod_baited.png",
		wield_image = "caverealms_angler_rod_weild.png",
		stack_max = 1,
		liquids_pointable = true,

		on_use = function (itemstack, user, pointed_thing)

			if pointed_thing.type ~= "node" then
				return
			end

			local node = minetest.get_node(pointed_thing.under).name

			if (node == "default:water_source"
			or node == "default:river_water_source")
			and math.random(1, 100) < 35 then

				local type = fish[math.random(1, #fish)][1]
				local inv = user:get_inventory()

				if inv:room_for_item("main", {name = type}) then

					inv:add_item("main", {name = type})

					if (math.random() < 0.6) then
						return ItemStack("caverealms:angler_rod_baited")
					else
						return ItemStack("caverealms:angler_rod")
					end
				else
					minetest.chat_send_player(user:get_player_name(),
						"Inventory full, Fish Got Away!")
				end
			end
		end,
	})

	minetest.register_craft({
		type = "shapeless",
		output = "caverealms:angler_rod_baited",
		recipe = {"caverealms:angler_rod", "caverealms:glow_bait"},
	})
end