public FlightControl(IMyShipController control, List <IMyGyro> gyros, List <IMyThrust> thrusters, Autopilot_Module autopilotModule)
 {
     this.autopilotModule = autopilotModule;
     this.control         = control;
     this.gyros           = gyros;
     this.thrusters       = thrusters;
 }
 public AutoPilot(GridTerminalSystemUtils GTS, IMyShipController controller, IngameTime time, EntityTracking_Module entityTracking)
 {
     autopilotModule = new Autopilot_Module(GTS, controller, time, entityTracking);
 }
 public AutoPilot(GridTerminalSystemUtils GTS, IMyShipController controller, IngameTime time,
                  PID_Controller.PIDSettings gyroPidSettings, PID_Controller.PIDSettings thrustPidSettings,
                  EntityTracking_Module entityTracking)
 {
     autopilotModule = new Autopilot_Module(GTS, controller, time, gyroPidSettings, thrustPidSettings, entityTracking);
 }
Beispiel #4
0
        IEnumerator <bool> Initialize()
        {
            cameras = new List <IMyCameraBlock>();
            GridTerminalSystem.GetBlocksOfType(cameras, x => x.CubeGrid == Me.CubeGrid);
            foreach (var cam in cameras)
            {
                cam.EnableRaycast = true;
            }
            yield return(true);

            gyros = new List <IMyGyro>();
            GridTerminalSystem.GetBlocksOfType(gyros, x => x.CubeGrid == Me.CubeGrid);
            yield return(true);

            antennaComms = new ACPWrapper(this, x => x.CubeGrid == Me.CubeGrid);
            yield return(true);

            thrusters = new List <IMyThrust>();
            GridTerminalSystem.GetBlocksOfType(thrusters, x => x.CubeGrid == Me.CubeGrid);
            yield return(true);

            rc = GetBlockWithNameOnGrid(RCNAME) as IMyRemoteControl;
            yield return(true);

            mainCam = GetBlockWithNameOnGrid(MAINCAM) as IMyCameraBlock;
            yield return(true);

            var GTSUtils = new GridTerminalSystemUtils(Me, GridTerminalSystem);

            ingameTime = new IngameTime();
            yield return(true);

            entityTracking = new EntityTracking_Module(GTSUtils, rc, mainCam);
            yield return(true);

            var pid = new PID_Controller.PIDSettings
            {
                PGain = 1
            };

            autopilot = new Autopilot_Module(GTSUtils, rc, ingameTime, pid, pid, entityTracking);
            yield return(true);

            flightControl = new FlightControl(rc, gyros, thrusters, autopilot);
            yield return(true);

            guidance = new TargetGuidance(rc);
            yield return(true);

            clientSystem = new MissileManagementClient(antennaComms, rc, Me.EntityId, missileType);
            yield return(true);

            turretMonitor = new TurretMonitor(this);
            turretMonitor.OnTargetDetected += OnTargetDetected;
            yield return(true);

            proximityFuse = new ProximityFuse(rc, DETONATIONDIST, this);
            proximityFuse.OnEnemyInRange += proximityFuse.Detonate;

            DebugEcho("Initialized!");
        }