forked from mtcontrib/boost_cart
Detector rail added
Neated the code
This commit is contained in:
12
init.lua
12
init.lua
@ -13,9 +13,17 @@ function vector.floor(v)
|
||||
}
|
||||
end
|
||||
|
||||
function vector.tostr(v)
|
||||
return string.format("{%.3f; %.3f; %.3f}", v.x, v.y, v.z)
|
||||
end
|
||||
|
||||
dofile(boost_cart.modpath.."/functions.lua")
|
||||
dofile(boost_cart.modpath.."/rails.lua")
|
||||
|
||||
if mesecon then
|
||||
dofile(boost_cart.modpath.."/detector.lua")
|
||||
end
|
||||
|
||||
boost_cart.cart = {
|
||||
physical = false,
|
||||
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
@ -224,6 +232,10 @@ function boost_cart.cart:on_step(dtime)
|
||||
new_acc = vector.multiply(dir, acc)
|
||||
end
|
||||
|
||||
if mesecon then
|
||||
boost_cart:signal_detector_rail(vector.floor(pos))
|
||||
end
|
||||
|
||||
self.object:setacceleration(new_acc)
|
||||
self.old_pos = vector.new(pos)
|
||||
self.old_dir = vector.new(dir)
|
||||
|
Reference in New Issue
Block a user