forked from mtcontrib/minetest_mana
Code cleanup
This commit is contained in:
parent
4e18900a39
commit
d400f20c55
18
init.lua
18
init.lua
@ -261,12 +261,11 @@ if minetest.get_modpath("hudbars") ~= nil then
|
|||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
function mana.manastring(playername)
|
||||||
function mana.manastring(playername)
|
|
||||||
return string.format("Mana: %d/%d", mana.get(playername), mana.getmax(playername))
|
return string.format("Mana: %d/%d", mana.get(playername), mana.getmax(playername))
|
||||||
end
|
end
|
||||||
|
|
||||||
function mana.hud_add(playername)
|
function mana.hud_add(playername)
|
||||||
local player = minetest.get_player_by_name(playername)
|
local player = minetest.get_player_by_name(playername)
|
||||||
id = player:hud_add({
|
id = player:hud_add({
|
||||||
hud_elem_type = "text",
|
hud_elem_type = "text",
|
||||||
@ -280,16 +279,15 @@ function mana.hud_add(playername)
|
|||||||
})
|
})
|
||||||
mana.playerlist[playername].hudid = id
|
mana.playerlist[playername].hudid = id
|
||||||
return id
|
return id
|
||||||
end
|
end
|
||||||
|
|
||||||
function mana.hud_update(playername)
|
function mana.hud_update(playername)
|
||||||
local player = minetest.get_player_by_name(playername)
|
local player = minetest.get_player_by_name(playername)
|
||||||
player:hud_change(mana.playerlist[playername].hudid, "number", mana.get(playername))
|
player:hud_change(mana.playerlist[playername].hudid, "number", mana.get(playername))
|
||||||
end
|
end
|
||||||
|
|
||||||
function mana.hud_remove(playername)
|
function mana.hud_remove(playername)
|
||||||
local player = minetest.get_player_by_name(playername)
|
local player = minetest.get_player_by_name(playername)
|
||||||
player:hud_remove(mana.playerlist[playername].hudid)
|
player:hud_remove(mana.playerlist[playername].hudid)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user