From 828c1110b11548719465c49e591dae46dedd4413 Mon Sep 17 00:00:00 2001 From: Code-Sploit Date: Sat, 27 Feb 2021 15:37:25 +0000 Subject: [PATCH] Implement Depth Strider enchantment --- mods/PLAYER/mcl_playerplus/init.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index e12f73fc..94dda9cf 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -197,6 +197,18 @@ minetest.register_globalstep(function(dtime) playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface") end + -- Swimming? Check if boots are enchanted with depth strider + if node_feet == "mcl_core:water_source" or node_feet == "mclx_core:river_water_source" 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:surface", depth_strider / 2) + end + else + playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface") + end + -- Is player suffocating inside node? (Only for solid full opaque cube type nodes -- without group disable_suffocation=1) local ndef = minetest.registered_nodes[node_head]