public Program()
        {
            doModuleConstructor();

            INIHolder iniCustomData = new INIHolder(this, Me.CustomData);

            WorldInitCustomData(iniCustomData);
            GridsInitCustomData(iniCustomData);
            LoggingInitCustomData(iniCustomData);

            ModuleInitCustomData(iniCustomData);
            if (iniCustomData.IsDirty)
            {
                Me.CustomData = iniCustomData.GenerateINI(true);
            }

            sBanner = OurName + ":" + moduleName + " V" + sVersion + " ";
            Echo(sBanner + "Creator");

            initLogging();
            StatusLog("clear", textLongStatus, true);  // only MAIN module should clear long status on init.
            if (!doSubModuleTimerTriggers(sMainTimer)) // try to trigger MAIN timer in case it stopped.
            {
                // if no main timer, then use UpdateFrequency
                Runtime.UpdateFrequency |= UpdateFrequency.Update100;
            }
            //	if (!Me.CustomName.Contains(moduleName))
            //		Me.CustomName = "PB " + OurName+ " "+moduleName;
            if (!Me.Enabled)
            {
                Echo("I am turned OFF!");
            }
        }
        void ProcessInitCustomData()
        {
            INIHolder iniCustomData = new INIHolder(this, Me.CustomData);

            WorldInitCustomData(iniCustomData);
            GridsInitCustomData(iniCustomData);
            LoggingInitCustomData(iniCustomData);

            ModuleInitCustomData(iniCustomData);
            if (iniCustomData.IsDirty)
            {
                Me.CustomData = iniCustomData.GenerateINI(true);
            }
        }
        void ProcessInitCustomData(bool bForceWrite = false)
        {
            INIHolder iniCustomData = new INIHolder(this, Me.CustomData);

            iniCustomData.GetValue(sMainSection, "EchoOn", ref bEchoOn, true);
            iniCustomData.GetValue(sMainSection, "DebugUpdate", ref bDebugUpdate, true);

            WorldInitCustomData(iniCustomData);
            GridsInitCustomData(iniCustomData);
            LoggingInitCustomData(iniCustomData);
            TimersInitCustomData(iniCustomData);

            ModuleInitCustomData(iniCustomData);
            if (iniCustomData.IsDirty || bForceWrite)
            {
                Me.CustomData = iniCustomData.GenerateINI(true);
            }
        }
        void MinerCalculateBoreSize()
        {
            if (MiningBoreHeight <= 0)
            {
                MiningBoreHeight = (shipDim.HeightInMeters());
                MiningBoreWidth  = (shipDim.WidthInMeters());
//                MiningBoreHeight = (shipDim.HeightInMeters() - shipDim.BlockMultiplier() * 2);
//                MiningBoreWidth = (shipDim.WidthInMeters() - shipDim.BlockMultiplier() * 2);

                // save defaults back to customdata to allow player to change
                INIHolder iniCustomData = new INIHolder(this, Me.CustomData);
                iniCustomData.SetValue(sMiningSection, "MiningBoreHeight", MiningBoreHeight.ToString("0.00"));
                iniCustomData.SetValue(sMiningSection, "MiningBoreWidth", MiningBoreWidth.ToString("0.00"));
                // informational for the player
                iniCustomData.SetValue(sMiningSection, "ShipWidth", shipDim.WidthInMeters().ToString("0.00"));
                iniCustomData.SetValue(sMiningSection, "ShipHeight", shipDim.HeightInMeters().ToString("0.00"));

                Me.CustomData = iniCustomData.GenerateINI(true);
            }
        }
