From 70fd9db0c351b18255d07b341e29016d045837a6 Mon Sep 17 00:00:00 2001 From: Brandon Date: Thu, 18 Jun 2020 20:22:44 -0400 Subject: [PATCH] Fix crash with non-player objects when adding player_physics attributes to object. --- mods/ITEMS/mcl_potions/functions.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index 06a75d1752..dfcacefb73 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -50,29 +50,29 @@ function mcl_potions.healing_func(player, hp) end function mcl_potions.swiftness_func(player, factor, duration) + if not player:get_meta() then return false end playerphysics.add_physics_factor(player, "speed", "swiftness", factor) minetest.after(duration, function() playerphysics.remove_physics_factor(player, "speed", "swiftness") end ) end function mcl_potions.leaping_func(player, factor, duration) + if player:get_meta() then return false end playerphysics.add_physics_factor(player, "jump", "leaping", factor) minetest.after(duration, function() playerphysics.remove_physics_factor(player, "jump", "leaping") end ) end function mcl_potions.weakness_func(player, factor, duration) player:set_attribute("weakness", tostring(factor)) - print(player:get_player_name().." ".."weakness = "..player:get_attribute("weakness")) + -- print(player:get_player_name().." ".."weakness = "..player:get_attribute("weakness")) minetest.after(duration, function() player:set_attribute("weakness", tostring(0)) end ) end - function mcl_potions.poison_func(player, factor, duration) for i=1,math.floor(duration/factor) do minetest.after(i*factor, function() player:set_hp(player:get_hp() - 1) end) end end - function mcl_potions.regeneration_func(player, factor, duration) for i=1,math.floor(duration/factor) do minetest.after(i*factor, function()