Ejemplo n.º 1
0
 private static void OnCraftEndPrefix(EnergyMixin __instance, TechType techType)
 {
     if (!Config.NORMAL.Equals(DeathRun.config.batteryCosts) && !GameModeUtils.IsOptionActive(GameModeOption.Creative))
     {
         if (techType != TechType.MapRoomCamera)
         {
             __instance.defaultBattery = 0;
         }
     }
 }
Ejemplo n.º 2
0
        public void Update()
        {
            time += Time.deltaTime;

            // Only do on a specific cadence to avoid hammering server
            if (time >= INTERPOLATION_PERIOD)
            {
                time = 0;

                Survival survival = Player.main.GetComponent <Survival>();

                if (survival != null && !survival.freezeStats && GameModeUtils.IsOptionActive(GameModeOption.Survival))
                {
                    float oxygen    = Player.main.oxygenMgr.GetOxygenAvailable();
                    float maxOxygen = Player.main.oxygenMgr.GetOxygenCapacity();
                    float health    = Player.main.liveMixin.health;
                    float food      = survival.food;
                    float water     = survival.water;

                    Multiplayer.Logic.Player.BroadcastStats(oxygen, maxOxygen, health, food, water);
                }
            }
        }
        internal void UpdateButtonsState()
        {
            toggleCommands[(int)ToggleCommands.freedom].State    = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoSurvival));
            toggleCommands[(int)ToggleCommands.creative].State   = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoBlueprints));
            toggleCommands[(int)ToggleCommands.survival].State   = SNGUI.ConvertBoolToState(GameModeUtils.RequiresSurvival());
            toggleCommands[(int)ToggleCommands.hardcore].State   = SNGUI.ConvertBoolToState(GameModeUtils.IsPermadeath());
            toggleCommands[(int)ToggleCommands.fastbuild].State  = SNGUI.ConvertBoolToState(NoCostConsoleCommand.main.fastBuildCheat);
            toggleCommands[(int)ToggleCommands.fastscan].State   = SNGUI.ConvertBoolToState(NoCostConsoleCommand.main.fastScanCheat);
            toggleCommands[(int)ToggleCommands.fastgrow].State   = SNGUI.ConvertBoolToState(NoCostConsoleCommand.main.fastGrowCheat);
            toggleCommands[(int)ToggleCommands.fasthatch].State  = SNGUI.ConvertBoolToState(NoCostConsoleCommand.main.fastHatchCheat);
            toggleCommands[(int)ToggleCommands.filterfast].State = SNGUI.ConvertBoolToState(filterFast);
            toggleCommands[(int)ToggleCommands.nocost].State     = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoCost));
            toggleCommands[(int)ToggleCommands.noenergy].State   = SNGUI.ConvertBoolToState(GameModeUtils.IsCheatActive(GameModeOption.NoEnergy));
            toggleCommands[(int)ToggleCommands.nosurvival].State = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoSurvival));
            toggleCommands[(int)ToggleCommands.oxygen].State     = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoOxygen));
            //toggleCommands[(int)ToggleCommands.radiation].State = SNGUI.ConvertBoolToState(GameModeUtils.IsOptionActive(GameModeOption.NoRadiation));
            toggleCommands[(int)ToggleCommands.invisible].State = SNGUI.ConvertBoolToState(GameModeUtils.IsInvisible());
            //toggleCommands[(int)ToggleCommands.shotgun].State = shotgun cheat
            toggleCommands[(int)ToggleCommands.nodamage].State = SNGUI.ConvertBoolToState(NoDamageConsoleCommand.main.GetNoDamageCheat());
            //toggleCommands[(int)ToggleCommands.noinfect].State = SNGUI.ConvertBoolToState(NoInfectConsoleCommand.main.GetNoInfectCheat());
            toggleCommands[(int)ToggleCommands.alwaysday].State   = SNGUI.ConvertBoolToState(AlwaysDayConsoleCommand.main.GetAlwaysDayCheat());
            toggleCommands[(int)ToggleCommands.overpower].Enabled = GameModeUtils.RequiresSurvival();

            if (toggleCommands[(int)ToggleCommands.overpower].Enabled)
            {
                toggleCommands[(int)ToggleCommands.overpower].State = SNGUI.ConvertBoolToState(OverPowerConsoleCommand.main.GetOverPowerCheat());
            }

            vehicleSettings[0].State = SNGUI.ConvertBoolToState(isSeamothCanFly.value);
            vehicleSettings[1].State = SNGUI.ConvertBoolToState(isSeaglideFast.value);

            weatherTab[(int)Weather.weather].State       = isWeatherEnabled ? GuiItemState.NORMAL : GuiItemState.PRESSED;
            weatherTab[(int)Weather.lightning].State     = WeatherManager.main.debugLightningEnabled ? GuiItemState.NORMAL : GuiItemState.PRESSED;
            weatherTab[(int)Weather.precipitation].State = WeatherManager.main.debugPrecipitationEnabled ? GuiItemState.NORMAL : GuiItemState.PRESSED;
            weatherTab[(int)Weather.wind].State          = WeatherManager.main.debugWindEnabled ? GuiItemState.NORMAL : GuiItemState.PRESSED;
            weatherTab[(int)Weather.cold].State          = GameModeUtils.IsOptionActive(GameModeOption.NoCold) ? GuiItemState.PRESSED : GuiItemState.NORMAL;
        }
