Minor Game fixes, move Milk Bucket to Bucket mod

master
MoNTE48 2019-07-24 13:53:59 +02:00
parent 68117f4e03
commit 54007f4d84
2 changed files with 8 additions and 7 deletions

View File

@ -38,7 +38,7 @@ function hud.register(name, def)
end end
if items[name] ~= nil then if items[name] ~= nil then
throw_error("A statbar with that name already exists") throw_error("A statbar with name " .. name .. " already exists")
return false return false
end end

View File

@ -43,13 +43,13 @@ local function initialize_builtin_statbars(player)
player:hud_set_flags(player:hud_get_flags()) player:hud_set_flags(player:hud_get_flags())
end end
if player:hud_get_flags().healthbar and enable_damage then if player:hud_get_flags().healthbar then
if hud_ids[name].id_healthbar == nil then --if hud_ids[name].id_healthbar == nil then
hud_ids[name].id_healthbar = hud.register("health", health_bar_definition) --hud_ids[name].id_healthbar = hud.register("health", health_bar_definition)
minetest.after(0, function() minetest.after(0, function()
hud.change_item(player, "health", {number = player:get_hp()}) hud.change_item(player, "health", {number = player:get_hp()})
end) end)
end --end
else else
if hud_ids[name].id_healthbar ~= nil then if hud_ids[name].id_healthbar ~= nil then
player:hud_remove(hud_ids[name].id_healthbar) player:hud_remove(hud_ids[name].id_healthbar)
@ -58,7 +58,7 @@ local function initialize_builtin_statbars(player)
end end
if (player:get_breath() < 11) then if (player:get_breath() < 11) then
if player:hud_get_flags().breathbar and enable_damage then if player:hud_get_flags().breathbar then
if hud_ids[name].id_breathbar == nil then if hud_ids[name].id_breathbar == nil then
hud_ids[name].id_breathbar = player:hud_add(breath_bar_definition) hud_ids[name].id_breathbar = player:hud_add(breath_bar_definition)
end end
@ -162,6 +162,7 @@ end
end]] end]]
if enable_damage then if enable_damage then
hud.register("health", health_bar_definition)
core.register_on_joinplayer(initialize_builtin_statbars) core.register_on_joinplayer(initialize_builtin_statbars)
core.register_on_leaveplayer(cleanup_builtin_statbars) core.register_on_leaveplayer(cleanup_builtin_statbars)
core.register_playerevent(player_event_handler) core.register_playerevent(player_event_handler)
@ -212,4 +213,4 @@ minetest.register_playerstep(function(dtime, playernames)
end end
end end
end end
end, minetest.is_singleplayer()) -- Force step in singlplayer mode only end, true)