From b67308a72a21f359e72eb893efb4792fbdc1a43c Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Sat, 1 Sep 2018 18:46:15 +0100 Subject: [PATCH] added smalljokers new changes --- cart_entity.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cart_entity.lua b/cart_entity.lua index 6fb0a3f..ae3453e 100644 --- a/cart_entity.lua +++ b/cart_entity.lua @@ -54,15 +54,19 @@ function cart_entity:on_activate(staticdata, dtime_s) return end self.railtype = data.railtype - if data.old_dir then - self.old_dir = data.old_dir + self.old_dir = data.old_dir or self.old_dir + self.old_pos = data.old_pos or self.old_pos + -- Correct the position when the cart drives further after the last 'step()' + if self.old_pos and boost_cart:is_rail(self.old_pos, self.railtype) then + self.object:set_pos(self.old_pos) end end function cart_entity:get_staticdata() return minetest.serialize({ railtype = self.railtype, - old_dir = self.old_dir + old_dir = self.old_dir, + old_pos = self.old_pos }) end