mirror of
https://github.com/SmallJoker/boost_cart.git
synced 2024-12-26 10:50:18 +01:00
test.
This commit is contained in:
parent
a38aa7d83b
commit
007037c633
10
init.lua
10
init.lua
@ -44,13 +44,12 @@ function boost_cart.cart:on_rightclick(clicker)
|
|||||||
clicker:set_detach()
|
clicker:set_detach()
|
||||||
elseif not self.driver then
|
elseif not self.driver then
|
||||||
self.driver = player_name
|
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=5, z=0}, {x=0, y=0, z=0})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function boost_cart.cart:on_activate(staticdata, dtime_s)
|
function boost_cart.cart:on_activate(staticdata, dtime_s)
|
||||||
self.object:set_armor_groups({immortal=1})
|
self.object:set_armor_groups({immortal=1})
|
||||||
self.old_pos = self.object:getpos()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function boost_cart.cart:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
|
function boost_cart.cart:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
|
||||||
@ -133,8 +132,8 @@ function boost_cart.cart:on_step(dtime)
|
|||||||
z = math.abs(diff.z)
|
z = math.abs(diff.z)
|
||||||
}
|
}
|
||||||
|
|
||||||
if diff.x > 1.2 or diff.y > 1.2 or diff.z > 1.2 then
|
if diff.x > 1 or diff.y > 1 or diff.z > 1 then
|
||||||
pos = vector.new(expected_pos)
|
pos = vector.new(self.old_pos)
|
||||||
self.punch = true
|
self.punch = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -149,7 +148,6 @@ function boost_cart.cart:on_step(dtime)
|
|||||||
if vector.equals(dir, {x=0, y=0, z=0}) then
|
if vector.equals(dir, {x=0, y=0, z=0}) then
|
||||||
vel = {x=0, y=0, z=0}
|
vel = {x=0, y=0, z=0}
|
||||||
self.object:setacceleration({x=0, y=0, z=0})
|
self.object:setacceleration({x=0, y=0, z=0})
|
||||||
self.old_pos = nil
|
|
||||||
self.punch = true
|
self.punch = true
|
||||||
else
|
else
|
||||||
-- If the direction changed
|
-- If the direction changed
|
||||||
@ -173,7 +171,7 @@ function boost_cart.cart:on_step(dtime)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Slow down or speed up..
|
-- Slow down or speed up..
|
||||||
local acc = (dir.y * -1.4) - 0.4
|
local acc = (dir.y * -2) - 0.4
|
||||||
local new_acc = {
|
local new_acc = {
|
||||||
x = dir.x * acc,
|
x = dir.x * acc,
|
||||||
y = dir.y * acc,
|
y = dir.y * acc,
|
||||||
|
Loading…
Reference in New Issue
Block a user