forked from Mineclonia/Mineclonia
Soul Speed
This commit is contained in:
parent
494ffb41d3
commit
479dfd6c0d
|
@ -455,7 +455,7 @@ mcl_enchanting.enchantments.smite = {
|
||||||
requires_tool = false,
|
requires_tool = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- unimplemented
|
-- implemented in mcl_playerplus
|
||||||
mcl_enchanting.enchantments.soul_speed = {
|
mcl_enchanting.enchantments.soul_speed = {
|
||||||
name = "Soul Speed",
|
name = "Soul Speed",
|
||||||
max_level = 3,
|
max_level = 3,
|
||||||
|
|
|
@ -7,3 +7,4 @@ playerphysics
|
||||||
mcl_playerinfo
|
mcl_playerinfo
|
||||||
mcl_weather
|
mcl_weather
|
||||||
mcl_spawn
|
mcl_spawn
|
||||||
|
mcl_enchanting
|
||||||
|
|
|
@ -106,16 +106,22 @@ minetest.register_globalstep(function(dtime)
|
||||||
-- set defaults
|
-- set defaults
|
||||||
def.speed = 1
|
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
|
if 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
|
||||||
|
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
|
||||||
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
|
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:surface", 0.1)
|
||||||
else
|
else
|
||||||
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.4)
|
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.4)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
-- Reset speed decrease
|
-- Reset speed decrease
|
||||||
playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface")
|
playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface")
|
||||||
|
|
Loading…
Reference in New Issue