public TacMapSubsystem(IIntelProvider intelProvider)
        {
            IntelProvider = intelProvider;

            MenuItemBindings.Add(ActionPing, MenuCallbackPing);
            MenuItemBindings.Add(ActionMove, MenuCallbackMove);
        }
Esempio n. 2
0
        public TryScanResults CameraTryScan(IIntelProvider intelProvider, IMyCameraBlock camera, Vector3D targetPosition, TimeSpan localTime, EnemyShipIntel enemy)
        {
            var cameraToTarget = targetPosition - camera.WorldMatrix.Translation;
            var cameraDist     = cameraToTarget.Length();

            if (!camera.CanScan(cameraDist + this.ScanExtent))
            {
                return(TryScanResults.Retry);
            }

            if (!camera.CanScan(targetPosition))
            {
                return(TryScanResults.Retry);
            }

            cameraToTarget.Normalize();
            var cameraFinalPosition = cameraToTarget * (cameraDist + this.ScanExtent) + camera.WorldMatrix.Translation;
            var info = camera.Raycast(cameraFinalPosition);

            if (info.IsEmpty())
            {
                return(TryScanResults.Retry);
            }

            // if ((ProgramReference.CubeGrid.GetPosition() - info.HitPosition.Value).Length() < ProgramReference.CubeGrid.WorldAABB.Size.Length())
            //     return TryScanResults.Retry;

            if (info.Relationship == MyRelationsBetweenPlayerAndBlock.NoOwnership)
            {
                return(TryScanResults.DoNotRetry);
            }

            if (enemy.ID != 0 && info.EntityId != enemy.ID)
            {
                return(TryScanResults.Retry);
            }

            if (info.BoundingBox.Size.Length() * 0.5f < 4)
            {
                return(TryScanResults.Retry);
                //debugBuilder.AppendLine($"SUSP: {info.BoundingBox.Size.Length() * 0.5f}");
                //debugBuilder.AppendLine($"{info.Name}");
                //debugBuilder.AppendLine($"{info.EntityId}");
                //debugBuilder.AppendLine($"{(int)info.Position.X}, {(int)info.Position.Y}, {(int)info.Position.Z}");
                //debugBuilder.AppendLine($"{(int)info.Velocity.X}, {(int)info.Velocity.Y}, {(int)info.Velocity.Z}");
                //debugBuilder.AppendLine($"========");
                //debugBuilder.AppendLine($"{enemy.ID}");
                //var enemyPos = enemy.GetPositionFromCanonicalTime(localTime + IntelProvider.CanonicalTimeDiff);
                //debugBuilder.AppendLine($"{(int)enemyPos.X}, {(int)enemyPos.Y}, {(int)enemyPos.Z}");
                //debugBuilder.AppendLine($"{(int)enemy.CurrentVelocity.X}, {(int)enemy.CurrentVelocity.Y}, {(int)enemy.CurrentVelocity.Z}");
                //debugBuilder.AppendLine($"{enemy.Radius}");
            }

            enemy.FromDetectedInfo(info, localTime + intelProvider.CanonicalTimeDiff);
            intelProvider.ReportFleetIntelligence(enemy, localTime);

            return(TryScanResults.Scanned);
        }
        public AutoPDCTaskGenerator(MyGridProgram program, IAutopilot autopilot, IIntelProvider intelProvider)
        {
            Program       = program;
            Autopilot     = autopilot;
            IntelProvider = intelProvider;

            program.GridTerminalSystem.GetBlocksOfType(Rotors, (IMyMotorAdvancedStator r) => { return(r.CustomName.Contains("Elevation") && r.CubeGrid == program.Me.CubeGrid); });

            MyTask = new AutoPDCTask(Program, Autopilot, IntelProvider);
            MyTask.Do(new Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence>(), TimeSpan.Zero, null);
        }
Esempio n. 4
0
        public ScannerNetworkSubsystem(IIntelProvider intelProvider, string tag = "SE", int scanExtent = 30, float scanScatter = 0.25f)
        {
            IntelProvider = intelProvider;
            if (tag != string.Empty)
            {
                TagPrefix        = $"[{tag}";
                DesignatorPrefix = $"[{tag}] <D> T:";
            }

            ScanExtent  = scanExtent;
            ScanScatter = scanScatter;
        }
