Skip to content

Commit ff03519

Browse files
committed
up
1 parent 19c0433 commit ff03519

File tree

3 files changed

+41
-38
lines changed

3 files changed

+41
-38
lines changed

depends.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
bones
1+
default
2+
simple_skins?

init.lua

+39-37
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
headnumber = 129
44

5-
-- register head nodes
6-
75
for i = 1, headnumber do
86

97
local x = i + 1
@@ -13,6 +11,7 @@ for i = 1, headnumber do
1311

1412
minetest.register_node("heads:head_"..i, {
1513
description = "Head Number "..i,
14+
wield_scale = {x=1.5, y=1.5, z=1.5},
1615
drawtype = "nodebox",
1716
tiles = {
1817
"[combine:16x16:-4,4=character_"..i..".png",--top
@@ -39,45 +38,48 @@ for i = 1, headnumber do
3938
},
4039
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
4140
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
6441

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)
6762

68-
end,
63+
minetest.add_item({x = pos.x, y = pos.y + 1, z = pos.z}, stack)
64+
65+
end,
66+
6967
})
7068

7169
end
7270

73-
-- register head craft
7471

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)

sounds/head_drop.ogg

5.72 KB
Binary file not shown.

0 commit comments

Comments
 (0)