From 62bd960e38d08d54103321370c2cbb96b415c276 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Wed, 26 Feb 2020 21:28:04 +0000 Subject: [PATCH] added nil check for velocity --- api.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api.lua b/api.lua index 2ba4395..bf46d7c 100644 --- a/api.lua +++ b/api.lua @@ -6,7 +6,7 @@ local use_cmi = minetest.global_exists("cmi") mobs = { mod = "redo", - version = "20200207", + version = "20200226", intllib = S, invis = minetest.global_exists("invisibility") and invisibility or {} } @@ -230,6 +230,9 @@ function mob_class:set_velocity(v) local yaw = (self.object:get_yaw() or 0) + self.rotate + -- nil check for velocity + v = v or 0 + -- set velocity with hard limit of 10 self.object:set_velocity({ x = max(-10, min((sin(yaw) * -v) + c_x, 10)),