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); }
public ITask GenerateTask(TaskType type, MyTuple <IntelItemType, long> intelKey, Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence> IntelItems, TimeSpan canonicalTime, long myID) { if (type != TaskType.Mine) { return(new NullTask()); } if (!IntelItems.ContainsKey(intelKey)) { return(new NullTask()); } if (intelKey.Item1 != IntelItemType.Waypoint) { return(new NullTask()); } var target = (Waypoint)IntelItems[intelKey]; // Make sure we actually have the asteroid we are supposed to be mining AsteroidIntel host = null; foreach (var kvp in IntelItems) { if (kvp.Key.Item1 != IntelItemType.Asteroid) { continue; } var dist = (kvp.Value.GetPositionFromCanonicalTime(canonicalTime) - target.GetPositionFromCanonicalTime(canonicalTime)).Length(); if (dist > kvp.Value.Radius) { continue; } host = (AsteroidIntel)kvp.Value; break; } if (host == null) { return(new NullTask()); } Task = new HoneybeeMiningTask(Program, MiningSystem, Autopilot, AgentSubsystem, target, host, IntelProvider, MonitorSubsystem, DockingSubsystem, DockTaskGenerator, UndockTaskGenerator); return(Task); }