Ejemplo n.º 4
0
 internal static void ReadGameValues()
 {
     toggleButtons[0].Pressed = GameModeUtils.IsOptionActive(GameModeOption.NoSurvival);
     toggleButtons[1].Pressed = GameModeUtils.IsOptionActive(GameModeOption.NoBlueprints);
     toggleButtons[2].Pressed = GameModeUtils.RequiresSurvival();
     toggleButtons[3].Pressed = GameModeUtils.IsPermadeath();
     toggleButtons[4].Pressed = NoCostConsoleCommand.main.fastBuildCheat;
     toggleButtons[5].Pressed = NoCostConsoleCommand.main.fastScanCheat;
     toggleButtons[6].Pressed = NoCostConsoleCommand.main.fastGrowCheat;
     toggleButtons[7].Pressed = NoCostConsoleCommand.main.fastHatchCheat;
     //toggleButtons[8].Pressed = filterfast cheat
     toggleButtons[9].Pressed  = GameModeUtils.IsOptionActive(GameModeOption.NoCost);
     toggleButtons[10].Pressed = GameModeUtils.IsCheatActive(GameModeOption.NoEnergy);
     toggleButtons[11].Pressed = GameModeUtils.IsOptionActive(GameModeOption.NoSurvival);
     toggleButtons[12].Pressed = GameModeUtils.IsOptionActive(GameModeOption.NoOxygen);
     toggleButtons[13].Pressed = GameModeUtils.IsOptionActive(GameModeOption.NoRadiation);
     toggleButtons[14].Pressed = GameModeUtils.IsInvisible();
     //toggleButtons[15].Pressed = shotgun cheat
     toggleButtons[16].Pressed = NoDamageConsoleCommand.main.GetNoDamageCheat();
     //toggleButtons[17].Pressed = alwaysDay cheat
     //toggleButtons[18].Pressed = noInfect cheat
     toggleButtons[19].Enabled  = GameModeUtils.RequiresSurvival();
     vehicleSettings[0].Pressed = seamothCanFly;
 }
        public static void Patch_Player_Health()
        {
            /*bool consoleOpened = (bool)typeof(DevConsole).GetField("state", BindingFlags.NonPublic |
             * BindingFlags.Instance).GetValue(typeof(DevConsole).GetField("instance", BindingFlags.NonPublic |
             * BindingFlags.Static).GetValue(null));*/

            Inventory pInventory = Inventory.main;

            IList <InventoryItem> medKit = pInventory.container.GetItems(TechType.FirstAidKit);

            if (Input.GetKeyDown(Config.MedHotKey) && Config.ToggleMedHotKey == false && !MainPatch.EditNameCheck)
            {
                if (Config.TextValue == 0)
                {
                    ErrorMessage.AddWarning("You have Disabled The MedKit Hotkey");
                }
                else if (Config.TextValue == 1)
                {
                    Subtitles.Add("You Have Disabled The MedKit Hotkey");
                }
            }
            else if (Input.GetKeyDown(Config.MedHotKey) && Config.ToggleMedHotKey == true && !MainPatch.EditNameCheck)
            {
#if DEBUG
                Debug.Log($"[WaterDrinkHotkey] :: PlayerHealth is {Player.main.GetComponent<LiveMixin>().health}");
                Debug.Log($"[WaterDrinkHotkey] :: Player Creative Gamemode is {GameModeUtils.IsOptionActive(GameModeOption.Creative)}");
                Debug.Log($"[WaterDrinkHotkey] :: Player NoSurvival Gamemode is {GameModeUtils.IsOptionActive(GameModeOption.NoSurvival)}");
                Debug.Log($"[WaterDrinkHotkey] :: Player Freedom Gamemode is {GameModeUtils.IsOptionActive(GameModeOption.Freedom)}");
                Debug.Log($"[WaterDrinkHotkey] :: Player Survival Gamemode is {GameModeUtils.IsOptionActive(GameModeOption.Survival)}");
#endif
                if (Player.main.GetComponent <LiveMixin>().health <= Config.HealthPercentage)
                {
                    if (medKit != null)
                    {
                        pInventory.ExecuteItemAction(ItemAction.Use, medKit.First());
                    }
                    else
                    {
                        if (Config.TextValue == 0)
                        {
                            ErrorMessage.AddWarning("You Do Not Have Any MedKits In your Inventory");
                        }
                        else if (Config.TextValue == 1)
                        {
                            Subtitles.Add("You Do Not Have Any MedKits In your Inventory");
                        }
                    }
                }
                else
                {
                    if (Config.TextValue == 0)
                    {
                        ErrorMessage.AddWarning($"You Do not need to use a FirstAidKit Your health is already above {Config.HealthPercentage}");
                    }
                    else if (Config.TextValue == 1)
                    {
                        Subtitles.Add($"You Do not need to use a FirstAidKit Your health is already above {Config.HealthPercentage }");
                    }
                }
            }
        }