Depth strider bugfix and remove old mcl_playerplus:surface modifier on player join

This commit is contained in:
WillConker 2024-06-09 21:34:37 +01:00
parent a0ce7316f2
commit 344cce46cd
1 changed files with 4 additions and 1 deletions

View File

@ -526,9 +526,10 @@ minetest.register_globalstep(function(dtime)
if get_item_group(node_feet, "liquid") ~= 0 and mcl_enchanting.get_enchantment(player:get_inventory():get_stack("armor", 5), "depth_strider") then
local boots = player:get_inventory():get_stack("armor", 5)
local depth_strider = mcl_enchanting.get_enchantment(boots, "depth_strider")
if depth_strider > 0 then
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:depth_strider", (depth_strider / 3) + 0.75)
else
playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:depth_strider")
end
else
playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:depth_strider")
@ -682,6 +683,8 @@ minetest.register_on_joinplayer(function(player)
player:respawn()
minetest.log("warning", name .. " joined the game with 0 hp and has been forced to respawn")
end
playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface")
end)
-- clear when player leaves