1
0
Fork 0

Respawn dead players when they login so they don't get stuck without the death formspec (#4041)

Hopefully will prevent the dead player not respawning when logging in bug from happening

Reviewed-on: MineClone2/MineClone2#4041
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: Eliy21 <eliy21@noreply.git.minetest.land>
Co-committed-by: Eliy21 <eliy21@noreply.git.minetest.land>
This commit is contained in:
Eliy21 2023-12-05 01:08:50 +00:00 committed by the-real-herowl
parent 027e0e8337
commit 0673fcc25b
1 changed files with 5 additions and 0 deletions

View File

@ -657,6 +657,7 @@ end)
-- set to blank on join (for 3rd party mods) -- set to blank on join (for 3rd party mods)
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
local hp = player:get_hp()
mcl_playerplus_internal[name] = { mcl_playerplus_internal[name] = {
lastPos = nil, lastPos = nil,
@ -671,6 +672,10 @@ minetest.register_on_joinplayer(function(player)
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3, 5.785, 0)) player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3, 5.785, 0))
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3, 5.785, 0)) player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3, 5.785, 0))
player:set_bone_position("Body_Control", vector.new(0, 6.75, 0)) player:set_bone_position("Body_Control", vector.new(0, 6.75, 0))
-- Respawn dead players on joining
if hp <= 0 then
player:respawn()
end
end) end)
-- clear when player leaves -- clear when player leaves