default/player_api set hp mx to 40 event 20

master
mckaygerhard 2023-08-13 14:16:34 -04:00
parent 8be7726147
commit d47102d5bf
1 changed files with 6 additions and 1 deletions

View File

@ -4,14 +4,18 @@
-- 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
local modelchar
local eyeheithg
local is_50 = minetest.has_feature("object_use_texture_alpha") or nil
if is_50 then
core.PLAYER_MAX_HP_DEFAULT = hp_player_maximun
modelchar = "character50.b3d"
eyeheithg = 1.47
else
core.PLAYER_MAX_HP = hp_player_maximun
modelchar = "character40.b3d"
eyeheithg = 1.625
end
@ -78,6 +82,7 @@ function default.player_set_textures(player, textures)
local model_textures = model and model.textures or nil
player_textures[name] = textures or model_textures
player:set_properties({textures = textures or model_textures,})
player:set_properties({hp_max = hp_player_maximun})
end
function default.player_set_animation(player, anim_name, speed)
@ -94,7 +99,6 @@ function default.player_set_animation(player, anim_name, speed)
player:set_animation(anim, speed or model.animation_speed, animation_blend)
end
-- Default player appearance
default.player_register_model( modelchar, {
animation_speed = 30,
@ -124,6 +128,7 @@ minetest.register_on_joinplayer(function(player)
{x = 200, y = 219},
30
)
player:set_properties({hp_max = hp_player_maximun})
end)
minetest.register_on_leaveplayer(function(player)