Skip to content

Commit c7f8e14

Browse files
committed
Patches
1 parent 2ac1433 commit c7f8e14

File tree

6 files changed

+57
-7
lines changed

6 files changed

+57
-7
lines changed

Scripts/ModTemplate/EyeProbe.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using NewHorizons;
99
using NewHorizons.Utility;
1010
using System.Collections;
11+
using HarmonyLib;
1112

1213
namespace AstralCodex
1314
{
@@ -50,13 +51,17 @@ void Start()
5051
musicFinaleSource = SearchUtilities.Find("EyeOfTheUniverse_Body/Sector_EyeOfTheUniverse/Sector_Campfire/InstrumentZones/EyeProbe/MusicFinaleSource").GetComponent<OWAudioSource>();
5152
campsiteController = SearchUtilities.Find("Sector_Campfire").GetComponent<QuantumCampsiteController>();
5253
cosmicInflationController = SearchUtilities.Find("EyeOfTheUniverse_Body/Sector_EyeOfTheUniverse/Sector_Campfire/InflationController").GetComponent<CosmicInflationController>();
54+
5355
//Lights
5456
foreach (Light l in player.gameObject.GetComponentsInChildren<Light>())
5557
fadeLights.Add(l, l.intensity);
5658
GameObject probe = SearchUtilities.Find("Probe_Body");
5759
foreach (Light l in probe.GetComponentsInChildren<Light>())
5860
fadeLights.Add(l, l.intensity);
5961
signal = SearchUtilities.Find("EyeOfTheUniverse_Body/Sector_EyeOfTheUniverse/Sector_Campfire/InstrumentZones/EyeProbe/AudioSource");
62+
63+
//Add self to cosmic inflation controller's inflation objects
64+
cosmicInflationController._inflationObjects.AddToArray(transform);
6065
}
6166
else
6267
{
@@ -74,7 +79,7 @@ void Update()
7479
quantumStates._isQuantum = (transform.position - player.position).magnitude < distance;
7580

7681
//Lights
77-
/*if ((transform.position - player.position).magnitude < lightDistance)
82+
if ((transform.position - player.position).magnitude < lightDistance)
7883
{
7984
foreach (KeyValuePair<Light, float> p in fadeLights)
8085
{
@@ -89,22 +94,26 @@ void Update()
8994
if (p.Key != null)
9095
p.Key.intensity = Mathf.Min(p.Key.intensity + lightFadeSpeed, p.Value);
9196
}
92-
}*/
97+
}
9398

9499
//Trigger blink once recorder is read
95100
if (recorder._dictNomaiTextData[10].IsTranslated && !translator._isEquipped && !blinkCalled)
96101
{
97102
blinkCalled = true;
98103
StartCoroutine(nameof(Disappear));
99104
}
105+
106+
//Deactivate when cosmic inflation starts
107+
if (cosmicInflationController._state == CosmicInflationController.State.Inflating)
108+
DeactivateProbe();
100109
}
101110
#endregion
102111

103112
#region Music
104113
void LateUpdate()
105114
{
106115
//Finale starts when CosmicInflationController starts waiting for crossfade to the finale to start
107-
if (cosmicInflationController._waitForCrossfade && !musicFinaleSource.isPlaying)
116+
if (cosmicInflationController._waitForCrossfade && Time.time >= cosmicInflationController._crossFadeMusicTime && !musicFinaleSource.isPlaying)
108117
{
109118
musicSource.FadeOut(5);
110119
musicFinaleSource.FadeIn(5, true);

Scripts/ModTemplate/EyeSceneHandler.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ void OnStarSystemLoaded(string system)
3131
//Configure
3232
InitializeProbeParticles();
3333
ConfigureMuseumPlaque();
34-
InitializeProximityQuantumStates();
34+
EyeProbe();
3535
ConfigureRecorder();
3636
AddProbeDestructionVolumes();
37+
ClearParadoxState();
3738

3839
NewHorizons.Utility.OWML.Delay.FireOnNextUpdate(AddSkybox);
3940
}
@@ -92,7 +93,7 @@ void ConfigureMuseumPlaque()
9293
}
9394
}
9495

95-
void InitializeProximityQuantumStates()
96+
void EyeProbe()
9697
{
9798
//Make the translation probe's quantum states turn quantum on proximity
9899
GameObject quantumProximityController = SearchUtilities.Find("QuantumProximityController");
@@ -120,7 +121,7 @@ void AddProbeDestructionVolumes()
120121
{
121122
//Make it easier to lose the probe in the eye by adding additional destruction volumes
122123
foreach (EndlessTriggerVolume endlessVolume in FindObjectsOfType<EndlessTriggerVolume>())
123-
endlessVolume.gameObject.AddComponent<ProbeDestructionVolume>();
124+
endlessVolume.gameObject.AddComponent<ProbeDestroyOnExitVolume>();
124125
}
125126

126127
void AddSkybox()
@@ -134,6 +135,16 @@ void AddSkybox()
134135
skySphereGO.SetActive(true);
135136
}
136137
}
138+
139+
void ClearParadoxState()
140+
{
141+
if (PlayerData.GetPersistentCondition("CODEX_ENTERED_TESSERACT"))
142+
{
143+
PlayerData.SetPersistentCondition("PLAYER_ENTERED_TIMELOOPCORE", false);
144+
PlayerData.SetPersistentCondition("PROBE_ENTERED_TIMELOOPCORE", false);
145+
EyeStateManager.s_paradoxExists = false;
146+
}
147+
}
137148
#endregion
138149
}
139150
}

Scripts/ModTemplate/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace AstralCodex
1919
public class Main : ModBehaviour
2020
{
2121
//DEBUG
22-
public static bool debugMode = true; //CHANGE ON RELEASE
22+
public static bool debugMode = false; //CHANGE ON RELEASE
2323

2424
//Constant values
2525
public static string assetBundlePath = "planets/assets/astral_codex";
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using UnityEngine;
7+
8+
namespace AstralCodex
9+
{
10+
internal class ProbeDestroyOnExitVolume : EffectVolume
11+
{
12+
public override void OnEffectVolumeEnter(GameObject hitObj)
13+
{
14+
ProbeDestructionDetector component = hitObj.GetComponent<ProbeDestructionDetector>();
15+
if (component != null)
16+
{
17+
component.RemoveVolume(this);
18+
}
19+
}
20+
21+
public override void OnEffectVolumeExit(GameObject hitObj)
22+
{
23+
ProbeDestructionDetector component = hitObj.GetComponent<ProbeDestructionDetector>();
24+
if (component != null)
25+
{
26+
component.AddVolume(this);
27+
}
28+
}
29+
}
30+
}

Walker.AstralCodex/AstralCodex.dll

1 KB
Binary file not shown.

Walker.AstralCodex/AstralCodex.pdb

532 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)