From 7d69d29316263603375683be2fa2472a9eb827a1 Mon Sep 17 00:00:00 2001 From: Maksym H Date: Mon, 27 Feb 2023 09:42:34 +0100 Subject: [PATCH] Fix wrong `set_attach` use --- init.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 13f3f14..727eb38 100644 --- a/init.lua +++ b/init.lua @@ -522,7 +522,7 @@ minetest.register_entity("vehicles:ambulance", { if self.driver and clicker == self.driver then vehicles.object_detach(self, clicker, {x=1, y=0, z=1}) elseif self.driver and clicker ~= self.driver and not self.rider then - clicker:set_attach(self.object, clicker, {x=0, y=5, z=4}, {x=0, y=7, z=10}) + clicker:set_attach(self.object, "", {x=0, y=5, z=4}, {x=0, y=7, z=10}) self.rider = true clicker:set_hp(20) elseif self.driver and clicker ~= self.driver and self.rider then @@ -583,7 +583,7 @@ minetest.register_entity("vehicles:ute", { if self.driver and clicker == self.driver then vehicles.object_detach(self, clicker, {x=1, y=0, z=1}) elseif self.driver and clicker ~= self.driver and not self.rider then - clicker:set_attach(self.object, clicker, {x=0, y=5, z=-5}, {x=0, y=0, z=-2}) + clicker:set_attach(self.object, "", {x=0, y=5, z=-5}, {x=0, y=0, z=-2}) self.rider = true elseif self.driver and clicker ~= self.driver and self.rider then clicker:set_detach() @@ -651,9 +651,9 @@ minetest.register_entity("vehicles:ute2", { if self.driver and clicker == self.driver then vehicles.object_detach(self, clicker, {x=1, y=0, z=1}) elseif self.driver and clicker ~= self.driver and not self.rider then - clicker:set_attach(self.object, clicker, {x=0, y=5, z=-5}, {x=0, y=0, z=0}) + clicker:set_attach(self.object, "", {x=0, y=5, z=-5}, {x=0, y=0, z=0}) self.rider = true - elseif self.driver and clicker ~=self.driver and self.rider then + elseif self.driver and clicker ~= self.driver and self.rider then clicker:set_detach() self.rider = false elseif not self.driver then @@ -1734,6 +1734,7 @@ minetest.register_entity("vehicles:wing_glider", { on_step = function(self, dtime) if self.driver then local dir = self.driver:get_look_dir() + if not dir then return false end local vec = {x=dir.x*16,y=dir.y*16+1,z=dir.z*16} local yaw = self.driver:get_look_horizontal() self.object:set_yaw(yaw+math.pi)