mirror of
https://github.com/SmallJoker/boost_cart.git
synced 2024-11-23 23:23:44 +01:00
Add this.
This commit is contained in:
parent
c8f03513e3
commit
faaa422fae
8
init.lua
8
init.lua
@ -42,7 +42,7 @@ function boost_cart.cart:on_rightclick(clicker)
|
||||
clicker:set_detach()
|
||||
elseif not self.driver then
|
||||
self.driver = player_name
|
||||
clicker:set_attach(self.object, "", {x=0, y=5, z=0}, {x=0, y=0, z=0})
|
||||
clicker:set_attach(self.object, "", {x=0, y=0.5, z=0}, {x=0, y=0, z=0})
|
||||
end
|
||||
end
|
||||
|
||||
@ -70,7 +70,7 @@ function boost_cart.cart:on_punch(puncher, time_from_last_punch, tool_capabiliti
|
||||
|
||||
local vel = self.object:getvelocity()
|
||||
if puncher:get_player_name() == self.driver then
|
||||
if math.abs(vel.x) + math.abs(vel.z) > 5 then
|
||||
if math.abs(vel.x) + math.abs(vel.z) > 6 then
|
||||
return
|
||||
end
|
||||
end
|
||||
@ -94,6 +94,10 @@ function boost_cart.cart:on_punch(puncher, time_from_last_punch, tool_capabiliti
|
||||
end
|
||||
local dir = boost_cart:get_rail_direction(self.object:getpos(), cart_dir)
|
||||
|
||||
if vector.equals(dir, {x=0, y=0, z=0}) then
|
||||
return
|
||||
end
|
||||
|
||||
local f = 4 * (time_from_last_punch / tool_capabilities.full_punch_interval)
|
||||
vel.x = dir.x * f
|
||||
vel.y = dir.y * f
|
||||
|
Loading…
Reference in New Issue
Block a user