Esempio n. 5
0
        public HornetAttackTaskGenerator(MyGridProgram program, HornetCombatSubsystem combatSystem, IAutopilot autopilot, IAgentSubsystem agentSubsystem, IMonitorSubsystem monitorSubsystem, IIntelProvider intelProvider)
        {
            Program          = program;
            CombatSystem     = combatSystem;
            Autopilot        = autopilot;
            AgentSubsystem   = agentSubsystem;
            MonitorSubsystem = monitorSubsystem;
            IntelProvider    = intelProvider;

            HornetAttackTask = new HornetAttackTask(Program, CombatSystem, Autopilot, AgentSubsystem, MonitorSubsystem, IntelProvider);
            HornetAttackTask.Do(new Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence>(), TimeSpan.Zero, null);
        }
Esempio n. 6
0
//        int targetLastPoweredRun = 0;

        public HornetAttackTask(MyGridProgram program, HornetCombatSubsystem combatSystem, IAutopilot autopilot, IAgentSubsystem agentSubsystem, IMonitorSubsystem monitorSubsystem, IIntelProvider intelProvider)
        {
            Program          = program;
            CombatSystem     = combatSystem;
            Autopilot        = autopilot;
            AgentSubsystem   = agentSubsystem;
            MonitorSubsystem = monitorSubsystem;
            IntelProvider    = intelProvider;

            Status = TaskStatus.Incomplete;

            LeadTask = new WaypointTask(Program, Autopilot, new Waypoint(), WaypointTask.AvoidObstacleMode.Avoid);
        }
 public HoneybeeMiningTaskGenerator(MyGridProgram program, HoneybeeMiningSystem miningSystem, IAutopilot autopilot, IAgentSubsystem agentSubsystem, IDockingSubsystem dockingSubsystem, DockTaskGenerator dockTaskGenerator, UndockFirstTaskGenerator undockTaskGenerator, IIntelProvider intelProvder, IMonitorSubsystem monitorSubsystem)
 {
     Program             = program;
     MiningSystem        = miningSystem;
     Autopilot           = autopilot;
     AgentSubsystem      = agentSubsystem;
     DockTaskGenerator   = dockTaskGenerator;
     UndockTaskGenerator = undockTaskGenerator;
     IntelProvider       = intelProvder;
     MonitorSubsystem    = monitorSubsystem;
     DockingSubsystem    = dockingSubsystem;
     Task = new HoneybeeMiningTask(Program, MiningSystem, Autopilot, AgentSubsystem, new Waypoint(), new AsteroidIntel(), IntelProvider, MonitorSubsystem, DockingSubsystem, DockTaskGenerator, UndockTaskGenerator);
     Task.Do(new Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence>(), TimeSpan.Zero, null);
 }
Esempio n. 8
0
        public ScannerNetworkSubsystem.TryScanResults TryScan(IIntelProvider intelProvider, Vector3D targetPosition, EnemyShipIntel enemy, TimeSpan localTime)
        {
            foreach (var camera in Cameras)
            {
                if (!camera.IsWorking)
                {
                    continue;
                }
                var result = Host.CameraTryScan(intelProvider, camera, targetPosition, localTime, enemy);
                if (result == ScannerNetworkSubsystem.TryScanResults.Scanned)
                {
                    return(result);
                }
                if (result == ScannerNetworkSubsystem.TryScanResults.DoNotRetry)
                {
                    return(ScannerNetworkSubsystem.TryScanResults.Retry);                                                             // This array cannot scan
                }
            }

            return(ScannerNetworkSubsystem.TryScanResults.Retry);
        }
Esempio n. 9
0
 public HeliCombatAutopilotSubsystem(HeliDriveSubsystem drive, IIntelProvider intelProvider)
 {
     Drive         = drive;
     IntelProvider = intelProvider;
 }
