forked from mtcontrib/minetest_mana
Make initial max. mana configurable
This commit is contained in:
parent
596b824074
commit
01bb3dd0a7
13
init.lua
13
init.lua
@ -12,6 +12,15 @@ License: WTFPL
|
|||||||
mana = {}
|
mana = {}
|
||||||
mana.playerlist = {}
|
mana.playerlist = {}
|
||||||
|
|
||||||
|
mana.settings = {}
|
||||||
|
mana.settings.default_max = 200
|
||||||
|
|
||||||
|
do
|
||||||
|
local default_max = tonumber(minetest.setting_get("mana_default_max"))
|
||||||
|
if default_max ~= nil then
|
||||||
|
mana.settings.default_max = default_max
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--[===[
|
--[===[
|
||||||
@ -179,7 +188,7 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
if mana.playerlist[playername] == nil then
|
if mana.playerlist[playername] == nil then
|
||||||
mana.playerlist[playername] = {}
|
mana.playerlist[playername] = {}
|
||||||
mana.playerlist[playername].mana = 0
|
mana.playerlist[playername].mana = 0
|
||||||
mana.playerlist[playername].maxmana = 100
|
mana.playerlist[playername].maxmana = mana.settings.default_max
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.get_modpath("hudbars") ~= nil then
|
if minetest.get_modpath("hudbars") ~= nil then
|
||||||
@ -196,7 +205,7 @@ end)
|
|||||||
]===]
|
]===]
|
||||||
|
|
||||||
if minetest.get_modpath("hudbars") ~= nil then
|
if minetest.get_modpath("hudbars") ~= nil then
|
||||||
hb.register_hudbar("mana", 0xFFFFFF, "Mana", { bar = "mana_bar.png", icon = "mana_icon.png" }, 0, 100, false)
|
hb.register_hudbar("mana", 0xFFFFFF, "Mana", { bar = "mana_bar.png", icon = "mana_icon.png" }, 0, mana.settings.default_max, false)
|
||||||
|
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user