summaryrefslogtreecommitdiff
path: root/craftitems.lua
blob: 864836363c50b8d92f2c0c1ec9d4abcf4d107e90 (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
local cherry_box = {
		type = "fixed",
		fixed = {
			{0, -0.375, -0.0625, 0.25, 0, 0.0625},
			{-0.0625, -0.3125, -0.0625, 0.3125, -0.0625, 0.0625},
			{-0.3125, -0.25, -0.0625, -0.125, 0.125, 0.0625},
			{-0.375, -0.1875, -0.0625, -0.125, 0.0625, 0.0625},
			{-0.125, -0.0625, -0.0625, -0.0625, 0.125, 0.0625},
			{-0.0625, 0, -0.0625, 0, 0.0625, 0.0625},
			{-0.0625, 0.125, -0.0625, 0, 0.1875, 0.0625},
			{0, 0.1875, -0.0625, 0.125, 0.25, 0.0625},
			{0.125, 0.25, -0.0625, 0.375, 0.3125, 0.0625},
			{0.25, 0.3125, -0.0625, 0.375, 0.375, 0.0625},
			{0.1875, 0.125, -0.0625, 0.25, 0.25, 0.0625},
			{0.125, 0.0625, -0.0625, 0.1875, 0.125, 0.0625},
			{0.0625, 0, -0.0625, 0.125, 0.0625, 0.0625},
		}
	}
local strawberry_box = {
		type = "fixed",
		fixed = {
			{-0.0625, 0.3125, -0.0625, 0, 0.375, 0.0625},
			{-0.25, 0.25, -0.0625, 0.1875, 0.3125, 0.0625},
			{-0.3125, 0.1875, -0.0625, 0.25, 0.25, 0.0625},
			{-0.375, -0.0625, -0.0625, 0.3125, 0.1875, 0.0625},
			{-0.3125, -0.1875, -0.0625, 0.25, -0.0625, 0.0625},
			{-0.25, -0.25, -0.0625, 0.1875, -0.1875, 0.0625},
			{-0.1875, -0.3125, -0.0625, 0.125, -0.25, 0.0625},
			{-0.0625, -0.375, -0.0625, 0, -0.3125, 0.0625},
		}
	}
local apple_box = {
		type = "fixed",
		fixed = {
			{-0.3125, -0.125, -0.0625, 0.375, 0.25, 0.0625},
			{-0.375, -0.125, -0.0625, -0.3125, 0.1875, 0.0625},
			{-0.3125, -0.25, -0.0625, 0.3125, -0.125, 0.0625},
			{-0.25, -0.3125, -0.0625, 0.25, -0.25, 0.0625},
			{0.0625, -0.375, -0.0625, 0.1875, -0.3125, 0.0625},
			{-0.1875, -0.375, -0.0625, 0, -0.3125, 0.0625},
			{0.125, 0.25, -0.0625, 0.3125, 0.3125, 0.0625},
			{0, 0.25, -0.0625, 0.0625, 0.3125, 0.0625},
			{-0.25, 0.25, -0.0625, -0.0625, 0.3125, 0.0625},
			{-0.0625, 0.3125, -0.0625, 0, 0.375, 0.0625},
		}
	}
local orange_box = {
		type = "fixed",
		fixed = {
			{-0.375, -0.125, -0.0625, 0.375, 0.125, 0.0625},
			{-0.3125, -0.25, -0.0625, 0.3125, 0.1875, 0.0625},
			{-0.25, -0.3125, -0.0625, 0.25, 0.25, 0.0625},
			{0.0625, -0.375, -0.0625, 0.1875, -0.3125, 0.0625},
			{-0.1875, -0.375, -0.0625, 0, -0.3125, 0.0625},
			{0, 0.25, -0.0625, 0.0625, 0.375, 0.0625},
			{-0.25, 0.3125, -0.0625, 0.0625, 0.375, 0.0625},
			{-0.1875, 0.25, -0.0625, -0.0625, 0.4375, 0.0625},
			{-0.25, 0.25, -0.0625, -0.1875, 0.3125, 0.0625},
		}
	}

local pelletitems = {
	{"cherrys", "Cherrys","2",cherry_box},
	{"apple", "Apple","3",apple_box},
	{"orange", "Orange","4",orange_box},
	{"strawberry", "Strawberry","2",strawberry_box},
	}
for i in ipairs (pelletitems) do
	local itm = pelletitems[i][1]
	local desc = pelletitems[i][2]
	local hlth = pelletitems[i][3]
	local cbox = pelletitems[i][4]

minetest.register_node("mypacman:"..itm,{
	description = desc,
	inventory_image = "mypacman_"..itm..".png",
	tiles = {
			"mypacman_"..itm..".png",
			"mypacman_"..itm..".png",
			"mypacman_"..itm..".png",
			"mypacman_"..itm..".png",
			"mypacman_"..itm..".png",
			"mypacman_"..itm..".png^[transformFX",
			},
	drawtype = "nodebox",
	paramtype = "light",
	paramtype2 = "facedir",
	walkable = false,
	light_source = 14,
	groups = {cracky=3,not_in_creative_inventory = 0},
	node_box = cbox,
	collision_box = cbox,
	after_destruct = function(pos, oldnode)
		mypacman.on_player_got_fruit()
	end,
})
end