summaryrefslogtreecommitdiff
path: root/extranodes/cottonseed_oil.lua
blob: 25c0f9ab8d4b4c8a84e2fd213f9e0428ced5a341 (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
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end

-- Cotton seed oil: fuel and fertilizer

if minetest.get_modpath("farming") then
	if minetest.get_modpath("bonemeal") then
		minetest.register_craftitem(":technic:cottonseed_oil", {
			description = S("Cottonseed Oil"),
			inventory_image = "technic_cottonseed_oil.png",
			on_use = function(itemstack, user, pointed_thing)
				if pointed_thing.type ~= "node" then
					return
				end
				if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
					return
				end
				if not is_creative(user:get_player_name()) then
					itemstack:take_item()
				end
				bonemeal:on_use(pointed_thing.under, 4)
				return itemstack
			end,
		})
	else
		minetest.register_craftitem(":technic:cottonseed_oil", {
			description = S("Cottonseed Oil"),
			inventory_image = "technic_cottonseed_oil.png",
		})
	end

	minetest.register_craft({
		type = "fuel",
		recipe = "technic:cottonseed_oil",
		burntime = 20,
	})

end