mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Move game over stuff to its own module, add condition
This commit is contained in:
parent
392fc404f4
commit
0dfc2381a3
@ -12,9 +12,10 @@ namespace NewHorizons.Builder.Volumes
|
||||
var volume = VolumeBuilder.Make<LoadCreditsVolume>(planetGO, sector, info);
|
||||
|
||||
volume.creditsType = info.creditsType;
|
||||
volume.gameOverText = info.gameOverText;
|
||||
volume.gameOverText = info.gameOver?.text;
|
||||
volume.deathType = info.deathType == null ? null : EnumUtils.Parse(info.deathType.ToString(), DeathType.Default);
|
||||
volume.colour = info.gameOverTextColour?.ToColor();
|
||||
volume.colour = info.gameOver?.colour?.ToColor();
|
||||
volume.condition = info.gameOver?.condition;
|
||||
|
||||
return volume;
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ namespace NewHorizons.Components.Volumes
|
||||
public DeathType? deathType = DeathType.Default;
|
||||
|
||||
public Color? colour;
|
||||
public string condition;
|
||||
|
||||
private GameOverController _gameOverController;
|
||||
private PlayerCameraEffectController _playerCameraEffectController;
|
||||
@ -28,7 +29,7 @@ namespace NewHorizons.Components.Volumes
|
||||
|
||||
public override void OnTriggerVolumeEntry(GameObject hitObj)
|
||||
{
|
||||
if (hitObj.CompareTag("PlayerDetector") && enabled)
|
||||
if (hitObj.CompareTag("PlayerDetector") && enabled && (string.IsNullOrEmpty(condition) || DialogueConditionManager.SharedInstance.GetConditionState(condition)))
|
||||
{
|
||||
// Have to run it off the mod behaviour since the game over controller disables everything
|
||||
Delay.StartCoroutine(GameOver());
|
||||
@ -106,6 +107,8 @@ namespace NewHorizons.Components.Volumes
|
||||
default:
|
||||
// GameOverController disables post processing
|
||||
_gameOverController._flashbackCamera.postProcessing.enabled = true;
|
||||
// For some reason this isn't getting set sometimes
|
||||
AudioListener.volume = 1;
|
||||
GlobalMessenger.FireEvent("TriggerFlashback");
|
||||
break;
|
||||
}
|
||||
|
||||
15
NewHorizons/External/Configs/PlanetConfig.cs
vendored
15
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -658,6 +658,21 @@ namespace NewHorizons.External.Configs
|
||||
}
|
||||
}
|
||||
|
||||
if (Volumes?.creditsVolume != null)
|
||||
{
|
||||
foreach (var volume in Volumes.creditsVolume)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(volume.gameOverText))
|
||||
{
|
||||
if (volume.gameOver == null)
|
||||
{
|
||||
volume.gameOver = new();
|
||||
}
|
||||
volume.gameOver.text = volume.gameOverText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Base.invulnerableToSun)
|
||||
{
|
||||
Base.hasFluidDetector = false;
|
||||
|
||||
25
NewHorizons/External/Modules/GameOverModule.cs
vendored
Normal file
25
NewHorizons/External/Modules/GameOverModule.cs
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
using NewHorizons.External.SerializableData;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NewHorizons.External.Modules
|
||||
{
|
||||
[JsonObject]
|
||||
public class GameOverModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Text displayed in orange on game over. For localization, put translations under UI.
|
||||
/// </summary>
|
||||
public string text;
|
||||
|
||||
/// <summary>
|
||||
/// Change the colour of the game over text. Leave empty to use the default orange.
|
||||
/// </summary>
|
||||
public MColor colour;
|
||||
|
||||
/// <summary>
|
||||
/// Condition that must be true for this game over to trigger. Leave empty to always trigger this game over.
|
||||
/// Note this is a regular dialogue condition, not a persistent condition.
|
||||
/// </summary>
|
||||
public string condition;
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
using NewHorizons.External.SerializableData;
|
||||
using NewHorizons.External.SerializableEnums;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace NewHorizons.External.Modules.Volumes.VolumeInfos
|
||||
@ -10,9 +10,7 @@ namespace NewHorizons.External.Modules.Volumes.VolumeInfos
|
||||
{
|
||||
[DefaultValue("none")] public NHCreditsType creditsType = NHCreditsType.None;
|
||||
|
||||
/// <summary>
|
||||
/// Text displayed in orange on game over. For localization, put translations under UI.
|
||||
/// </summary>
|
||||
[Obsolete("Use gameOver")]
|
||||
public string gameOverText;
|
||||
|
||||
/// <summary>
|
||||
@ -21,8 +19,8 @@ namespace NewHorizons.External.Modules.Volumes.VolumeInfos
|
||||
[DefaultValue("default")] public NHDeathType? deathType = null;
|
||||
|
||||
/// <summary>
|
||||
/// Change the colour of the game over text. Leave empty to use the default orange.
|
||||
/// The game over message to display. Leave empty to go straight to credits.
|
||||
/// </summary>
|
||||
public MColor gameOverTextColour;
|
||||
public GameOverModule gameOver;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user