From e2bcd129c1ec881397c89ae854ce9d6ea4f02801 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Mon, 19 Aug 2024 19:41:34 +0200 Subject: [PATCH] Use soul_block group for soul speed bonus --- mods/PLAYER/mcl_playerplus/init.lua | 33 ++++++++++++++++------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index a467786f2..a4af9d000 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -517,23 +517,26 @@ 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 soul sand? If so, walk slower (unless player wears Soul Speed boots, then apply bonus) - elseif 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 - if soul_speed > 0 then - 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) + -- 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) + 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 + if soul_speed > 0 then + playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:soul_speed", soul_speed * 0.105 + 1.3) 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 + 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")