Made soul speed and depth strider speed boosts additive instead of exclusive (#4422)

Reviewed-on: VoxeLibre/VoxeLibre#4422
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: WillConker <waj01@joanes.net>
Co-committed-by: WillConker <waj01@joanes.net>
This commit is contained in:
WillConker 2024-08-18 06:25:04 +02:00 committed by the-real-herowl
parent 09aba760cf
commit 406e0e8169
1 changed files with 13 additions and 7 deletions

View File

@ -512,23 +512,27 @@ minetest.register_globalstep(function(dtime)
local boots = player:get_inventory():get_stack("armor", 5)
local soul_speed = mcl_enchanting.get_enchantment(boots, "soul_speed")
if soul_speed > 0 then
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", soul_speed * 0.105 + 1.3)
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", soul_speed * 0.105 + 1.3)
else
if node_stand_below == "mcl_core:ice" or node_stand_below == "mcl_core:packed_ice" or node_stand_below == "mcl_core:slimeblock" or node_stand_below == "mcl_core:water_source" then
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.1)
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", 0.1)
else
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.4)
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", 0.4)
end
end
elseif get_item_group(node_feet, "liquid") ~= 0 and mcl_enchanting.get_enchantment(player:get_inventory():get_stack("armor", 5), "depth_strider") then
else
playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:soul_speed")
end
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:surface", (depth_strider / 3) + 0.75)
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:surface")
playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:depth_strider")
end
-- Is player suffocating inside node? (Only for solid full opaque cube type nodes
@ -679,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