Doors: make AI play door closing sound
parent
fe26296daa
commit
2ac6b01cc3
|
@ -30,6 +30,9 @@ namespace OpenbveFcmbTrainPlugin
|
|||
/// <summary>Whether to trigger a door lock.</summary>
|
||||
private bool TriggerDoorLock;
|
||||
|
||||
/// <summary>Whether the AI should trigger the door closing sound.</summary>
|
||||
private bool AiTriggerDoorClosingSound;
|
||||
|
||||
|
||||
/// <summary>Is called when the device state should be updated.</summary>
|
||||
/// <param name="train">The current train.</param>
|
||||
|
@ -105,6 +108,10 @@ namespace OpenbveFcmbTrainPlugin
|
|||
}
|
||||
}
|
||||
|
||||
// Check if AI needs to trigger the door closing sound
|
||||
// TODO: check departure time
|
||||
AiTriggerDoorClosingSound |= (train.DoorState != DoorStates.None && DoorClosingSoundCounter > DoorClosingSoundDuration + DoorClosingSoundTimeout);
|
||||
|
||||
// Update panel variables for door selection state
|
||||
train.Panel[50] = (RequestedDoorInterlock == DoorInterlockStates.Left || RequestedDoorInterlock == DoorInterlockStates.Unlocked) || (((train.DoorState & DoorStates.Left) != 0) && !LeftDoorsClosing) ? 1 : 0;
|
||||
train.Panel[51] = (RequestedDoorInterlock == DoorInterlockStates.Right || RequestedDoorInterlock == DoorInterlockStates.Unlocked) || (((train.DoorState & DoorStates.Right) != 0) && !RightDoorsClosing) ? 1 : 0;
|
||||
|
@ -310,6 +317,13 @@ namespace OpenbveFcmbTrainPlugin
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (AiTriggerDoorClosingSound)
|
||||
{
|
||||
KeyChange(VirtualKeys.F, true, train);
|
||||
data.Response = AIResponse.Short;
|
||||
KeyChange(VirtualKeys.F, false, train);
|
||||
AiTriggerDoorClosingSound = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue