summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstujones11 <stujones111@gmail.com>2016-01-24 20:37:42 +0000
committerstujones11 <stujones111@gmail.com>2016-01-24 20:37:42 +0000
commit40a301a46f2d932e3450ba0304d75fb119ff17dc (patch)
tree87f3b1a2c5e03d8a5c9e6fdd96ef9df5af756c6d
parentfc6b10eb660c237f5953485a2ee45d175db3361c (diff)
Add driver boost and stop feature to carts
-rw-r--r--railcart/init.lua11
1 files changed, 11 insertions, 0 deletions
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)