Use soul_block group for soul speed bonus

This commit is contained in:
seventeenthShulker 2024-08-19 19:41:34 +02:00 committed by the-real-herowl
parent 79e8452f62
commit e2bcd129c1

View File

@ -517,12 +517,11 @@ minetest.register_globalstep(function(dtime)
local boots = player:get_inventory():get_stack("armor", 5)
local soul_speed = mcl_enchanting.get_enchantment(boots, "soul_speed")
-- Standing on soul soil? If so, apply Soul Speed bonus
if node_stand == "mcl_blackstone:soul_soil" and soul_speed > 0 then
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", soul_speed * 0.105 + 1.3)
-- Standing on a soul block? If so, check for speed bonus / penalty
if get_item_group(node_stand, "soul_block") ~= 0 then
-- Standing on soul sand? If so, walk slower (unless player wears Soul Speed boots, then apply bonus)
elseif node_stand == "mcl_nether:soul_sand" then
if node_stand == "mcl_nether:soul_sand" then
-- TODO: Tweak walk speed
-- TODO: Also slow down mobs
-- Slow down even more when soul sand is above certain block
@ -535,6 +534,10 @@ minetest.register_globalstep(function(dtime)
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", 0.4)
end
end
elseif soul_speed > 0 then
-- Standing on a different soul block? If so, apply Soul Speed bonus unconditionally
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", soul_speed * 0.105 + 1.3)
end
else
playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:soul_speed")
end