Merge pull request 'Depth Strider enchantment' (#1214) from Code-Sploit/MineClone2:master into master

Reviewed-on: MineClone2/MineClone2#1214
This commit is contained in:
Elias Fleckenstein 2021-02-28 14:09:37 +00:00
commit 961e5a249f
2 changed files with 15 additions and 3 deletions

View File

@ -124,8 +124,8 @@ mcl_enchanting.enchantments.curse_of_vanishing = {
inv_tool_tab = true,
}
-- unimplemented
--[[mcl_enchanting.enchantments.depth_strider = {
-- implemented in mcl_playerplus
mcl_enchanting.enchantments.depth_strider = {
name = S("Depth Strider"),
max_level = 3,
primary = {},
@ -141,7 +141,7 @@ mcl_enchanting.enchantments.curse_of_vanishing = {
power_range_table = {{10, 25}, {20, 35}, {30, 45}},
inv_combat_tab = true,
inv_tool_tab = false,
}]]--
}
-- implemented via on_enchant
mcl_enchanting.enchantments.efficiency = {

View File

@ -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 minetest.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:surface", (depth_strider / 3) + 0.75)
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]