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