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); }
internal static void PreUpdateStats(Survival __instance, float timePassed) { bool bHasSurvivalSuit = PlayerPatch.bHasSurvivalSuit; if (bHasSurvivalSuit && GameModeUtils.RequiresSurvival() && !Player.main.IsFrozenStats()) { //preHunger = __instance.food; //preWater = __instance.water; float regenRate = SurvivalsuitBehaviour.SurvivalRegenRate; float kMaxStat = SurvivalConstants.kMaxStat; /*float kFoodTime = SurvivalConstants.kFoodTime; * float kWaterTime = SurvivalConstants.kWaterTime; * Log.LogDebug($"SurvivalPatches.PreUpdateStats: food = {__instance.food}, water = {__instance.water}, bHasSurvivalSuit = {bHasSurvivalSuit}\nkFoodTime = {kFoodTime}, kWaterTime = {kWaterTime}, kMaxStat = {kMaxStat}, regenRate = {regenRate}");*/ // now we can calculate the current calorie/water consumption rates and calibrate based on those. // Assuming the buggers at UWE don't change the algorithm. float foodRestore = (timePassed / SurvivalConstants.kFoodTime * kMaxStat) * regenRate; float waterRestore = (timePassed / SurvivalConstants.kWaterTime * kMaxStat) * regenRate; __instance.food = __instance.food + foodRestore; __instance.water = __instance.water + waterRestore; //Log.LogDebug($"SurvivalPatches.PreUpdateStats: done running Survival Suit routine; food = {__instance.food}, water = {__instance.water}, foodRestore = {foodRestore}, waterRestore = {waterRestore}"); } }
public static bool Prefix(Stillsuit __instance) { if (!__instance.GetComponent <ESSBehaviour>()) { return(true); } if (GameModeUtils.RequiresSurvival() && !Player.main.GetComponent <Survival>().freezeStats) { ErrorMessage.AddDebug(Mathf.RoundToInt(__instance.waterCaptured).ToString() + "/" + __instance.waterPrefab.waterValue.ToString()); __instance.waterCaptured += Time.deltaTime / 18f * 0.75f; if (__instance.waterCaptured >= __instance.waterPrefab.waterValue) { ErrorMessage.AddDebug("Enhanced Stillsuit activated!"); GameObject gameObject = GameObject.Instantiate(__instance.waterPrefab.gameObject); Pickupable component = gameObject.GetComponent <Pickupable>(); Player.main.GetComponent <Survival>().Eat(component.gameObject); __instance.waterCaptured -= __instance.waterPrefab.waterValue; } } return(false); }
public void UpdateHunger(GameObject sender) { if (GameModeUtils.RequiresSurvival() && !Player.main.IsFrozenStats()) { float deltaTime = Time.deltaTime; // now we can calculate the current calorie/water consumption rates and calibrate based on those. // Assuming the buggers at UWE don't change the algorithm. float foodRestore = deltaTime / foodDivisor * SurvivalRegenRate; float waterRestore = deltaTime / waterDivisor * SurvivalRegenRate; primaryNeeds.food = primaryNeeds.food + foodRestore; // We don't need to clamp these values - Survival.UpdateHunger will do it for us. primaryNeeds.water = primaryNeeds.water + waterRestore; } }
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(); toggleCommands[(int)ToggleCommands.weather].State = isWeatherEnabled ? GuiItemState.NORMAL : GuiItemState.PRESSED; toggleCommands[(int)ToggleCommands.resistcold].State = SNGUI.ConvertBoolToState(ResistColdConsoleCommand.main.GetResistColdCheat()); toggleCommands[(int)ToggleCommands.noiceworm].State = noIceWorm ? GuiItemState.PRESSED : GuiItemState.NORMAL; if (toggleCommands[(int)ToggleCommands.overpower].Enabled) { toggleCommands[(int)ToggleCommands.overpower].State = SNGUI.ConvertBoolToState(OverPowerConsoleCommand.main.GetOverPowerCheat()); } //vehicleSettings[0].State = SNGUI.ConvertBoolToState(isSeamothCanFly.value); vehicleSettings[0].State = SNGUI.ConvertBoolToState(isSeaglideFast.value); /* * weatherTab[(int)Weather.weather].State = isWeatherEnabled ? GuiItemState.NORMAL : GuiItemState.PRESSED; * weatherTab[(int)Weather.lightning].State = VFXWeatherManager.main.lightningsEnabled ? GuiItemState.NORMAL : GuiItemState.PRESSED; * weatherTab[(int)Weather.precipitation].State = VFXWeatherManager.main.precipitationEnabled ? 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; */ }
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 bool IsSurvival() { return(GameModeUtils.RequiresSurvival()); }
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 && GameModeConsoleCommands.main && GameModeUtils.RequiresSurvival()) { 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); } } }