forked from mtcontrib/minetest_mana
Code cleanup
This commit is contained in:
parent
4e18900a39
commit
d400f20c55
60
init.lua
60
init.lua
|
@ -261,35 +261,33 @@ if minetest.get_modpath("hudbars") ~= nil then
|
|||
end
|
||||
|
||||
else
|
||||
|
||||
function mana.manastring(playername)
|
||||
return string.format("Mana: %d/%d", mana.get(playername), mana.getmax(playername))
|
||||
end
|
||||
|
||||
function mana.hud_add(playername)
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
id = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
position = { x = 0.5, y=0.9 },
|
||||
text = mana.manastring(playername),
|
||||
scale = { x = 0, y = 0 },
|
||||
alignment = { x = 1, y = 0},
|
||||
direction = 1,
|
||||
number = 0xFFFFFF,
|
||||
offset = { x = -200, y = 15}
|
||||
})
|
||||
mana.playerlist[playername].hudid = id
|
||||
return id
|
||||
end
|
||||
|
||||
function mana.hud_update(playername)
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
player:hud_change(mana.playerlist[playername].hudid, "number", mana.get(playername))
|
||||
end
|
||||
|
||||
function mana.hud_remove(playername)
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
player:hud_remove(mana.playerlist[playername].hudid)
|
||||
end
|
||||
|
||||
function mana.manastring(playername)
|
||||
return string.format("Mana: %d/%d", mana.get(playername), mana.getmax(playername))
|
||||
end
|
||||
|
||||
function mana.hud_add(playername)
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
id = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
position = { x = 0.5, y=0.9 },
|
||||
text = mana.manastring(playername),
|
||||
scale = { x = 0, y = 0 },
|
||||
alignment = { x = 1, y = 0},
|
||||
direction = 1,
|
||||
number = 0xFFFFFF,
|
||||
offset = { x = -200, y = 15}
|
||||
})
|
||||
mana.playerlist[playername].hudid = id
|
||||
return id
|
||||
end
|
||||
|
||||
function mana.hud_update(playername)
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
player:hud_change(mana.playerlist[playername].hudid, "number", mana.get(playername))
|
||||
end
|
||||
|
||||
function mana.hud_remove(playername)
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
player:hud_remove(mana.playerlist[playername].hudid)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user