Exemple #1
0
            public ScansMode(Program program, WicoControl wicoControl, WicoBlockMaster wicoBlockMaster,
                             WicoIGC igc, Cameras cameras, Asteroids asteroids
                             ) : base(program, wicoControl)
            {
                _program         = program;
                _wicoControl     = wicoControl;
                _wicoBlockMaster = wicoBlockMaster;
                _wicoIGC         = igc;
                _cameras         = cameras;
                _asteroids       = asteroids;

                _program.moduleName += " Scans";
                _program.moduleList += "\nScans V4.1";

//                _program._CustomDataIni.Get(sNavSection, "NAVEmulateOld").ToBoolean(NAVEmulateOld);
//                _program._CustomDataIni.Set(sNavSection, "NAVEmulateOld", NAVEmulateOld);

                _program.AddUpdateHandler(UpdateHandler);
                _program.AddTriggerHandler(ProcessTrigger);

                _program.AddLoadHandler(LoadHandler);
                _program.AddSaveHandler(SaveHandler);

                _wicoControl.AddModeInitHandler(ModeInitHandler);
                _wicoControl.AddControlChangeHandler(ModeChangeHandler);
                _wicoBlockMaster.AddLocalBlockChangedHandler(LocalGridChangedHandler);

                _wicoIGC.AddPublicHandler(NavCommon.WICOB_NAVADDTARGET, BroadcastHandler);
                _wicoIGC.AddPublicHandler(NavCommon.WICOB_NAVRESET, BroadcastHandler);
                _wicoIGC.AddPublicHandler(NavCommon.WICOB_NAVSTART, BroadcastHandler);
            }
        public Program()
        {
            _wicoIGC = new WicoIGC(this);

            // cause ourselves to run again so we can do the init
            Runtime.UpdateFrequency = UpdateFrequency.Once;
        }
            public BaseConnectors(Program program, WicoBlockMaster wbm, WicoIGC wicoIGC, WicoElapsedTime wicoElapsedTime)
            {
                _program         = program;
                _wicoBlockMaster = wbm;
                _wicoIGC         = wicoIGC;
                _wicoElapsedTime = wicoElapsedTime;

                _program.moduleName += " Base Connectors";
                _program.moduleList += "\nBase Connectors V4.0";

                _program.AddUpdateHandler(UpdateHandler);
                _program.AddTriggerHandler(ProcessTrigger);
                _program.AddLoadHandler(LoadHandler);
                _program.AddSaveHandler(SaveHandler);
                _program.AddPostInitHandler(PostInitHandler);
//                _program.AddResetMotionHandler(ResetMotionHandler);

                _wicoBlockMaster.AddLocalBlockChangedHandler(LocalGridChangedHandler);
                _wicoBlockMaster.AddLocalBlockHandler(BlockParseHandler);

//                _program._CustomDataIni.Get(sBaseSection, "BaseTransmitWait").ToDouble(dBaseTransmitWait);
//                _program._CustomDataIni.Set(sBaseSection, "BaseTransmitWait", dBaseTransmitWait);

                _wicoIGC.AddPublicHandler("BASE?", BroadcastHandler);
                _wicoIGC.AddPublicHandler("CON?", BroadcastHandler);
                _wicoIGC.AddPublicHandler("COND?", BroadcastHandler);

                // wicoControl.AddModeInitHandler(ModeInitHandler);
                // wicoControl.AddControlChangeHandler(ModeChangeHandler);

                _wicoElapsedTime.AddTimer(_BaseTransmit, 55, BaseTransmitTimerHandler);
                _wicoElapsedTime.StartTimer(_BaseTransmit);
            }
        public Program()
        {
            MyIniParseResult result;

            if (!_CustomDataIni.TryParse(Me.CustomData, out result))
            {
                Me.CustomData = "";
                _CustomDataIni.Clear();
                Echo(result.ToString());
                //throw new Exception(result.ToString());
            }
            if (!_SaveIni.TryParse(Storage, out result))
            {
                Storage = "";
                _SaveIni.Clear();
                Echo(result.ToString());
                //                throw new Exception(result.ToString());
            }

            wicoIGC         = new WicoIGC(this);         // Must be first as some use it in constructor
            wicoBlockMaster = new WicoBlockMaster(this); // must be before any other block-oriented modules
            wicoControl     = new WicoControl(this);

            ModuleProgramInit();

            Runtime.UpdateFrequency |= UpdateFrequency.Once; // cause ourselves to run again to continue initialization

            // Local PB Surface Init
            if (Me.SurfaceCount > 1)
            {
                mesurface0             = Me.GetSurface(0);
                mesurface0.ContentType = VRage.Game.GUI.TextPanel.ContentType.TEXT_AND_IMAGE;
                mesurface0.WriteText(OurName + sVersion + moduleList);
                mesurface0.FontSize  = 2;
                mesurface0.Alignment = VRage.Game.GUI.TextPanel.TextAlignment.CENTER;
            }

            if (Me.SurfaceCount > 2)
            {
                mesurface1             = Me.GetSurface(1);
                mesurface1.ContentType = VRage.Game.GUI.TextPanel.ContentType.TEXT_AND_IMAGE;
                mesurface1.WriteText("Version: " + sVersion);
                mesurface1.Alignment   = VRage.Game.GUI.TextPanel.TextAlignment.CENTER;
                mesurface1.TextPadding = 0.25f;
                mesurface1.FontSize    = 3.5f;
            }

            if (!Me.CustomName.Contains(moduleName))
            {
                Me.CustomName = "PB" + moduleName;
            }

            if (!Me.Enabled)
            {
                Echo("I am turned OFF!");
            }
        }
