2021-12-22 00:09:12 +01:00
|
|
|
coconut = {}
|
|
|
|
|
|
|
|
minetest.register_node("coconut:nut", {
|
|
|
|
tiles =
|
|
|
|
{
|
2021-12-22 01:55:39 +01:00
|
|
|
"coconut_nut.png",
|
|
|
|
"coconut_nut.png",
|
|
|
|
"coconut_nut_side.png",
|
|
|
|
"coconut_nut_side.png",
|
|
|
|
"coconut_nut_side.png",
|
|
|
|
"coconut_nut_side.png"
|
2021-12-22 00:09:12 +01:00
|
|
|
},
|
|
|
|
drawtype = "nodebox",
|
|
|
|
paramtype = "light",
|
|
|
|
node_box =
|
|
|
|
{
|
|
|
|
type = "fixed",
|
|
|
|
fixed =
|
|
|
|
{
|
|
|
|
{-0.25, -0.5, -0.25, 0.25, 0, 0.25},
|
|
|
|
}
|
2021-12-22 01:55:39 +01:00
|
|
|
},
|
|
|
|
groups = {falling_node = 1, cracky = 2}
|
2021-12-22 00:09:12 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
function coconut.init()
|
|
|
|
local players = minetest.get_connected_players()
|
|
|
|
for i=1, #players do
|
|
|
|
coconut.add_huds(players[i])
|
|
|
|
minetest.chat_send_all(players[i])
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
function coconut.add_hud(player)
|
|
|
|
|
|
|
|
|
|
|
|
local meta = player:get_meta()
|
|
|
|
local digs_text = "You: " .. meta:get_int("score:digs")
|
|
|
|
local places_text = "Ami: " .. meta:get_int("score:places")
|
|
|
|
|
|
|
|
player:hud_add({
|
|
|
|
hud_elem_type = "text",
|
|
|
|
position = {x = 1, y = 0.5},
|
|
|
|
offset = {x = -120, y = -25},
|
|
|
|
text = "Stats",
|
|
|
|
alignment = 0,
|
|
|
|
scale = { x = 100, y = 30},
|
|
|
|
number = 0xFFFFFF,
|
|
|
|
})
|
|
|
|
|
|
|
|
player:hud_add({
|
|
|
|
hud_elem_type = "text",
|
|
|
|
position = {x = 1, y = 0.5},
|
|
|
|
offset = {x = -180, y = 0},
|
|
|
|
text = digs_text,
|
|
|
|
alignment = -1,
|
|
|
|
scale = { x = 50, y = 10},
|
|
|
|
number = 0xFFFFFF,
|
|
|
|
})
|
|
|
|
end
|