mods - default/player_api - provide hp_max player configuration

* se hp_max to 40 so we will need more life due lack of armors
This commit is contained in:
mckaygerhard 2023-07-23 21:47:26 -04:00
parent 33d68fa60b
commit de62b0dd1b
2 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -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")