Exemple #1
0
 internal void Init(QueuedAudioSystem audioSystem, ResearchControl researchControl, ResearchHacking researchHacking)
 {
     audio    = audioSystem;
     research = researchControl;
     hacking  = researchHacking;
     MyAPIGateway.Multiplayer.RegisterMessageHandler(ModId, IncomingMessage);
 }
        internal ResearchHacking(ResearchControl researchControl, HudAPIv2 hudTextApi, NetworkComms networkComms)
        {
            this.researchControl = researchControl;

            /*
             * // V1
             * hackBar.options |= HUDTextAPI.Options.HideHud;
             *          hackInterrupted.options |= HUDTextAPI.Options.HideHud;
             *          this.hudTextApi = hudTextApi;
             */

            //V2
            TextAPI = hudTextApi;

            this.networkComms = networkComms;
        }
        internal MissionSystem(int modBuildWhenLastSaved, Version gameVersion, long missionStartTimeBinary, HashSet <int> alreadyExecutedPrompts,
                               QueuedAudioSystem audioSystem, ResearchControl researchControl)
        {
            this.gameVersion           = gameVersion;
            this.audioSystem           = audioSystem;
            this.researchControl       = researchControl;
            this.modBuildWhenLastSaved = modBuildWhenLastSaved; //V27

            missionStartTime = DateTime.FromBinary(missionStartTimeBinary);
            excludedIDs      = alreadyExecutedPrompts;
            desiredEntityIDs = new HashSet <long>();
            GeneratePrompts();
            timeBasedPrompts.Sort((x, y) => - x.TriggerTime.CompareTo(y.TriggerTime));

//            ModLog.Info("Start Time = " + missionStartTime.ToString());
            ModLog.Info("Current Mission Length: " + (MyAPIGateway.Session.GameDateTime - missionStartTime).ToString(@"hh\:mm\:ss")); //V27
        }
        internal ResearchHacking(ResearchControl researchControl, HudAPIv2 hudTextApi, NetworkComms networkComms)
        {
            this.researchControl = researchControl;

            /*
             * // V1
             * hackBar.options |= HUDTextAPI.Options.HideHud;
             *          hackInterrupted.options |= HUDTextAPI.Options.HideHud;
             *          this.hudTextApi = hudTextApi;
             */

            //V2
            TextAPI = hudTextApi;

            this.networkComms = networkComms;

            ConnectionLostID = MyStringId.TryGet("ConnectionLost");

            HackInProgressID = MyStringId.TryGet("HackInProgress");
            //            string sInit = VRage.MyTexts.Get(stringIdInit).ToString() + " " + CurrentModVersion;
        }
Exemple #5
0
        protected override void InitCommon(IModSystemRegistry modSystemRegistry)
        {
            var    stringIdInit = MyStringId.TryGet("Init");
            string sInit        = VRage.MyTexts.Get(stringIdInit).ToString() + " " + CurrentModVersion;

            var    TranslationByID = MyStringId.TryGet("TranslationBy");
            string sTranslationBy  = VRage.MyTexts.Get(TranslationByID).ToString();

            if (!string.IsNullOrWhiteSpace(sTranslationBy))
            {
                sInit += "\n  " + sTranslationBy;
            }

            var    AudioByID = MyStringId.TryGet("AudioBy");
            string sAudioBy  = VRage.MyTexts.Get(AudioByID).ToString();

            if (!string.IsNullOrWhiteSpace(sAudioBy))
            {
                sInit += "\n  " + sAudioBy;
            }
            //            string sInit = "Initialising Escape From Mars build " + CurrentModVersion;

            MyAPIGateway.Utilities.ShowNotification(sInit, 5000, MyFontEnum.DarkBlue);
            ModLog.Info(sInit);
            MyLog.Default.Info("EFM Init" + sInit);

//            var gamelanguage = MySpaceTexts.ToolTipOptionsGame_Language;
            var gamelanguage = MyAPIGateway.Session.Config.Language;

            ModLog.Info("Game Language=" + gamelanguage.ToString());

            /*
             * var idString1=MyStringId.TryGet("String1");
             * var String1=VRage.MyTexts.Get(idString1);
             * ModLog.Info("idString1=" + idString1);
             * ModLog.Info("String1=" + String1);
             */

            if (MyAPIGateway.Session.IsServer)
            {
                MyVisualScriptLogicProvider.SendChatMessage(sInit, "Wicorel", 0, MyFontEnum.DarkBlue);
            }

            gameVersion = MyAPIGateway.Session.Version;
            ModLog.Info("SE Version=" + gameVersion.ToString());

            /*
             * ModLog.Info(" Major=" + gameVersion.Major.ToString());
             * ModLog.Info(" MajorRevision=" + gameVersion.MajorRevision.ToString());
             * ModLog.Info(" Minor=" + gameVersion.Minor.ToString());
             * ModLog.Info(" MinorRevision=" + gameVersion.MinorRevision.ToString());
             * ModLog.Info(" Build=" + gameVersion.Build.ToString());
             */
            /*
             * // TESTING: (they seem to be the same)
             * if (MyAPIGateway.Session.IsServer)
             *  ModLog.Info("MyAPIGateway.Session.IsServer.IsServer");
             * else
             *  ModLog.Info("MyAPIGateway.Session.NOT Server");
             * if (MyAPIGateway.Multiplayer.IsServer)
             *  ModLog.Info("MyAPIGateway.Multiplayer.IsServer");
             * else
             *  ModLog.Info("MyAPIGateway.Multiplayer.NOT Server");
             */
            bool bResearch = Session.SessionSettings.EnableResearch;

            // This works to change the setting.
            Session.SessionSettings.EnableResearch = true;

            Session.SessionSettings.EnableBountyContracts = false; // SE V1.192

            if ((gameVersion.Major == 1 && gameVersion.Minor >= 192) || gameVersion.Major > 1)
            {
                ModLog.Info("Economy items enabled");
                CargoType.AllowEconomyItems();
            }
            if ((gameVersion.Major == 1 && gameVersion.Minor >= 198) || gameVersion.Major > 1)
            {
                ModLog.Info("Warefare1 items enabled");
                CargoType.AllowWarefare1Items();
            }
            if ((gameVersion.Major == 1 && gameVersion.Minor >= 200) || gameVersion.Major > 1)
            {
                ModLog.Info("Warefare2 items enabled");
                CargoType.AllowWarefare2Items();
            }

            if (!bResearch)
            {
//                MyAPIGateway.Utilities.ShowNotification("Save, then Exit. Edit world /Advanced settings and Enable progression", 50000, MyFontEnum.Red);
                ModLog.Info("Research was not turned on");
            }
            TextAPI = new HudAPIv2();
//            if (modBuildWhenGameStarted > 4) V37
            {
                DuckUtils.PutPlayerIntoFaction("CRASH");
            }
            researchControl = new ResearchControl(audioSystem);
            researchControl.InitResearchRestrictions();
            researchHacking = new ResearchHacking(researchControl, TextAPI, networkComms);
            networkComms.Init(audioSystem, researchControl, researchHacking);
            modSystemRegistry.AddCloseableModSystem(networkComms);
            modSystemRegistry.AddUpatableModSystem(audioSystem);

            MyAPIGateway.Utilities.MessageEntered += MessageEntered;
        }
