coconut_collection/mods/coconut/init.lua

71 lines
1.4 KiB
Lua
Raw Normal View History

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
},
2021-12-22 02:55:57 +01:00
groups = {falling_node = 1, cracky = 1}
2021-12-22 00:09:12 +01:00
})
2021-12-22 02:09:01 +01:00
2021-12-22 02:55:57 +01:00
2021-12-22 02:09:01 +01:00
minetest.register_on_joinplayer(function(player)
skybox.set(player, 5)
2021-12-22 02:55:57 +01:00
local wielditem = player:get_wielded_item()
wielditem:set_name("main:pickaxe_steel")
player:set_wielded_item(wielditem)
2021-12-22 02:09:01 +01:00
end)
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