Exemple #5
0
            public WicoBases(Program program, WicoIGC iGC)
            {
                _thisProgram = program;
                _wicoIGC     = iGC;
                _thisProgram.AddLoadHandler(LoadHandler);
                _thisProgram.AddSaveHandler(SaveHandler);

                _wicoIGC.AddPublicHandler(sIGCBaseAnnounceTag, BaseBroadcastHandler);
            }
            public Asteroids(Program program, WicoControl wicoControl, WicoIGC wicoIGC, Displays displays)
            {
                _program     = program;
                _wicoControl = wicoControl;
                _wicoIGC     = wicoIGC;
                _displays    = displays;

                _program.AddLoadHandler(LoadHandler);
                _program.AddSaveHandler(SaveHandler);
                _wicoIGC.AddPublicHandler(sAsteroidTag, BroadcastHandler);

                _displays.AddSurfaceHandler("ASTEROIDS", SurfaceHandler);
            }
Exemple #7
0
            public WicoBases(Program program, WicoIGC iGC, Displays displays)
            {
                _program  = program;
                _wicoIGC  = iGC;
                _displays = displays;

                _program.AddLoadHandler(LoadHandler);
                _program.AddSaveHandler(SaveHandler);

                _displays.AddSurfaceHandler("BASELOCS", SurfaceHandler);


                _wicoIGC.AddPublicHandler(sIGCBaseAnnounceTag, BaseBroadcastHandler);
            }
Exemple #8
0
            public Ores(Program program, WicoBlockMaster wbm, WicoControl wicoControl, WicoIGC wicoIGC, Asteroids asteroids, Displays displays) : base(program, wbm, null)
            {
                _program         = program;
                _wicoBlockMaster = wbm;
                _wicoControl     = wicoControl;
                _wicoIGC         = wicoIGC;
                _asteroids       = asteroids;
                _displays        = displays;

                _program.AddLoadHandler(LoadHandler);
                _program.AddSaveHandler(SaveHandler);
                _wicoIGC.AddPublicHandler(sOreTag, BroadcastHandler);

                if (_displays != null)
                {
                    _displays.AddSurfaceHandler("ORELOCS", SurfaceHandler);
                }
            }
