mirror of
https://github.com/SmallJoker/boost_cart.git
synced 2024-11-24 07:33:44 +01:00
Do not update everytime
This commit is contained in:
parent
a59864dd74
commit
b6f476db37
11
init.lua
11
init.lua
@ -119,6 +119,7 @@ end
|
|||||||
|
|
||||||
function boost_cart.cart:on_step(dtime)
|
function boost_cart.cart:on_step(dtime)
|
||||||
local vel = self.object:getvelocity()
|
local vel = self.object:getvelocity()
|
||||||
|
local is_realpunch = self.punch
|
||||||
if self.punch then
|
if self.punch then
|
||||||
vel = vector.add(vel, self.velocity)
|
vel = vector.add(vel, self.velocity)
|
||||||
self.velocity = {x=0, y=0, z=0}
|
self.velocity = {x=0, y=0, z=0}
|
||||||
@ -246,6 +247,10 @@ function boost_cart.cart:on_step(dtime)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not self.punch then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local yaw = 0
|
local yaw = 0
|
||||||
if dir.x < 0 then
|
if dir.x < 0 then
|
||||||
yaw = 0.5
|
yaw = 0.5
|
||||||
@ -264,10 +269,10 @@ function boost_cart.cart:on_step(dtime)
|
|||||||
end
|
end
|
||||||
self.object:set_animation(anim, 1, 0)
|
self.object:set_animation(anim, 1, 0)
|
||||||
|
|
||||||
if self.punch then
|
self.object:setvelocity(vel)
|
||||||
self.object:setvelocity(vel)
|
self.object:setpos(pos)
|
||||||
self.object:setpos(pos)
|
|
||||||
|
|
||||||
|
if is_realpunch then
|
||||||
for _,obj_ in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
|
for _,obj_ in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
|
||||||
if not obj_:is_player() and
|
if not obj_:is_player() and
|
||||||
obj_:get_luaentity() and
|
obj_:get_luaentity() and
|
||||||
|
Loading…
Reference in New Issue
Block a user