Disable position-based collision and coupling system for very short trains (such as single minecarts) to solve #155
parent
1f3a4c3bfc
commit
4989da3663
|
@ -705,6 +705,7 @@ function advtrains.train_step_c(id, train, dtime)
|
|||
end
|
||||
|
||||
local train_moves=(train.velocity~=0)
|
||||
local very_short_train = train.trainlen < 3
|
||||
|
||||
--- On-track collision handling - detected in train_step_b, but handled here so all other train movements have already happened.
|
||||
if train.ontrack_collision_info then
|
||||
|
@ -726,7 +727,9 @@ function advtrains.train_step_c(id, train, dtime)
|
|||
if train_moves then
|
||||
train.couples_up_to_date = nil
|
||||
elseif not train.couples_up_to_date then
|
||||
if not very_short_train then -- old coupling system is buggy for short trains
|
||||
advtrains.train_check_couples(train) -- no guarantee for train order here
|
||||
end
|
||||
train.couples_up_to_date = true
|
||||
end
|
||||
|
||||
|
@ -746,7 +749,7 @@ function advtrains.train_step_c(id, train, dtime)
|
|||
local testpos=vector.add(rcollpos, {x=x, y=0, z=z})
|
||||
--- 8a Check collision ---
|
||||
if not collided then
|
||||
|
||||
if not very_short_train then -- position collision system is buggy for short trains
|
||||
local col_tr = advtrains.occ.check_collision(testpos, id)
|
||||
if col_tr then
|
||||
train.velocity = 0
|
||||
|
@ -754,6 +757,7 @@ function advtrains.train_step_c(id, train, dtime)
|
|||
advtrains.atc.train_reset_command(train)
|
||||
collided = true
|
||||
end
|
||||
end
|
||||
|
||||
--- 8b damage players ---
|
||||
if is_loaded_area and train.velocity > 3 and (setting_overrun_mode=="drop" or setting_overrun_mode=="normal") then
|
||||
|
|
Loading…
Reference in New Issue