예제 #1
0
 public void Do(Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence> IntelItems, TimeSpan canonicalTime, Profiler profiler)
 {
     if (canonicalTime == TimeSpan.Zero)
     {
         return;
     }
     if (DockingSubsystem.Connector.Status == MyShipConnectorStatus.Connected)
     {
         if (Undock)
         {
             DockingSubsystem.Undock();
         }
         Status = TaskStatus.Complete;
     }
     else if (DockingSubsystem.Connector.Status == MyShipConnectorStatus.Unconnected)
     {
         if (Undock)
         {
             Status = TaskStatus.Complete;
         }
         else
         {
             Status = TaskStatus.Aborted;
         }
     }
     else
     {
         if (!Undock)
         {
             DockingSubsystem.Dock();
         }
         Status = TaskStatus.Complete;
     }
 }
예제 #2
0
        public void Do(Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence> IntelItems, TimeSpan canonicalTime, Profiler profiler)
        {
            if (canonicalTime == TimeSpan.Zero)
            {
                return;
            }

            if (WaitTask.Status == TaskStatus.Incomplete)
            {
                var dockKey = MyTuple.Create(IntelItemType.Dock, DockingSubsystem.Connector.OtherConnector.EntityId);

                if (!IntelItems.ContainsKey(dockKey))
                {
                    WaitTask.Status = TaskStatus.Complete;
                }
                else
                {
                    dock = (DockIntel)IntelItems[dockKey];
                    if ((dock.Status & HangarStatus.Launching) != 0)
                    {
                        WaitTask.Status = TaskStatus.Complete;
                    }
                    else
                    {
                        Program.IGC.SendBroadcastMessage(dock.HangarChannelTag, MyTuple.Create(Program.Me.CubeGrid.EntityId, dock.ID, (int)HangarRequest.RequestLaunch));
                    }
                }
            }
            else
            {
                if (DockingSubsystem.Connector.Status == MyShipConnectorStatus.Connected)
                {
                    DockingSubsystem.Undock();
                }

                AutopilotSubsystem.Drift(Drift);
                AutopilotSubsystem.Controller.DampenersOverride = false;

                var deltaT = canonicalTime - StartTime;

                if ((DockingSubsystem.Connector.WorldMatrix.Translation - (ExpectedPosition + ExpectedVelocity * deltaT.TotalSeconds)).Length() > 80)
                {
                    AutopilotSubsystem.Clear();
                    Status = TaskStatus.Complete;
                }
            }
        }