mirror of
https://github.com/SmallJoker/boost_cart.git
synced 2024-11-27 17:03:44 +01:00
More weight, Handbrake + Railparams, animation fix
Slightly higher (2 -> 2.1) weight impact on slopes Sum up rail param speed and handbrake Fix animation when driving slowly towards a slope, turning and stopping on that slope
This commit is contained in:
parent
ca55c6f3c0
commit
49028ca123
@ -203,7 +203,7 @@ function cart_entity:on_step(dtime)
|
|||||||
update.pos = true
|
update.pos = true
|
||||||
cart_dir = new_dir
|
cart_dir = new_dir
|
||||||
end
|
end
|
||||||
elseif self.old_pos and cart_dir.y ~= -1 and not self.punched then
|
elseif self.old_pos and self.old_dir.y ~= 1 and not self.punched then
|
||||||
-- Stop wiggle
|
-- Stop wiggle
|
||||||
stop_wiggle = true
|
stop_wiggle = true
|
||||||
end
|
end
|
||||||
@ -277,18 +277,18 @@ function cart_entity:on_step(dtime)
|
|||||||
acc = railparam.acceleration
|
acc = railparam.acceleration
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if acc == nil then
|
if acc ~= false then
|
||||||
-- Handbrake
|
-- Handbrake
|
||||||
if ctrl and ctrl.down then
|
if ctrl and ctrl.down then
|
||||||
acc = -2
|
acc = (acc or 0) - 2
|
||||||
else
|
elseif acc == nil then
|
||||||
acc = -0.4
|
acc = -0.4
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if acc then
|
if acc then
|
||||||
-- Slow down or speed up, depending on Y direction
|
-- Slow down or speed up, depending on Y direction
|
||||||
acc = acc + dir.y * -2
|
acc = acc + dir.y * -2.1
|
||||||
else
|
else
|
||||||
acc = 0
|
acc = 0
|
||||||
end
|
end
|
||||||
@ -311,6 +311,9 @@ function cart_entity:on_step(dtime)
|
|||||||
local old_y_dir = self.old_dir.y
|
local old_y_dir = self.old_dir.y
|
||||||
if not vector.equals(dir, {x=0, y=0, z=0}) and not stop_wiggle then
|
if not vector.equals(dir, {x=0, y=0, z=0}) and not stop_wiggle then
|
||||||
self.old_dir = dir
|
self.old_dir = dir
|
||||||
|
else
|
||||||
|
-- Cart stopped, set the animation to 0
|
||||||
|
self.old_dir.y = 0
|
||||||
end
|
end
|
||||||
self.old_switch = switch_keys
|
self.old_switch = switch_keys
|
||||||
|
|
||||||
@ -335,13 +338,15 @@ function cart_entity:on_step(dtime)
|
|||||||
if not (update.vel or update.pos) then
|
if not (update.vel or update.pos) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
-- Re-use "dir", localize self.old_dir
|
||||||
|
dir = self.old_dir
|
||||||
|
|
||||||
local yaw = 0
|
local yaw = 0
|
||||||
if self.old_dir.x < 0 then
|
if dir.x < 0 then
|
||||||
yaw = 0.5
|
yaw = 0.5
|
||||||
elseif self.old_dir.x > 0 then
|
elseif dir.x > 0 then
|
||||||
yaw = 1.5
|
yaw = 1.5
|
||||||
elseif self.old_dir.z < 0 then
|
elseif dir.z < 0 then
|
||||||
yaw = 1
|
yaw = 1
|
||||||
end
|
end
|
||||||
self.object:set_yaw(yaw * math.pi)
|
self.object:set_yaw(yaw * math.pi)
|
||||||
|
Loading…
Reference in New Issue
Block a user