Exemplo n.º 1
0
        public Program()
        {
            subsystemManager        = new SubsystemManager(this);
            Runtime.UpdateFrequency = UpdateFrequency.Update1;

            // Add subsystems
            AutopilotSubsystem autopilotSubsystem = new AutopilotSubsystem();
            IntelSubsystem     intelSubsystem     = new IntelSubsystem();
            DockingSubsystem   dockingSubsystem   = new DockingSubsystem(intelSubsystem);

            LocustCombatSystem combatSubsystem = new LocustCombatSystem();

            subsystemManager.AddSubsystem("autopilot", autopilotSubsystem);
            subsystemManager.AddSubsystem("docking", dockingSubsystem);
            subsystemManager.AddSubsystem("intel", intelSubsystem);
            subsystemManager.AddSubsystem("combat", combatSubsystem);

            AgentSubsystem           agentSubsystem         = new AgentSubsystem(intelSubsystem, AgentClass.Bomber);
            UndockFirstTaskGenerator undockingTaskGenerator = new UndockFirstTaskGenerator(this, autopilotSubsystem, dockingSubsystem);

            undockingTaskGenerator.AddTaskGenerator(new WaypointTaskGenerator(this, autopilotSubsystem));
            undockingTaskGenerator.AddTaskGenerator(new DockTaskGenerator(this, autopilotSubsystem, dockingSubsystem));

            undockingTaskGenerator.AddTaskGenerator(new LocustAttackTaskGenerator(this, combatSubsystem, autopilotSubsystem, agentSubsystem));

            agentSubsystem.AddTaskGenerator(undockingTaskGenerator);
            agentSubsystem.AddTaskGenerator(new SetHomeTaskGenerator(this, dockingSubsystem));
            subsystemManager.AddSubsystem("agent", agentSubsystem);

            subsystemManager.DeserializeManager(Storage);
        }
        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;
        }
 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);
 }
Exemplo n.º 4
0
        public Program()
        {
            subsystemManager        = new SubsystemManager(this);
            Runtime.UpdateFrequency = UpdateFrequency.Update1;

            // Add subsystems
            IntelSubsystem intelSubsystem = new IntelSubsystem();

            subsystemManager.AddSubsystem("intel", intelSubsystem);
            AutopilotSubsystem autopilotSubsystem = new AutopilotSubsystem();

            subsystemManager.AddSubsystem("autopilot", autopilotSubsystem);
            DockingSubsystem dockingSubsystem = new DockingSubsystem(intelSubsystem);

            subsystemManager.AddSubsystem("docking", dockingSubsystem);
            MonitorSubsystem monitorSubsystem = new MonitorSubsystem(intelSubsystem);

            subsystemManager.AddSubsystem("monitor", monitorSubsystem);

            // LookingGlass setup
            LookingGlassNetworkSubsystem lookingGlassNetwork = new LookingGlassNetworkSubsystem(intelSubsystem, "LG", false, false);

            subsystemManager.AddSubsystem("lookingglass", lookingGlassNetwork);

            // Agent setup
            AgentSubsystem agentSubsystem = new AgentSubsystem(intelSubsystem, AgentClass.Drone);

            intelSubsystem.MyAgent = agentSubsystem;
            UndockFirstTaskGenerator undockingTaskGenerator = new UndockFirstTaskGenerator(this, autopilotSubsystem, dockingSubsystem);

            undockingTaskGenerator.AddTaskGenerator(new WaypointTaskGenerator(this, autopilotSubsystem));
            undockingTaskGenerator.AddTaskGenerator(new DockTaskGenerator(this, autopilotSubsystem, dockingSubsystem));
            agentSubsystem.AddTaskGenerator(undockingTaskGenerator);
            agentSubsystem.AddTaskGenerator(new SetHomeTaskGenerator(this, dockingSubsystem));

            subsystemManager.AddSubsystem("agent", agentSubsystem);

            subsystemManager.AddSubsystem("indicator", new StatusIndicatorSubsystem(dockingSubsystem, intelSubsystem));

            subsystemManager.DeserializeManager(Storage);
        }