Exemple #9
0
        public Program()
        {
            if (Me.TerminalRunArgument == "--clear")
            {
                Me.CustomData = "";
                Storage       = "";
            }
            MyIniParseResult result;

            if (!_CustomDataIni.TryParse(Me.CustomData, out result))
            {
                Me.CustomData = "";
                _CustomDataIni.Clear();
                Echo(result.ToString());
            }
            if (!_SaveIni.TryParse(Storage, out result))
            {
                Storage = "";
                _SaveIni.Clear();
                Echo(result.ToString());
            }
            long meentityid = 0;

            _SaveIni.Get(OurName + sVersion, "MEENITYID").TryGetInt64(out meentityid);
            if (meentityid != Me.EntityId)
            { // what's in storage was not created by this blueprint; clear it out.
                ErrorLog("New instance:Resetting Storage");
                Storage = "";
                _SaveIni.Clear();
            }
            _SaveIni.Set(OurName + sVersion, "MEENITYID", Me.EntityId);

            wicoIGC         = new WicoIGC(this);         // Must be first as some use it in constructor
            wicoBlockMaster = new WicoBlockMaster(this); // must be before any other block-oriented modules
            ModuleControlInit();

            wicoElapsedTime = new WicoElapsedTime(this, _wicoControl);

            ModuleProgramInit();

            Runtime.UpdateFrequency |= UpdateFrequency.Once; // cause ourselves to run again to continue initialization

            // Local PB Surface Init
            if (Me.SurfaceCount > 1)
            {
                mesurface0             = Me.GetSurface(0);
                mesurface0.ContentType = VRage.Game.GUI.TextPanel.ContentType.TEXT_AND_IMAGE;
                mesurface0.WriteText(OurName + sVersion + moduleList);
                mesurface0.FontSize  = 2;
                mesurface0.Alignment = VRage.Game.GUI.TextPanel.TextAlignment.CENTER;
            }

            if (Me.SurfaceCount > 2)
            {
                mesurface1             = Me.GetSurface(1);
                mesurface1.ContentType = VRage.Game.GUI.TextPanel.ContentType.TEXT_AND_IMAGE;
                mesurface1.WriteText("Version: " + sVersion);
                mesurface1.Alignment   = VRage.Game.GUI.TextPanel.TextAlignment.CENTER;
                mesurface1.TextPadding = 0.25f;
                mesurface1.FontSize    = 3.5f;
            }

            if (!Me.CustomName.Contains(moduleName))
            {
                Me.CustomName = "PB" + moduleName;
            }

            if (!Me.Enabled)
            {
                Echo("I am turned OFF!");
            }
        }
Exemple #10
0
        public Program()
        {
            MyIniParseResult result;

            if (!_CustomDataIni.TryParse(Me.CustomData, out result))
            {
                Me.CustomData = "";
                _CustomDataIni.Clear();
                Echo(result.ToString());
                //throw new Exception(result.ToString());
            }
            if (!_SaveIni.TryParse(Storage, out result))
            {
                Storage = "";
                _SaveIni.Clear();
                Echo(result.ToString());
                //                throw new Exception(result.ToString());
            }

            wicoIGC         = new WicoIGC(this);         // Must be first as some use it in constructor
            wicoBlockMaster = new WicoBlockMaster(this); // must be before any other block-oriented modules
            wicoControl     = new WicoControl(this);

//            wicoTravelMovement = new TravelMovement(this);

            wicoThrusters    = new WicoThrusters(this);
            wicoGyros        = new WicoGyros(this, null);
            wicoGasTanks     = new GasTanks(this);
            wicoGasGens      = new GasGens(this);
            wicoConnectors   = new Connectors(this);
            wicoLandingGears = new LandingGears(this);
            wicoCameras      = new Cameras(this);
            wicoParachutes   = new Parachutes(this);
            wicoNavRotors    = new NavRotors(this);
            wicoAntennas     = new Antennas(this);
            wicoSensors      = new Sensors(this, wicoBlockMaster.GetMainController());
            wicoWheels       = new Wheels(this);

            wicoOrbitalLaunch = new OrbitalModes(this);
//            wicoNavigation = new Navigation(this, wicoBlockMaster.GetMainController());

            Runtime.UpdateFrequency |= UpdateFrequency.Once; // cause ourselves to run again to continue initialization

            // Local PB Surface Init
            mesurface0             = Me.GetSurface(0);
            mesurface1             = Me.GetSurface(1);
            mesurface0.ContentType = VRage.Game.GUI.TextPanel.ContentType.TEXT_AND_IMAGE;
            mesurface0.WriteText("Wicorel Modular");
            mesurface0.FontSize  = 2;
            mesurface0.Alignment = VRage.Game.GUI.TextPanel.TextAlignment.CENTER;

            mesurface1.ContentType = VRage.Game.GUI.TextPanel.ContentType.TEXT_AND_IMAGE;
            mesurface1.WriteText("Version: 1");
            mesurface1.Alignment   = VRage.Game.GUI.TextPanel.TextAlignment.CENTER;
            mesurface1.TextPadding = 0.25f;
            mesurface1.FontSize    = 3.5f;

            if (!Me.Enabled)
            {
                Echo("I am turned OFF!");
            }
        }