From c8f03513e3a03d9bb91375770e9596806741131d Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sun, 10 Aug 2014 14:03:13 +0200 Subject: [PATCH] Better handbrake and fix punch bug --- init.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index a99d4d2..5a5da15 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,5 @@ -- TODO: --- Add rail-cross switching --- Prevent from floating carts +-- Add a todo list boost_cart = {} boost_cart.modpath = minetest.get_modpath("boost_cart") @@ -69,9 +68,9 @@ function boost_cart.cart:on_punch(puncher, time_from_last_punch, tool_capabiliti return end - local vel = self.velocity + local vel = self.object:getvelocity() if puncher:get_player_name() == self.driver then - if math.abs(vel.x) + math.abs(vel.z) > 4 then + if math.abs(vel.x) + math.abs(vel.z) > 5 then return end end @@ -207,8 +206,8 @@ function boost_cart.cart:on_step(dtime) else acc = acc - 0.4 -- Handbrake - if ctrl and ctrl.down then - acc = acc - 0.8 + if ctrl and ctrl.down and math.abs(vel.x) + math.abs(vel.z) > 1.2 then + acc = acc - 1.2 end end