31 lines
734 B
Lua
31 lines
734 B
Lua
local ns = rgt
|
|
ns.players = {}
|
|
|
|
Player = {
|
|
new = function(p)
|
|
local e = setmetatable({
|
|
name = p:get_player_name(),
|
|
object = p
|
|
}, {__index = Player})
|
|
return e
|
|
end
|
|
}
|
|
setmetatable(Player, {
|
|
__call = function(_, ...) return Player.new(...) end
|
|
})
|
|
|
|
-- TODO: Replace builtin health system with custom health system
|
|
minetest.hud_replace_builtin("health", {
|
|
type = "statbar",
|
|
position = {x=0.5,y=1},
|
|
offset = {x=-27 *10 -1,y=-96},
|
|
scale = {x=4,y=4},
|
|
alignment = {x=-1, y=-1},
|
|
size = {x=27,y=27},
|
|
text = "rgt_heart.png",
|
|
text2 = "rgt_heart_empty.png"
|
|
})
|
|
|
|
minetest.register_on_joinplayer(function(p)
|
|
ns.players[p:get_player_name()] = Player(p)
|
|
end)
|