Soul Speed

This commit is contained in:
Lizzy Fleckenstein 2020-11-09 10:50:27 +01:00
parent 494ffb41d3
commit 479dfd6c0d
3 changed files with 12 additions and 5 deletions

View File

@ -455,7 +455,7 @@ mcl_enchanting.enchantments.smite = {
requires_tool = false,
}
-- unimplemented
-- implemented in mcl_playerplus
mcl_enchanting.enchantments.soul_speed = {
name = "Soul Speed",
max_level = 3,

View File

@ -7,3 +7,4 @@ playerphysics
mcl_playerinfo
mcl_weather
mcl_spawn
mcl_enchanting

View File

@ -106,15 +106,21 @@ minetest.register_globalstep(function(dtime)
-- set defaults
def.speed = 1
-- Standing on soul sand? If so, walk slower
-- Standing on soul sand? If so, walk slower (unless player wears Soul Speed boots)
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 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)
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)
else
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 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:surface", 0.1)
else
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.4)
end
end
else
-- Reset speed decrease