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);
|
var volume = VolumeBuilder.Make<LoadCreditsVolume>(planetGO, sector, info);
|
||||||
|
|
||||||
volume.creditsType = info.creditsType;
|
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.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;
|
return volume;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@ namespace NewHorizons.Components.Volumes
|
|||||||
public DeathType? deathType = DeathType.Default;
|
public DeathType? deathType = DeathType.Default;
|
||||||
|
|
||||||
public Color? colour;
|
public Color? colour;
|
||||||
|
public string condition;
|
||||||
|
|
||||||
private GameOverController _gameOverController;
|
private GameOverController _gameOverController;
|
||||||
private PlayerCameraEffectController _playerCameraEffectController;
|
private PlayerCameraEffectController _playerCameraEffectController;
|
||||||
@ -28,7 +29,7 @@ namespace NewHorizons.Components.Volumes
|
|||||||
|
|
||||||
public override void OnTriggerVolumeEntry(GameObject hitObj)
|
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
|
// Have to run it off the mod behaviour since the game over controller disables everything
|
||||||
Delay.StartCoroutine(GameOver());
|
Delay.StartCoroutine(GameOver());
|
||||||
@ -106,6 +107,8 @@ namespace NewHorizons.Components.Volumes
|
|||||||
default:
|
default:
|
||||||
// GameOverController disables post processing
|
// GameOverController disables post processing
|
||||||
_gameOverController._flashbackCamera.postProcessing.enabled = true;
|
_gameOverController._flashbackCamera.postProcessing.enabled = true;
|
||||||
|
// For some reason this isn't getting set sometimes
|
||||||
|
AudioListener.volume = 1;
|
||||||
GlobalMessenger.FireEvent("TriggerFlashback");
|
GlobalMessenger.FireEvent("TriggerFlashback");
|
||||||
break;
|
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)
|
if (Base.invulnerableToSun)
|
||||||
{
|
{
|
||||||
Base.hasFluidDetector = false;
|
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 NewHorizons.External.SerializableEnums;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace NewHorizons.External.Modules.Volumes.VolumeInfos
|
namespace NewHorizons.External.Modules.Volumes.VolumeInfos
|
||||||
@ -10,9 +10,7 @@ namespace NewHorizons.External.Modules.Volumes.VolumeInfos
|
|||||||
{
|
{
|
||||||
[DefaultValue("none")] public NHCreditsType creditsType = NHCreditsType.None;
|
[DefaultValue("none")] public NHCreditsType creditsType = NHCreditsType.None;
|
||||||
|
|
||||||
/// <summary>
|
[Obsolete("Use gameOver")]
|
||||||
/// Text displayed in orange on game over. For localization, put translations under UI.
|
|
||||||
/// </summary>
|
|
||||||
public string gameOverText;
|
public string gameOverText;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -21,8 +19,8 @@ namespace NewHorizons.External.Modules.Volumes.VolumeInfos
|
|||||||
[DefaultValue("default")] public NHDeathType? deathType = null;
|
[DefaultValue("default")] public NHDeathType? deathType = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public MColor gameOverTextColour;
|
public GameOverModule gameOver;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user