Exemple #1
0
        public override void LoadPreviousGame(SaveData saveData)
        {
            networkComms.RegisteredPlayers = saveData.RegisteredPlayers;
            heatSystem.HeatLevel           = saveData.HeatLevel;
            researchControl.UnlockedTechs  = saveData.UnlockedTechs;
            npcGroupManager.LoadSaveData(saveData.NpcGroupSaveDatas);
            convoySpawner.RestoreSpawnTimeFromSave(saveData.NextSpawnTime);
            researchHacking.RestoreSaveData(saveData.HackingData);
            modBuildWhenGameStarted = saveData.BuildWhenGameStarted;
            baseManager.LoadSaveData(saveData.GCorpBaseSaveDatas);
            mikiScrapManager.LoadSaveData(saveData.MikiScrapSaveDatas);

            //V26
            modBuildWhenLastSaved = saveData.BuildWhenSaved;

            heatSystem.HeatDifficulty = saveData.HeatDifficultySetting;
            if (heatSystem.HeatDifficulty < 1)
            {
                heatSystem.HeatDifficulty = 1;
            }
            if (heatSystem.HeatDifficulty > 3)
            {
                GCorpBase.SetFastBackupDelay();
            }
            else
            {
                GCorpBase.SetNormalBackupDelay();
            }

            heatSystem.MultiplayerScaling = saveData.MultiplayerScaling;

            // Move to the end so other saved info is already loadedf
            missionSystem = new MissionSystem(modBuildWhenLastSaved, gameVersion, saveData.MissionStartTimeBinary, saveData.ExcludedMissionPrompts,
                                              audioSystem, researchControl);
        }
