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;
 }
        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);
        }
Exemple #3
0
        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;
             */
        }
Exemple #4
0
        public static void SendLiveMixinChange(LiveMixin mixin, float amount, Vector3 position = default(Vector3), DamageType type = DamageType.Normal)
        {
            if (amount == 0f)
            {
                return;
            }

            if (Multiplayer.main.blocked)
            {
                return;
            }

            if (mixin.health < 0f)
            {
                return;
            }

            if (mixin.invincible)
            {
                return;
            }

            if (mixin.health == mixin.maxHealth && amount > 0f)
            {
                return;
            }

            if (GameModeUtils.IsInvisible() && mixin.invincibleInCreative)
            {
                return;
            }

            if (mixin.gameObject.GetComponent <Creature>() != null)
            {
                return;
            }

            var uid = mixin.gameObject.GetComponent <UniqueIdentifier>();

            if (uid == null)
            {
                return;
            }

            var sync = mixin.gameObject.GetComponent <SyncedVehicle>();

            if (sync != null && sync.activePlayer != null)
            {
                return;
            }

            var res = new ClientLiveMixinChange();

            res.targetGuid = uid.Id;
            res.health     = mixin.health;
            res.amount     = amount;
            res.type       = type;
            res.position   = position;
            res.force      = false;

            Multiplayer.main.Send(res);
        }
        public static void Postfix(SeaMonkeyBringGift __instance, ref float __result, float time)
        {
            if (PinManager.Count == 0)
            {
                return;
            }

            if (__result > 0f)
            {
                __result *= 100f;
                return;
            }

            if (GameModeUtils.IsInvisible())
            {
                if (!SeaMonkey.IsGiftBehaviorEnabled())
                {
                    __result = 0f;
                    return;
                }
                var main = Player.main;
                if (main.IsInside() || !main.IsUnderwater())
                {
                    __result = 0f;
                    return;
                }
                if (SeaMonkeyBringGift.activeSeaMonkeyGiftAction != null && SeaMonkeyBringGift.activeSeaMonkeyGiftAction != __instance)
                {
                    __result = 0f;
                    return;
                }
                if (__instance.state == SeaMonkeyBringGift.State.Animation || __instance.state == SeaMonkeyBringGift.State.AnimationEnd)
                {
                    __result = __instance.finishAnimationPriority;
                    return;
                }
                switch (__instance.state)
                {
                case SeaMonkeyBringGift.State.Inactive:
                    if (time < __instance.timeLastGiftAnimation + __instance.minInterval || time < SeaMonkeyBringGift.timeLastGlobalSeaMonkeyGift + __instance.minGlobalGiftInterval)
                    {
                        __result = 0f;
                        return;
                    }
                    if ((Utils.GetLocalPlayerPos() - __instance.transform.position).sqrMagnitude > __instance.maxRange * __instance.maxRange)
                    {
                        __result = 0f;
                        return;
                    }
                    break;

                case SeaMonkeyBringGift.State.Swim:
                    if (time > __instance.timeActionStart + __instance.maxDuration)
                    {
                        __result = 0f;
                        return;
                    }
                    break;

                case SeaMonkeyBringGift.State.End:
                    __result = 0f;
                    return;
                }
                if (!__instance.HasGift() && !__instance.spawnTempItem.TrySpawn(__instance.IsFirstGift(), main.GetBiomeString()))
                {
                    __result = 0f;
                    return;
                }

                __result = __instance.GetEvaluatePriority();
            }
        }