Exemplo n.º 5
0
        public Program()
        {
            Context = new ExecutionContext(this);

            subsystemManager        = new SubsystemManager(Context);
            Runtime.UpdateFrequency = UpdateFrequency.Update1;

            // Add subsystems
            AutopilotSubsystem autopilotSubsystem = new AutopilotSubsystem();
            IntelSubsystem     intelSubsystem     = new IntelSubsystem();

            Context.IntelSystem = intelSubsystem;

            DockingSubsystem     dockingSubsystem = new DockingSubsystem(intelSubsystem);
            HoneybeeMiningSystem miningSubsystem  = new HoneybeeMiningSystem();
            MonitorSubsystem     monitorSubsystem = new MonitorSubsystem(intelSubsystem);

            subsystemManager.AddSubsystem("autopilot", autopilotSubsystem);
            subsystemManager.AddSubsystem("docking", dockingSubsystem);
            subsystemManager.AddSubsystem("intel", intelSubsystem);
            subsystemManager.AddSubsystem("mining", miningSubsystem);
            subsystemManager.AddSubsystem("monitor", monitorSubsystem);

            AgentSubsystem agentSubsystem = new AgentSubsystem(intelSubsystem, AgentClass.Miner);

            UndockFirstTaskGenerator undockingTaskGenerator = new UndockFirstTaskGenerator(this, autopilotSubsystem, dockingSubsystem);

            undockingTaskGenerator.AddTaskGenerator(new WaypointTaskGenerator(this, autopilotSubsystem));
            DockTaskGenerator dockTaskGenerator = new DockTaskGenerator(this, autopilotSubsystem, dockingSubsystem);

            undockingTaskGenerator.AddTaskGenerator(dockTaskGenerator);

            agentSubsystem.AddTaskGenerator(undockingTaskGenerator);
            agentSubsystem.AddTaskGenerator(new SetHomeTaskGenerator(this, dockingSubsystem));
            agentSubsystem.AddTaskGenerator(new HoneybeeMiningTaskGenerator(this, miningSubsystem, autopilotSubsystem, agentSubsystem, dockingSubsystem, dockTaskGenerator, undockingTaskGenerator, intelSubsystem, monitorSubsystem));
            subsystemManager.AddSubsystem("agent", agentSubsystem);

            subsystemManager.AddSubsystem("indicator", new StatusIndicatorSubsystem(dockingSubsystem, intelSubsystem));

            subsystemManager.DeserializeManager(Storage);
        }
Exemplo n.º 6
0
        public Raven(IMyRemoteControl reference, MyGridProgram program)
        {
            Controller = reference;
            Context    = new ExecutionContext(program, reference);

            SubsystemManager = new SubsystemManager(Context);
            Drive            = new AtmoDrive(Controller);
            CombatLoaderSubsystem loaderSubsystem = new CombatLoaderSubsystem("Drone Cargo", "Drone Store");

            IntelSubsystem intelSubsystem = new IntelSubsystem();

            Context.IntelSystem = intelSubsystem;

            DockingSubsystem         dockingSubsystem       = new DockingSubsystem(intelSubsystem, loaderSubsystem);
            StatusIndicatorSubsystem indicatorSubsystem     = new StatusIndicatorSubsystem(dockingSubsystem, intelSubsystem);
            MonitorSubsystem         monitorSubsystem       = new MonitorSubsystem(intelSubsystem);
            AgentSubsystem           agentSubsystem         = new AgentSubsystem(intelSubsystem, AgentClass.Fighter);
            UndockFirstTaskGenerator undockingTaskGenerator = new UndockFirstTaskGenerator(program, Drive, dockingSubsystem);
            ScannerNetworkSubsystem  scannerSubsystem       = new ScannerNetworkSubsystem(intelSubsystem);
            HornetCombatSubsystem    combatSubsystem        = new HornetCombatSubsystem(intelSubsystem);

            SubsystemManager.AddSubsystem("autopilot", Drive);
            SubsystemManager.AddSubsystem("docking", dockingSubsystem);
            SubsystemManager.AddSubsystem("intel", intelSubsystem);
            SubsystemManager.AddSubsystem("monitor", monitorSubsystem);
            SubsystemManager.AddSubsystem("combat", combatSubsystem);
            SubsystemManager.AddSubsystem("indicator", indicatorSubsystem);
            SubsystemManager.AddSubsystem("loader", loaderSubsystem);

            undockingTaskGenerator.AddTaskGenerator(new WaypointTaskGenerator(program, Drive));
            undockingTaskGenerator.AddTaskGenerator(new DockTaskGenerator(program, Drive, dockingSubsystem));
            undockingTaskGenerator.AddTaskGenerator(new HornetAttackTaskGenerator(program, combatSubsystem, Drive, agentSubsystem, monitorSubsystem, intelSubsystem));

            agentSubsystem.AddTaskGenerator(undockingTaskGenerator);
            agentSubsystem.AddTaskGenerator(new SetHomeTaskGenerator(program, dockingSubsystem));

            SubsystemManager.AddSubsystem("agent", agentSubsystem);
            SubsystemManager.AddSubsystem("scanner", scannerSubsystem);
        }
