From a1c3603056ce4e243be66b6f9ee0b5c7d95ffeff Mon Sep 17 00:00:00 2001 From: sys4-fr Date: Sat, 29 Sep 2018 11:32:33 +0200 Subject: [PATCH] Fix turtles crash when right click on it. --- mobs_turtles/init.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mobs_turtles/init.lua b/mobs_turtles/init.lua index c0f07c3..67ddb6a 100644 --- a/mobs_turtles/init.lua +++ b/mobs_turtles/init.lua @@ -1,6 +1,22 @@ if mobs.mod and mobs.mod == "redo" then + local sin = math.sin + local cos = math.cos + + -- move mob in facing direction + local set_velocity = function(self, v) + + local yaw = (self.object:get_yaw() or 0) + self.rotate + + self.object:setvelocity( + { + x = sin(yaw) * -v, + y = self.object:getvelocity().y, + z = cos(yaw) * v + }) + end + local l_colors = { "#604000:175", --brown "#604000:100", --brown2