public void Reset(WaypointTask holdTask, WaypointTask approachTask, WaypointTask enterTask, WaypointTask closeTask, DockTask dockTask, MyTuple <IntelItemType, long> intelKey, MyGridProgram program, MyCubeSize dockSize, IMyTerminalBlock connector, IMyTerminalBlock indicator = null) { Reset(); if (indicator != null) { Indicator = indicator; Connector = connector; } EnterHoldingPattern = holdTask; WaitForClearance = new WaitTask(); ApproachEntrance = approachTask; ApproachDock = enterTask; FinalAdjustToDock = closeTask; DockTask = dockTask; IntelKey = intelKey; DockSize = dockSize; Program = program; closeTask.Destination.MaxSpeed = 0.5f; enterTask.Destination.MaxSpeed = 5; TaskQueue.Enqueue(EnterHoldingPattern); TaskQueue.Enqueue(WaitForClearance); TaskQueue.Enqueue(ApproachEntrance); TaskQueue.Enqueue(ApproachDock); TaskQueue.Enqueue(FinalAdjustToDock); TaskQueue.Enqueue(DockTask); }
public LocustAttackTask(MyGridProgram program, LocustCombatSystem combatSystem, IAutopilot autopilot, IAgentSubsystem agentSubsystem, MyTuple <IntelItemType, long> intelKey) { Program = program; CombatSystem = combatSystem; Autopilot = autopilot; AgentSubsystem = agentSubsystem; IntelKey = intelKey; Status = TaskStatus.Incomplete; LeadTask = new WaypointTask(Program, Autopilot, new Waypoint(), WaypointTask.AvoidObstacleMode.Avoid); }
// 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 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 DockTaskGenerator(MyGridProgram program, IAutopilot autopilot, IDockingSubsystem ds) { Program = program; Autopilot = autopilot; DockingSubsystem = ds; holdTask = new WaypointTask(Program, Autopilot, new Waypoint(), WaypointTask.AvoidObstacleMode.Avoid, DockingSubsystem.Connector); approachTask = new WaypointTask(Program, Autopilot, new Waypoint(), WaypointTask.AvoidObstacleMode.SmartEnter, DockingSubsystem.Connector); enterTask = new WaypointTask(Program, Autopilot, new Waypoint(), WaypointTask.AvoidObstacleMode.DoNotAvoid, DockingSubsystem.Connector); closeTask = new WaypointTask(Program, Autopilot, new Waypoint(), WaypointTask.AvoidObstacleMode.DoNotAvoid, DockingSubsystem.Connector); dockTask = new DockTask(DockingSubsystem); Task = new MoveToAndDockTask(); Task.Reset(holdTask, approachTask, enterTask, closeTask, dockTask, MyTuple.Create(IntelItemType.NONE, (long)1234), Program, MyCubeSize.Small, DockingSubsystem.Connector, DockingSubsystem.DirectionIndicator); Task.Do(new Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence>(), TimeSpan.FromSeconds(1), null); dockTask.Do(new Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence>(), TimeSpan.Zero, null); holdTask.Do(new Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence>(), TimeSpan.Zero, null); new WaitTask().Do(new Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence>(), TimeSpan.Zero, null); }