Esempio n. 10
0
 public LandpedoSubsystem(IIntelProvider intelProvider, string landpedoTag = "[LG-LANDPEDO]")
 {
     IntelProvider = intelProvider;
     LandpedoTag   = landpedoTag;
 }
        public HoneybeeMiningTask(MyGridProgram program, HoneybeeMiningSystem miningSystem, IAutopilot autopilot, IAgentSubsystem agentSubsystem, Waypoint target, AsteroidIntel host, IIntelProvider intelProvider, IMonitorSubsystem monitorSubsystem, IDockingSubsystem dockingSubsystem, DockTaskGenerator dockTaskGenerator, UndockFirstTaskGenerator undockTaskGenerator)
        {
            Program               = program;
            MiningSystem          = miningSystem;
            Autopilot             = autopilot;
            AgentSubsystem        = agentSubsystem;
            MonitorSubsystem      = monitorSubsystem;
            Host                  = host;
            MiningDepth           = MiningSystem.MineDepth;
            LowestExpectedOreDist = (float)MiningDepth;
            DockingSubsystem      = dockingSubsystem;

            Status = TaskStatus.Incomplete;

            double lDoc, det;

            GetSphereLineIntersects(host.Position, host.Radius, target.Position, target.Direction, out lDoc, out det);
            Perpendicular = GetPerpendicular(target.Direction);
            CoPerp        = Perpendicular.Cross(target.Direction);

            if (det < 0)
            {
                Status = TaskStatus.Aborted;
                state  = -1;
                return;
            }

            SurfaceDist = -lDoc + Math.Sqrt(det);

            ApproachPoint = target.Position + target.Direction * SurfaceDist * 0.3;
            ExitPoint     = ApproachPoint;

            EntryPoint = target.Position + target.Direction * miningSystem.CloseDist;
            MiningEnd  = target.Position - target.Direction * MiningDepth;

            SurfacePoint = target.Position;

            LeadTask = new WaypointTask(Program, Autopilot, new Waypoint(), WaypointTask.AvoidObstacleMode.SmartEnter);
            MineTask = new WaypointTask(Program, Autopilot, new Waypoint(), WaypointTask.AvoidObstacleMode.DoNotAvoid);

            LeadTask.Destination.Position    = ApproachPoint;
            LeadTask.Destination.Direction   = target.Direction * -1;
            LeadTask.Destination.DirectionUp = Perpendicular + CoPerp;
            intelProvider.ReportFleetIntelligence(LeadTask.Destination, TimeSpan.FromSeconds(1));
            MineTask.Destination.Direction   = target.Direction * -1;
            MineTask.Destination.DirectionUp = Perpendicular + CoPerp;
            MineTask.Destination.Position    = EntryPoint;

            DockTaskGenerator   = dockTaskGenerator;
            UndockTaskGenerator = undockTaskGenerator;
        }
Esempio n. 12
0
 public HornetCombatSubsystem(IIntelProvider provider, bool useGuns = true)
 {
     IntelProvider = provider;
     UseGuns       = useGuns;
 }
 public HummingbirdCommandSubsystem(IIntelProvider intelProvider, ScannerNetworkSubsystem scannerSubsystem)
 {
     IntelProvider    = intelProvider;
     ScannerSubsystem = scannerSubsystem;
 }
Esempio n. 14
0
 public StatusIndicatorSubsystem(IDockingSubsystem dockingSubsystem, IIntelProvider intelProvider)
 {
     DockingSubsystem = dockingSubsystem;
     IntelProvider    = intelProvider;
 }
Esempio n. 15
0
 public MonitorSubsystem(IIntelProvider intelProvider)
 {
     IntelProvider = intelProvider;
 }
 public AgentSubsystem(IIntelProvider intelProvider, AgentClass agentClass)
 {
     IntelProvider = intelProvider;
     IntelProvider.AddIntelMutator(this);
     AgentClass = agentClass;
 }
 public AutoAimSubsystem(IIntelProvider intelProvider)
 {
     IntelProvider = intelProvider;
 }
 // Hangars should be named $"[{tag}{#}] name"
 // For example "[H15] Connector"
 // Up to 64 hangars - that really should be more than enough
 public HangarSubsystem(IIntelProvider provider, string tag = "H")
 {
     Tag           = tag;
     TagPrefix     = "[" + tag;
     IntelProvider = provider;
 }
Esempio n. 19
0
 public AutoPDCTask(MyGridProgram program, IAutopilot autopilot, IIntelProvider intelProvider)
 {
     Program       = program;
     Autopilot     = autopilot;
     IntelProvider = intelProvider;
 }
 public TacticalCommandSubsystem(IIntelProvider intelProvider)
 {
     IntelProvider = intelProvider;
 }
Esempio n. 21
0
 public TurretSubsystem(IIntelProvider intelProvider, string turretGroupName = "[LG-TURRET]")
 {
     TurretGroupName = turretGroupName;
     IntelProvider   = intelProvider;
 }
 public MACCombatAutopilotSubsystem(IAutopilot drive, IIntelProvider intelProvider)
 {
     Drive         = drive;
     IntelProvider = intelProvider;
 }
 public DockingSubsystem(IIntelProvider intelProvider, CombatLoaderSubsystem loader = null)
 {
     IntelProvider   = intelProvider;
     LoaderSubsystem = loader;
 }