mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Generate conditionals handler
This commit is contained in:
parent
25f36dcbb7
commit
3270580422
@ -16,27 +16,27 @@ namespace NewHorizons.Handlers
|
||||
var passed = true;
|
||||
if (check.allConditionsSet != null && check.allConditionsSet.Length > 0)
|
||||
{
|
||||
passed = passed && check.allConditionsSet.All(c => dcm.GetConditionState(c));
|
||||
passed = passed && check.allConditionsSet.All(dcm.GetConditionState);
|
||||
}
|
||||
if (check.anyConditionsSet != null && check.anyConditionsSet.Length > 0)
|
||||
{
|
||||
passed = passed && check.anyConditionsSet.Any(c => dcm.GetConditionState(c));
|
||||
passed = passed && check.anyConditionsSet.Any(dcm.GetConditionState);
|
||||
}
|
||||
if (check.allPersistentConditionsSet != null && check.allPersistentConditionsSet.Length > 0)
|
||||
{
|
||||
passed = passed && check.allPersistentConditionsSet.All(c => PlayerData.GetPersistentCondition(c));
|
||||
passed = passed && check.allPersistentConditionsSet.All(PlayerData.GetPersistentCondition);
|
||||
}
|
||||
if (check.anyPersistentConditionsSet != null && check.anyPersistentConditionsSet.Length > 0)
|
||||
{
|
||||
passed = passed && check.anyPersistentConditionsSet.Any(c => PlayerData.GetPersistentCondition(c));
|
||||
passed = passed && check.anyPersistentConditionsSet.Any(PlayerData.GetPersistentCondition);
|
||||
}
|
||||
if (check.allFactsRevealed != null && check.allFactsRevealed.Length > 0)
|
||||
{
|
||||
passed = passed && check.allFactsRevealed.All(f => ShipLogHandler.KnowsFact(f));
|
||||
passed = passed && check.allFactsRevealed.All(ShipLogHandler.KnowsFact);
|
||||
}
|
||||
if (check.anyFactsRevealed != null && check.anyFactsRevealed.Length > 0)
|
||||
{
|
||||
passed = passed && check.anyFactsRevealed.Any(f => ShipLogHandler.KnowsFact(f));
|
||||
passed = passed && check.anyFactsRevealed.Any(ShipLogHandler.KnowsFact);
|
||||
}
|
||||
if (check.invert)
|
||||
{
|
||||
|
||||
@ -9,7 +9,7 @@ using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
using NewHorizons.OtherMods;
|
||||
using NewHorizons.Components.EOTE;
|
||||
using Epic.OnlineServices.Presence;
|
||||
using NewHorizons.Components.Conditionals;
|
||||
|
||||
namespace NewHorizons.Handlers
|
||||
{
|
||||
@ -32,6 +32,15 @@ namespace NewHorizons.Handlers
|
||||
SkyboxBuilder.Make(system.Config.Skybox, system.Mod);
|
||||
}
|
||||
|
||||
if (system.Config.conditionalChecks != null)
|
||||
{
|
||||
var conditionalsManager = new GameObject("ConditionalsManager").AddComponent<ConditionalsManager>();
|
||||
foreach (var check in system.Config.conditionalChecks)
|
||||
{
|
||||
conditionalsManager.AddCheck(check);
|
||||
}
|
||||
}
|
||||
|
||||
// No time loop or travel audio at the eye
|
||||
if (Main.Instance.CurrentStarSystem == "EyeOfTheUniverse") return;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user