From 40a301a46f2d932e3450ba0304d75fb119ff17dc Mon Sep 17 00:00:00 2001 From: stujones11 Date: Sun, 24 Jan 2016 20:37:42 +0000 Subject: Add driver boost and stop feature to carts --- railcart/init.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/railcart/init.lua b/railcart/init.lua index 2cd9586..c72db24 100644 --- a/railcart/init.lua +++ b/railcart/init.lua @@ -88,6 +88,17 @@ minetest.register_entity("railcart:cart_entity", { return end if self.cart and direction then + if self.driver then + direction = {x=0, y=0, z=0} + local ld = self.driver:get_look_dir() + if ld.y > -0.99 then + direction = { + x = railtrack:get_sign(ld.x), + z = railtrack:get_sign(ld.z), + y = self.cart.dir.y + } + end + end local pos = vector.round(self.object:getpos()) local dir = vector.round(vector.normalize(direction)) local speed = railcart:velocity_to_speed(self.cart.vel) -- cgit v1.2.3