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);
            }
Example #2
0
            public Displays(Program program, WicoBlockMaster wicoBlockMaster, WicoElapsedTime wicoElapsedTime)
            {
                _program         = program;
                _wicoBlockMaster = wicoBlockMaster;
                _wicoElapsedTime = wicoElapsedTime;

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

                _program.AddPostInitHandler(PostInitHandler());

                _wicoElapsedTime.AddTimer(DisplayCheckTimer, DisplayInterval, ElapsedTimerHandler);
                _wicoElapsedTime.StartTimer(DisplayCheckTimer);
            }
Example #3
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!");
            }
        }