88using NewHorizons ;
99using NewHorizons . Utility ;
1010using System . Collections ;
11+ using HarmonyLib ;
1112
1213namespace 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 ) ;
0 commit comments