Exemple #2
0
        private void MessageEntered(string msg, ref bool visible)
        {
            if (msg.Equals("/efm", StringComparison.InvariantCultureIgnoreCase))
            {
                MyAPIGateway.Utilities.ShowMessage("EFM", "Valid Commands \n/efm heat\n/efm difficulty #");
                visible = false;
                return;
            }
            if (!msg.StartsWith("/efm", StringComparison.InvariantCultureIgnoreCase))
            {
                return;
            }
            visible = false;
            string[] args = msg.Split(' ');
            if (args.Length <= 1)
            {
                MyAPIGateway.Utilities.ShowMessage("EFM", "Valid Commands \n/efm heat\n/efm difficulty #\n/efm scale [true|false]");
                return;
            }
            if (args[1].ToLower() == "heat")
            {
                if (args.Length > 2)
                {
                    int  iParam = 0;
                    bool bOk    = int.TryParse(args[2], out iParam);

                    if (bOk && iParam >= 0)
                    {
                        heatSystem.HeatLevel += iParam;
                    }
                }
                string sHeat = "EFM\n Heat=" + heatSystem.HeatLevel.ToString()
                               + "\n Difficulty=" + heatSystem.HeatDifficulty.ToString()
                               + "\n MultiplayerScaling=" + heatSystem.MultiplayerScaling.ToString()
                ;

                MyVisualScriptLogicProvider.SendChatMessage(sHeat, "Wicorel", 0, MyFontEnum.DarkBlue);
            }
            if (args[1].ToLower() == "difficulty")
            {
                if (args.Length < 3)
                {
                    MyVisualScriptLogicProvider.SendChatMessage("syntax: /efm difficulty #", "Wicorel", 0, MyFontEnum.DarkBlue);
                    visible = true;
                    return;
                }
                int  iParam = 0;
                bool bOk    = int.TryParse(args[2], out iParam);

                if (bOk && iParam >= 0)
                {
                    heatSystem.HeatDifficulty = iParam;
                    MyVisualScriptLogicProvider.SendChatMessage("Difficulty set to " + heatSystem.HeatDifficulty.ToString(), "Wicorel", 0, MyFontEnum.DarkBlue);
                    if (heatSystem.HeatDifficulty > 3)
                    {
                        GCorpBase.SetFastBackupDelay();
                    }
                    else
                    {
                        GCorpBase.SetNormalBackupDelay();
                    }
                }
                else
                {
                    MyVisualScriptLogicProvider.SendChatMessage("syntax: /efm difficulty #", "Wicorel", 0, MyFontEnum.DarkBlue);
                }
            }
            if (args[1].ToLower() == "scale")
            {
                if (args.Length < 3)
                {
                    MyVisualScriptLogicProvider.SendChatMessage("syntax: /efm scale [true|false]", "Wicorel", 0, MyFontEnum.DarkBlue);
                    visible = true;
                    return;
                }
                bool bParam = false;
                bool bOk    = bool.TryParse(args[2], out bParam);

                if (bOk)
                {
                    heatSystem.MultiplayerScaling = bParam;
                    MyVisualScriptLogicProvider.SendChatMessage("MultiplayerScaling set to " + heatSystem.MultiplayerScaling.ToString(), "Wicorel", 0, MyFontEnum.DarkBlue);
                }
                else
                {
                    MyVisualScriptLogicProvider.SendChatMessage("syntax: /efm scale [true|false]", "Wicorel", 0, MyFontEnum.DarkBlue);
                }
            }
            if (args[1].ToLower() == "convoy")
            {
                string sMsg = npcGroupManager.NpcGroupInfo(NpcGroupType.Convoy);
                MyVisualScriptLogicProvider.SendChatMessage(sMsg, "Wicorel", 0, MyFontEnum.DarkBlue);
            }
            if (args[1].ToLower() == "backup")
            {
                string sMsg = npcGroupManager.NpcGroupInfo(NpcGroupType.Backup);
                MyVisualScriptLogicProvider.SendChatMessage(sMsg, "Wicorel", 0, MyFontEnum.DarkBlue);
            }
            if (args[1].ToLower() == "base")
            {
                string sMsg = baseManager.BaseInfo();
                MyVisualScriptLogicProvider.SendChatMessage(sMsg, "Wicorel", 0, MyFontEnum.DarkBlue);
            }
            if (args[1].ToLower() == "players")
            {
                var players = new List <IMyPlayer>();
                MyAPIGateway.Players.GetPlayers(players);
                string sMsg = "#Players=" + players.Count;
                MyVisualScriptLogicProvider.SendChatMessage(sMsg, "Wicorel", 0, MyFontEnum.DarkBlue);
                foreach (var player in players)
                {
                    sMsg = " " + player.DisplayName;
                    var ident = player.Identity;
                    //ident.IdentityId;
                    var chara = player.Character;
                    if (chara != null)
                    {
                        bool bUnderCover = DuckUtils.IsPlayerUnderCover(player);
                        if (bUnderCover)
                        {
                            sMsg += " IS under cover\n";
                        }
                        bool bIsUnderground = DuckUtils.IsPlayerUnderground(player);
                        if (bIsUnderground)
                        {
                            sMsg += " IS underground\n";
                        }
                        float health        = chara.Integrity;
                        bool  isDead        = chara.IsDead;
                        float EnergyLevel   = chara.SuitEnergyLevel;
                        float physicalMass  = chara.CurrentMass;
                        bool  thrustEnabled = chara.EnabledThrusts;
                        float hLevel        = chara.GetSuitGasFillLevel(hydrogenDefId);
                        float o2Level       = chara.GetSuitGasFillLevel(oxygenDefId);
                        sMsg += " H=" + health.ToString("0.00") + " E=" + EnergyLevel.ToString("0.00");
                        sMsg += "\n Mass=" + physicalMass.ToString("0.00") + " Thrust=" + thrustEnabled.ToString();
                        sMsg += "\n H=" + hLevel.ToString("0.00") + " O2=" + o2Level.ToString("0.00");
                    }
                    else
                    {
                        sMsg += " No character loaded yet";
                    }
                    MyVisualScriptLogicProvider.SendChatMessage(sMsg, "Wicorel", 0, MyFontEnum.DarkBlue);
                }
            }
        }