mirror of
https://github.com/SmallJoker/boost_cart.git
synced 2024-11-30 18:13:44 +01:00
Better handbrake and fix punch bug
This commit is contained in:
parent
21e309c414
commit
c8f03513e3
11
init.lua
11
init.lua
@ -1,6 +1,5 @@
|
|||||||
-- TODO:
|
-- TODO:
|
||||||
-- Add rail-cross switching
|
-- Add a todo list
|
||||||
-- Prevent from floating carts
|
|
||||||
|
|
||||||
boost_cart = {}
|
boost_cart = {}
|
||||||
boost_cart.modpath = minetest.get_modpath("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
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local vel = self.velocity
|
local vel = self.object:getvelocity()
|
||||||
if puncher:get_player_name() == self.driver then
|
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
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -207,8 +206,8 @@ function boost_cart.cart:on_step(dtime)
|
|||||||
else
|
else
|
||||||
acc = acc - 0.4
|
acc = acc - 0.4
|
||||||
-- Handbrake
|
-- Handbrake
|
||||||
if ctrl and ctrl.down then
|
if ctrl and ctrl.down and math.abs(vel.x) + math.abs(vel.z) > 1.2 then
|
||||||
acc = acc - 0.8
|
acc = acc - 1.2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user