Exemplo n.º 7
0
        public Hornet(IMyTerminalBlock reference, ExecutionContext context)
        {
            Context = context;

            SubsystemManager = new SubsystemManager(context);

            AutopilotSubsystem autopilotSubsystem = new AutopilotSubsystem();
            IntelSubsystem     intelSubsystem     = new IntelSubsystem();

            Context.IntelSystem = intelSubsystem;

            DockingSubsystem         dockingSubsystem       = new DockingSubsystem(intelSubsystem);
            HornetCombatSubsystem    combatSubsystem        = new HornetCombatSubsystem(intelSubsystem);
            MonitorSubsystem         monitorSubsystem       = new MonitorSubsystem(intelSubsystem);
            StatusIndicatorSubsystem indicatorSubsystem     = new StatusIndicatorSubsystem(dockingSubsystem, intelSubsystem);
            AgentSubsystem           agentSubsystem         = new AgentSubsystem(intelSubsystem, AgentClass.Fighter);
            UndockFirstTaskGenerator undockingTaskGenerator = new UndockFirstTaskGenerator(context.Program, autopilotSubsystem, dockingSubsystem);
            ScannerNetworkSubsystem  scannerSubsystem       = new ScannerNetworkSubsystem(intelSubsystem);

            SubsystemManager.AddSubsystem("autopilot", autopilotSubsystem);
            SubsystemManager.AddSubsystem("docking", dockingSubsystem);
            SubsystemManager.AddSubsystem("intel", intelSubsystem);
            SubsystemManager.AddSubsystem("combat", combatSubsystem);
            SubsystemManager.AddSubsystem("monitor", monitorSubsystem);
            SubsystemManager.AddSubsystem("indicator", indicatorSubsystem);

            undockingTaskGenerator.AddTaskGenerator(new WaypointTaskGenerator(context.Program, autopilotSubsystem));
            undockingTaskGenerator.AddTaskGenerator(new DockTaskGenerator(context.Program, autopilotSubsystem, dockingSubsystem));
            undockingTaskGenerator.AddTaskGenerator(new HornetAttackTaskGenerator(context.Program, combatSubsystem, autopilotSubsystem, agentSubsystem, monitorSubsystem, intelSubsystem));

            agentSubsystem.AddTaskGenerator(undockingTaskGenerator);
            agentSubsystem.AddTaskGenerator(new SetHomeTaskGenerator(context.Program, dockingSubsystem));

            SubsystemManager.AddSubsystem("agent", agentSubsystem);
            SubsystemManager.AddSubsystem("scanner", new ScannerNetworkSubsystem(intelSubsystem));
        }