public override IEnumerator ReportBombStatus() { if (_gameroom.GetType() == _factoryStaticModeType) { IEnumerator baseIEnumerator = base.ReportBombStatus(); while (baseIEnumerator.MoveNext()) { yield return(baseIEnumerator.Current); } yield break; } InitializeOnLightsOn = false; TwitchBomb bombHandle = TwitchGame.Instance.Bombs[0]; bombHandle.BombName = _infiniteMode ? "Infinite bombs incoming" : $"{BombCount} bombs incoming"; yield return(new WaitUntil(() => GetBomb != null || bombHandle.Bomb.HasDetonated)); if (bombHandle.Bomb.HasDetonated && !_zenMode) { yield break; } float currentBombTimer = bombHandle.CurrentTimer + 5; int currentBombID = 1; while (GetBomb != null) { Object currentBomb = GetBomb; TimerComponent timerComponent = bombHandle.Bomb.GetTimer(); yield return(new WaitUntil(() => timerComponent.IsActive)); if (Math.Abs(currentBombTimer - bombHandle.CurrentTimer) > 1f) { yield return(null); InitializeGameModes(true); } bool enableCameraWall = OtherModes.TrainingModeOn && IRCConnection.Instance.State == IRCConnectionState.Connected && TwitchPlaySettings.data.EnableFactoryTrainingModeCameraWall; if (enableCameraWall != TwitchGame.ModuleCameras.CameraWallEnabled) { if (enableCameraWall) { TwitchGame.ModuleCameras.EnableCameraWall(); } else { TwitchGame.ModuleCameras.DisableCameraWall(); } } bombHandle.BombName = $"Bomb {currentBombID} of {(_infiniteMode ? "∞" : BombCount.ToString())}"; IRCConnection.SendMessage($"Bomb {currentBombID++} of {(_infiniteMode ? "∞" : BombCount.ToString())} is now live."); if (TwitchPlaySettings.data.EnableAutomaticEdgework) { bombHandle.FillEdgework(); } else { bombHandle.EdgeworkText.text = TwitchPlaySettings.data.BlankBombEdgework; } if (OtherModes.Unexplodable) { bombHandle.StrikeLimit += bombHandle.StrikeCount; } IEnumerator bombHold = bombHandle.HoldBomb(); while (bombHold.MoveNext()) { yield return(bombHold.Current); } Bomb bomb1 = (Bomb)_internalBombProperty.GetValue(currentBomb, null); yield return(new WaitUntil(() => { bool result = bomb1.HasDetonated || bomb1.IsSolved() || !TwitchGame.BombActive; if (!result || OtherModes.TimeModeOn) { currentBombTimer = bomb1.GetTimer().TimeRemaining; } return result; })); if (!TwitchGame.BombActive) { yield break; } IRCConnection.SendMessage(TwitchGame.Instance.GetBombResult(false)); TwitchPlaySettings.SetRetryReward(); foreach (TwitchModule handle in TwitchGame.Instance.Modules) { //If the camera is still attached to the bomb component when the bomb gets destroyed, then THAT camera is destroyed as wel. TwitchGame.ModuleCameras.UnviewModule(handle); } if (TwitchPlaySettings.data.EnableFactoryAutomaticNextBomb) { bombHold = bombHandle.LetGoBomb(); while (bombHold.MoveNext()) { yield return(bombHold.Current); } yield return(new WaitForSeconds(1.0f)); //If for some reason we are somehow still holding the bomb, then the Let go did not register. //Try again exactly one more time. if (currentBomb == GetBomb) { bombHold = bombHandle.HoldBomb(); while (bombHold.MoveNext()) { yield return(bombHold.Current); } yield return(new WaitForSeconds(0.10f)); bombHold = bombHandle.LetGoBomb(); while (bombHold.MoveNext()) { yield return(bombHold.Current); } } } //If we are still holding the bomb, wait for it to actually be put down manually, or by a Twitch plays Drop bomb command. while (currentBomb == GetBomb) { yield return(new WaitForSeconds(0.1f)); } bombHandle.StartCoroutine(DestroyBomb(currentBomb)); if (GetBomb == null) { continue; } Bomb bomb = (Bomb)_internalBombProperty.GetValue(GetBomb, null); InitializeBomb(bomb, true); } }
public static IEnumerator Hold(TwitchBomb bomb) => bomb.HoldBomb();