Door closing sound: fix AI stuck between stations and lock doors when opening
This commit is contained in:
parent
0d696fb381
commit
261c1fa9c1
1 changed files with 13 additions and 2 deletions
|
@ -118,11 +118,18 @@ namespace OpenbveFcmbTrainPlugin
|
|||
// Use departure time - door closing sound duration
|
||||
AiTriggerDoorClosingSound |= CurrentTime.Seconds >= route.CurrentStation.DepartureTime - DoorClosingSoundDuration;
|
||||
}
|
||||
// TODO: AI gets stuck if doors open between stations, check distance to stop point
|
||||
}
|
||||
else
|
||||
{
|
||||
AiTriggerDoorClosingSound = false;
|
||||
// The doors have been opened between stations
|
||||
if (route.CurrentStation.StopPosition - route.CurrentStation.BackwardTolerance > train.State.Location)
|
||||
{
|
||||
AiTriggerDoorClosingSound = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
AiTriggerDoorClosingSound = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -166,6 +173,10 @@ namespace OpenbveFcmbTrainPlugin
|
|||
{
|
||||
DoorOpenTime = CurrentTime;
|
||||
}
|
||||
|
||||
// Set door closing counter to value higher than maximum where doors are allowed to close
|
||||
// This effectively locks the doors when they open
|
||||
DoorClosingSoundCounter = DoorClosingSoundDuration + DoorClosingSoundTimeout;
|
||||
}
|
||||
|
||||
/// <summary>Is called when the device should perform the AI.</summary>
|
||||
|
|
Loading…
Add table
Reference in a new issue