diff --git a/minetest.conf b/minetest.conf index 74ca68a..8a50603 100644 --- a/minetest.conf +++ b/minetest.conf @@ -40,6 +40,7 @@ rspawn.min_x = -20000 rspawn.max_x = 20000 rspawn.min_z = -20000 rspawn.max_z = 20000 +default_hp_player_maximun = 40 ## server as client related diff --git a/mods/default/player.lua b/mods/default/player.lua index 4a7c5fd..766668a 100644 --- a/mods/default/player.lua +++ b/mods/default/player.lua @@ -4,8 +4,17 @@ -- Player animation blending -- Note: This is currently broken due to a bug in Irrlicht, leave at 0 local animation_blend = 0 +local hp_player_maximun = tonumber(minetest.settings:get('default_hp_player_maximun')) or 40 +if minetest.has_feature("object_use_texture_alpha") then +core.PLAYER_MAX_HP_DEFAULT = hp_player_maximun +else +core.PLAYER_MAX_HP = hp_player_maximun +end default.registered_player_models = { } +if minetest.get_modpath("hudbars") then +hb.settings.hp_player_maximun = hp_player_maximun +end -- Local for speed. local models = default.registered_player_models @@ -76,6 +85,7 @@ function default.player_set_textures(player, textures) local name = player:get_player_name() player_textures[name] = textures player:set_properties({textures = textures,}) + player:set_properties({hp_max = hp_player_maximun}) end function default.player_set_animation(player, anim_name, speed) @@ -97,6 +107,7 @@ minetest.register_on_joinplayer(function(player) default.player_attached[player:get_player_name()] = false default.player_set_model(player, "character.b3d") player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30) + player:set_properties({hp_max = hp_player_maximun}) player:hud_set_hotbar_image("gui_hotbar.png") player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")