Exemple #6
0
        protected override void InitCommon(IModSystemRegistry modSystemRegistry)
        {
            string sInit = "Initialising Escape From Mars build " + CurrentModVersion;

            MyAPIGateway.Utilities.ShowNotification(sInit, 5000, MyFontEnum.DarkBlue);
            ModLog.Info(sInit);

            if (MyAPIGateway.Session.IsServer)
            {
                MyVisualScriptLogicProvider.SendChatMessage(sInit, "Wicorel", 0, MyFontEnum.DarkBlue);
            }

            gameVersion = MyAPIGateway.Session.Version;
            ModLog.Info("SE Version=" + gameVersion.ToString());

            /*
             * ModLog.Info(" Major=" + gameVersion.Major.ToString());
             * ModLog.Info(" MajorRevision=" + gameVersion.MajorRevision.ToString());
             * ModLog.Info(" Minor=" + gameVersion.Minor.ToString());
             * ModLog.Info(" MinorRevision=" + gameVersion.MinorRevision.ToString());
             * ModLog.Info(" Build=" + gameVersion.Build.ToString());
             */
            /*
             * // TESTING: (they seem to be the same)
             * if (MyAPIGateway.Session.IsServer)
             *  ModLog.Info("MyAPIGateway.Session.IsServer.IsServer");
             * else
             *  ModLog.Info("MyAPIGateway.Session.NOT Server");
             * if (MyAPIGateway.Multiplayer.IsServer)
             *  ModLog.Info("MyAPIGateway.Multiplayer.IsServer");
             * else
             *  ModLog.Info("MyAPIGateway.Multiplayer.NOT Server");
             */
            bool bResearch = Session.SessionSettings.EnableResearch;

            // This works to change the setting.
            Session.SessionSettings.EnableResearch = true;

            Session.SessionSettings.EnableBountyContracts = false; // SE V1.192

            if ((gameVersion.Major == 1 && gameVersion.Minor >= 192) || gameVersion.Major > 1)
            {
                ModLog.Info("Economy items enabled");
                CargoType.AllowEconomyItems();
            }

            if (!bResearch)
            {
//                MyAPIGateway.Utilities.ShowNotification("Save, then Exit. Edit world /Advanced settings and Enable progression", 50000, MyFontEnum.Red);
                ModLog.Info("Research was not turned on");
            }
            TextAPI = new HudAPIv2();
            if (modBuildWhenGameStarted > 4)
            {
                DuckUtils.PutPlayerIntoFaction("CRASH");
            }
            researchControl = new ResearchControl(audioSystem);
            researchControl.InitResearchRestrictions();
            researchHacking = new ResearchHacking(researchControl, TextAPI, networkComms);
            networkComms.Init(audioSystem, researchControl, researchHacking);
            modSystemRegistry.AddCloseableModSystem(networkComms);
            modSystemRegistry.AddUpatableModSystem(audioSystem);

            MyAPIGateway.Utilities.MessageEntered += MessageEntered;
        }