Example #5
0
        void initCustomData()
        {
            INIHolder iniCustomData = new INIHolder(this, Me.CustomData);

            string sValue = "";

            iniCustomData.GetValue(sTechnikerSection, "DoForwardScans", ref bDoForwardScans, true);
            iniCustomData.GetValue(sTechnikerSection, "CheckGasGens", ref bCheckGasGens, true);
            iniCustomData.GetValue(sTechnikerSection, "TechnikerCalcs", ref bTechnikerCalcs, true);
            iniCustomData.GetValue(sTechnikerSection, "GPSFromEntities", ref bGPSFromEntities, true);
            iniCustomData.GetValue(sTechnikerSection, "AirVents", ref bAirVents, true);

//            iniCustomData.GetValue(sTechnikerSection, "thrustignore", ref sIgnoreThruster, true);
            if (iniCustomData.GetValue(sTechnikerSection, "shipname", ref sValue))
            {
                OurName         = "Wico " + sValue;
                bGotAntennaName = true;
            }

            iniCustomData.GetValue(sTechnikerSection, "shortrangemax", ref shortRangeMax, true);
            iniCustomData.GetValue(sTechnikerSection, "longrangemax", ref longRangeMax, true);

            ThrustersInitCustomData(iniCustomData);
            SensorInitCustomData(iniCustomData);

            if (iniCustomData.IsDirty)
            {
                Me.CustomData = iniCustomData.GenerateINI(true);
            }

            if (bLongRange)
            {
                maxScan = longRangeMax;
            }
            else
            {
                maxScan = shortRangeMax;
            }
        }
Example #6
0
        public Program()
        {
            doModuleConstructor();

            INIHolder iniCustomData = new INIHolder(this, Me.CustomData);

            iniCustomData.GetValue(sMainSection, "EchoOn", ref bEchoOn, true);
            iniCustomData.GetValue(sMainSection, "DebugUpdate", ref bDebugUpdate, true);
            iniCustomData.GetValue(sMainSection, "SubModules", ref bSupportSubModules, true);
            iniCustomData.GetValue(sMainSection, "SubmoduleTriggerWait", ref dSubmoduleTriggerWait, true);

            _oldEcho = Echo;
            Echo     = MyEcho;

            WorldInitCustomData(iniCustomData);
            GridsInitCustomData(iniCustomData);
            LoggingInitCustomData(iniCustomData);
            TimersInitCustomData(iniCustomData);

            ModuleInitCustomData(iniCustomData);
            if (iniCustomData.IsDirty)
            {
                Me.CustomData = iniCustomData.GenerateINI(true);
            }

            sBanner = OurName + ":" + moduleName + " V" + sVersion + " ";
            _oldEcho(sBanner + "Creator");

            initLogging();
            StatusLog("clear", textLongStatus, true);  // only MAIN module should clear long status on init.
            if (!doSubModuleTimerTriggers(sMainTimer)) // try to trigger MAIN timer in case it stopped.
            {
                // if no main timer, then use UpdateFrequency
                Runtime.UpdateFrequency |= UpdateFrequency.Update100;
            }
            //	if (!Me.CustomName.Contains(moduleName))
            //		Me.CustomName = "PB " + OurName+ " "+moduleName;
            if (!Me.Enabled)
            {
                Echo("I am turned OFF!");
            }

            IMyTextSurface mesurface0 = Me.GetSurface(0);

            mesurface0.ContentType = VRage.Game.GUI.TextPanel.ContentType.TEXT_AND_IMAGE;
            mesurface0.WriteText("Wicorel\n" + moduleName);
            mesurface0.FontSize  = 2;
            mesurface0.Alignment = VRage.Game.GUI.TextPanel.TextAlignment.CENTER;

            IMyTextSurface 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;

            /*
             * using (var frame = mesurface0.DrawFrame())
             * {
             *  MySprite sprite;
             *  // Background
             *  //                sprite = new MySprite(SpriteType.TEXTURE, "SquareSimple", color: new Color(50, 150, 255, 255), size: SIZE);
             *  //                sprite.Position = surfaceSize * 0.5f + POS;
             *  sprite = MySprite.CreateText("Wicorel", "Monospace", Color.Red, 1f, TextAlignment.LEFT);
             *  sprite.Position = new Vector2(16, 16);
             *  frame.Add(sprite);
             * }
             */

            /*
             * using (var frame = mesurface1.DrawFrame())
             * {
             *  MySprite sprite;
             *
             *  // Background
             *  //                sprite = new MySprite(SpriteType.TEXTURE, "SquareSimple", color: new Color(50, 150, 255, 255), size: SIZE);
             *  //                sprite.Position = surfaceSize * 0.5f + POS;
             *  sprite = MySprite.CreateText(moduleName, "Monospace", Color.Red, 1f, TextAlignment.LEFT);
             *  sprite.Position = new Vector2(16, 16);
             *  frame.Add(sprite);
             * }
             */
        }