1
0
Fork 0

Implement Depth Strider enchantment

This commit is contained in:
Code-Sploit 2021-02-27 15:37:25 +00:00
parent 578709c93e
commit 828c1110b1
1 changed files with 12 additions and 0 deletions

View File

@ -197,6 +197,18 @@ minetest.register_globalstep(function(dtime)
playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface") playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface")
end 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 -- Is player suffocating inside node? (Only for solid full opaque cube type nodes
-- without group disable_suffocation=1) -- without group disable_suffocation=1)
local ndef = minetest.registered_nodes[node_head] local ndef = minetest.registered_nodes[node_head]