//+ BEHAVIOUR /// <summary>Awakes the behaviour, ran before any interactions</summary> public new void Awake() { displayMap.Clear(); econDir = SceneContext.Instance.EconomyDirector; progressDir = SceneContext.Instance.ProgressDirector; lookupDir = GameContext.Instance.LookupDirector; FixEntryPrefab(); }
/// <summary>Unlocks all progress</summary> /// <param name="self">The ProgressDirector instance</param> public static void DebugUnlockProgress(this ProgressDirector self) { foreach (ProgressDirector.ProgressType type in Enum.GetValues(typeof(ProgressDirector.ProgressType))) { // ReSharper disable once SwitchStatementMissingSomeCases switch (type) { case ProgressDirector.ProgressType.CORPORATE_PARTNER: self.SetProgress(type, 28); break; default: self.SetProgress(type, 1); break; } } }
/// <summary>Called on plugin init</summary> private void Awake() { // set the default help menu font _helpFont = Font.CreateDynamicFontFromOSFont("Consolas", 18); _debug = true; _showHelp = true; _timeDir = SRSingleton<SceneContext>.Instance.TimeDirector; _pediaDir = SRSingleton<SceneContext>.Instance.PediaDirector; _tutorialDir = SRSingleton<SceneContext>.Instance.TutorialDirector; _achieveDir = SRSingleton<SceneContext>.Instance.AchievementsDirector; _progressDir = SRSingleton<SceneContext>.Instance.ProgressDirector; _playerState = SRSingleton<SceneContext>.Instance.PlayerState; _autoSave = SRSingleton<GameContext>.Instance.AutoSaveDirector; _inputDir = SRSingleton<GameContext>.Instance.InputDirector; }
/// <summary>Retrieves various directors for debugging</summary> private void Awake() { // retrieve the directors _timeDir = FindObjectOfType <TimeDirector>(); _pediaDir = FindObjectOfType <PediaDirector>(); _tutorialDir = FindObjectOfType <TutorialDirector>(); _achieveDir = FindObjectOfType <AchievementsDirector>(); _progressDir = FindObjectOfType <ProgressDirector>(); _playerState = FindObjectOfType <PlayerState>(); _autoSave = FindObjectOfType <AutoSaveDirector>(); // set the default help menu font _helpFont = Font.CreateDynamicFontFromOSFont("Consolas", 18); // prevent user from submitting bug reports. var inputDir = FindObjectOfType <InputDirector>(); inputDir.bugReportPrefab = new GameObject(); inputDir.bugReportPrefab.SetActive(false); }
/// <summary>Handles debugging features</summary> private void Update() { // retrieve the directors if (!_timeDir) { _timeDir = FindObjectOfType <TimeDirector>(); } if (!_pediaDir) { _pediaDir = FindObjectOfType <PediaDirector>(); } if (!_tutorialDir) { _tutorialDir = FindObjectOfType <TutorialDirector>(); } if (!_achieveDir) { _achieveDir = FindObjectOfType <AchievementsDirector>(); } if (!_progressDir) { _progressDir = FindObjectOfType <ProgressDirector>(); } if (!_playerState) { _playerState = FindObjectOfType <PlayerState>(); } if (!_autoSave) { _autoSave = FindObjectOfType <AutoSaveDirector>(); } if (!_inputDir) { _inputDir = FindObjectOfType <InputDirector>(); if (_inputDir) // prevent user from submitting bug reports. { var bugReportUI = _inputDir.bugReportPrefab.GetComponentInChildren <BugReportUI>(); bugReportUI.submitButton.interactable = false; bugReportUI.summaryField.interactable = false; bugReportUI.descField.interactable = false; bugReportUI.summaryField.text = "Debug Menu Mod installed - Reporting Issues is deactivated"; bugReportUI.descField.text = "Notice: While this debug menu mod is active, you will not be able to report bugs. " + "This mod is not supported by Monomi Park and never will be."; } } // retrieve object and component references if (!_player) { _player = GameObject.Find("SimplePlayer"); } if (!_fpController) { _fpController = _player?.GetComponent <vp_FPController>(); if (_noclip) { StartNoclip(); } } if (!_camera) { _camera = GameObject.Find("FPSCamera"); } if (!_hudUi) { _hudUi = GameObject.Find("HudUI"); } // the debug menu shouldn't function if the game is frozen if (Time.timeScale <= 0f) { return; } // toggle the debug menu if (Input.GetKeyDown(KeyCode.F9)) { _debug = !_debug; // if the debug menu was on previously, // turn off any cheats that may be on. if (!_debug) { _noclip = false; _infiniteEnergy = false; _infiniteHealth = false; // make hud visible _hudUi?.SetActive(true); } } // debug mode is off, nothing more to do here if (!_debug) { return; } // decrement time of day if (Input.GetKeyDown(KeyCode.LeftBracket)) { _timeDir?.AdjustTimeOfDay(-0.0416666679f); // check for negative time if (_timeDir?.WorldTime() <= 0f) { _timeDir?.SetWorldTime(0f); } } // increment time of day else if (Input.GetKeyDown(KeyCode.RightBracket)) { _timeDir?.AdjustTimeOfDay(0.0416666679f); } // toggle help menu if (Input.GetKeyDown(KeyCode.F10)) { _showHelp = !_showHelp; } // add 1000 credits if (Input.GetKeyDown(KeyCode.Equals) || Input.GetKeyDown(KeyCode.KeypadPlus)) { _playerState?.AddCurrency(1000); } // subtract 1000 credits else if (Input.GetKeyDown(KeyCode.Minus) || Input.GetKeyDown(KeyCode.KeypadMinus)) { _playerState?.AddCurrency(-1000); } // toggle heads-up display if (Input.GetKeyDown(KeyCode.F6)) { _hudUi?.SetActive(!_hudUi.activeSelf); } // reset player progress if (Input.GetKeyDown(KeyCode.F12)) { Console.WriteLine("DEBUG: Tutorials/Pedia/Achievements/Progress Reset"); _pediaDir?.DebugClearUnlocked(); _tutorialDir?.DebugClearCompleted(); _achieveDir?.DebugClearAwarded(); _progressDir?.DebugClearProgress(); } // unlock all progress else if (Input.GetKeyDown(KeyCode.F11)) { Console.WriteLine("DEBUG: Tutorials/Pedia/Achievements/Progress Unlocked"); _pediaDir?.DebugAllUnlocked(); _tutorialDir?.DebugAllCompleted(); _achieveDir?.DebugAllAwarded(); _progressDir?.DebugUnlockProgress(); } // unlock all upgrades if (Input.GetKeyDown(KeyCode.Alpha0)) { Console.WriteLine("DEBUG: All Personal Upgrades"); _playerState?.DebugGiveAllUpgrades(); _playerState?.SetHealth(_playerState.GetMaxHealth()); _playerState?.SetEnergy(_playerState.GetMaxEnergy()); // add 5 keys for (var i = 0; i < 5; i++) { _playerState?.AddKey(); } } // fill inventory with random items and ammo if (Input.GetKeyDown(KeyCode.Alpha9) && _playerState) { Console.WriteLine("DEBUG: Fill Ammo"); _playerState?.Ammo?.DebugFillRandomAmmo(); } // toggle infinite energy if (Input.GetKeyDown(KeyCode.Alpha6)) { _infiniteEnergy = !_infiniteEnergy; } // toggle infinite health if (Input.GetKeyDown(KeyCode.Alpha7)) { _infiniteHealth = !_infiniteHealth; } // clear inventory if (Input.GetKeyDown(KeyCode.K)) { _playerState?.Ammo?.Clear(); } // refill inventory if (Input.GetKeyDown(KeyCode.L) && _playerState) { _playerState?.Ammo?.DebugRefillAmmo(); } // toggle noclip if (Input.GetKeyDown(KeyCode.N) && _player) { if (!_noclip) { StartNoclip(); } else { StopNoclip(); } } // force the game to save if (Input.GetKeyDown(KeyCode.Alpha8)) { Console.WriteLine("DEBUG: Forcing save now"); _autoSave?.SaveAllNow(); } // handle noclip, if it's enabled if (_noclip && _camera && _fpController) { // calculate speed, will be multiplied by two if run is held var speed = 20f * (SRInput.Actions.run.State ? 2f : 1f); // add movement _noclipPos += _camera.transform.forward * SRInput.Actions.vertical.RawValue * speed * Time.deltaTime; _noclipPos += _camera.transform.right * SRInput.Actions.horizontal.RawValue * speed * Time.deltaTime; // stop all movement on the controller and reposition it _fpController?.Stop(); _fpController?.SetPosition(_noclipPos); } if (_infiniteEnergy && _playerState) // infinite energy's on, set our energy to max { _playerState.SetEnergy(_playerState.GetMaxEnergy()); } if (_infiniteHealth && _playerState) // god mode's on, set our health to max { _playerState.SetHealth(_playerState.GetMaxHealth()); } }
// ProgressDirector // -------------------------------------------------------------------------------- /// <summary>Clears all progress</summary> /// <param name="self">The ProgressDirector instance</param> public static void DebugClearProgress(this ProgressDirector self) { GetFieldOrPropertyValue <ProgressDirector, Dictionary <ProgressDirector.ProgressType, int> >("progressDict", self).Clear(); }
// ProgressDirector // -------------------------------------------------------------------------------- /// <summary>Clears all progress</summary> /// <param name="self">The ProgressDirector instance</param> public static void DebugClearProgress(this ProgressDirector self) { GetPrivateField <ProgressDirector, Dictionary <ProgressDirector.ProgressType, int> >("progressDict", self).Clear(); }
// ProgressDirector // -------------------------------------------------------------------------------- /// <summary>Clears all progress</summary> /// <param name="self">The ProgressDirector instance</param> public static void DebugClearProgress(this ProgressDirector self) { self.model.progressDict.Clear(); }