summaryrefslogtreecommitdiff
path: root/extranodes/aspirin.lua
blob: 126f7266aa3c48dd0572ffc0638e09f3274b627d (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
-- aspirin

-- makes any sence only when there is hunger as a separate status of the player
-- also it uses willow twigs - ethereal dependency
-- A bottle of aspirin pills heals the player immediately.

local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end

if (minetest.get_modpath("hunger") or minetest.get_modpath("hbhunger")) and minetest.get_modpath("ethereal") then

	minetest.register_craftitem(":technic:aspirin_pill", {
		description = S("Aspirin pill"),
		inventory_image = "technic_aspirin_pill.png",
		on_use = function(itemstack, user, pointed_thing)
			user:set_hp(user:get_hp() + 2)
			itemstack:take_item()
			return itemstack
		end
	})

	minetest.register_craftitem(":technic:aspirin_bottle", {
		description = S("Aspirin pills"),
		inventory_image = "technic_aspirin_bottle.png",
		on_use = function(itemstack, user, pointed_thing)
			user:set_hp(20)
			itemstack:take_item()
			return itemstack
		end
	})

	minetest.register_craft({
			type = "shapeless",
			output = "technic:aspirin_bottle",
			recipe = {"technic:aspirin_pill", "technic:aspirin_pill", 
				"technic:aspirin_pill", "technic:aspirin_pill",
				"technic:aspirin_pill", "technic:aspirin_pill", 
				"technic:aspirin_pill", "vessels:glass_bottle"}
		})

end