Merge origin/main: 2.0 protocol cars and traffic config
This commit is contained in:
@@ -336,7 +336,7 @@ namespace StandardScene.Chained
|
||||
/// </summary>
|
||||
/// <param name="siteId">站点ID</param>
|
||||
/// <returns>找到的车辆,未找到返回 null</returns>
|
||||
protected Car FindCarArrivedAtSite(int siteId)
|
||||
protected virtual Car FindCarArrivedAtSite(int siteId)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1028,7 +1028,6 @@ namespace StandardScene.Chained
|
||||
/// <param name="reverse">是否倒车,默认为 false</param>
|
||||
public async Task GoSite(AbstractCar car, Site targetSite, string action = "/", bool reverse = false)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
// 创建路径规划
|
||||
@@ -1039,8 +1038,8 @@ namespace StandardScene.Chained
|
||||
|
||||
// 查找从当前位置到目标站点的路径
|
||||
plan.FindRoute(SimpleLib.GetSite(car.GetLastSite()), targetSite);
|
||||
|
||||
// 编译并执行移动脚本
|
||||
|
||||
// 编译并执行移动脚本(默认 Forecast)
|
||||
var program = plan.Compile("move");
|
||||
|
||||
// 标记车辆为占用状态
|
||||
@@ -1059,6 +1058,22 @@ namespace StandardScene.Chained
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
car.tags.Remove("occupied");
|
||||
if (car is Car trafficCar && car.GetLastSite() > 0)
|
||||
{
|
||||
var currentSite = SimpleLib.GetSite(car.GetLastSite());
|
||||
if (currentSite != null)
|
||||
{
|
||||
trafficCar.TrafficReset(currentSite, true, strict: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
// 记录异常并等待后重试
|
||||
Diagnosis.Post(
|
||||
$"{car.name}循环任务报错{ExceptionFormatter.FormatEx(ex)}--去往循环点id:{targetSite.id},name:{targetSite.name}",
|
||||
|
||||
Reference in New Issue
Block a user