2
2
3
3
headnumber = 129
4
4
5
- -- register head nodes
6
-
7
5
for i = 1 , headnumber do
8
6
9
7
local x = i + 1
@@ -13,6 +11,7 @@ for i = 1, headnumber do
13
11
14
12
minetest .register_node (" heads:head_" .. i , {
15
13
description = " Head Number " .. i ,
14
+ wield_scale = {x = 1.5 , y = 1.5 , z = 1.5 },
16
15
drawtype = " nodebox" ,
17
16
tiles = {
18
17
" [combine:16x16:-4,4=character_" .. i .. " .png" ,-- top
@@ -39,45 +38,48 @@ for i = 1, headnumber do
39
38
},
40
39
groups = {snappy = 1 ,choppy = 2 ,oddly_breakable_by_hand = 2 ,flammable = 3 },
41
40
drop = " heads:head_" .. i ,
42
- on_rightclick = function (pos , node , clicker )
43
-
44
- if clicker and not minetest .check_player_privs (clicker , " protection_bypass" ) then
45
- local name = clicker :get_player_name ()
46
- if minetest .is_protected (pos , name ) then
47
- minetest .record_protection_violation (pos , name )
48
- return
49
- end
50
- end
51
- node .name = " heads:head_" .. x
52
- minetest .env :set_node (pos , node )
53
-
54
- end ,
55
- on_punch = function (pos , node , puncher )
56
-
57
- if puncher and not minetest .check_player_privs (puncher , " protection_bypass" ) then
58
- local name = puncher :get_player_name ()
59
- if minetest .is_protected (pos , name ) then
60
- minetest .record_protection_violation (pos , name )
61
- return
62
- end
63
- end
64
41
65
- node .name = " heads:head_" .. y
66
- minetest .set_node (pos , node )
42
+ after_place_node = function (pos , placer , itemstack )
43
+
44
+ local item = placer :get_wielded_item ():to_string ()
45
+ local meta = ItemStack (item ):get_meta ()
46
+ local some_meta = meta :get_string (" description" )
47
+
48
+ local meta2 = minetest .get_meta (pos )
49
+ meta2 :set_string (" description" , some_meta )
50
+ meta2 :set_string (" infotext" , some_meta )
51
+
52
+ end ,
53
+
54
+ after_dig_node = function (pos , oldnode , oldmetadata , digger )
55
+
56
+ local meta = minetest .get_meta (pos )
57
+ local description = meta :get_string (" description" )
58
+
59
+ local stack = ItemStack (oldnode .name )
60
+ local meta2 = stack :get_meta ()
61
+ meta2 :set_string (" description" , description )
67
62
68
- end ,
63
+ minetest .add_item ({x = pos .x , y = pos .y + 1 , z = pos .z }, stack )
64
+
65
+ end ,
66
+
69
67
})
70
68
71
69
end
72
70
73
- -- register head craft
74
71
75
- minetest .register_craft ({
76
- output = " heads:head_1" ,
77
- recipe = {
78
- {" default:tree" ," default:leaves" ," default:tree" },
79
- {" default:leaves" ," default:goldblock" ," default:leaves" },
80
- {" default:tree" ," default:leaves" ," default:tree" },
81
-
82
- }
83
- })
72
+ minetest .register_on_dieplayer (function (player )
73
+
74
+ local name = player :get_player_name ()
75
+ local pos = vector .round (player :getpos ())
76
+ local skin_num = string.match (skins .skins [name ]," %d+" )
77
+
78
+ local stack = ItemStack (" heads:head_" .. skin_num )
79
+ local meta = stack :get_meta ()
80
+ meta :set_string (" description" , " Head of " .. name )
81
+
82
+ minetest .sound_play (" head_drop" , {pos , gain = 1.0 , })
83
+ minetest .add_item ({x = pos .x , y = pos .y + 1 , z = pos .z }, stack )
84
+
85
+ end )
0 commit comments