File tree Expand file tree Collapse file tree
Source/RocketSoundEnhancement/PartModules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,6 +33,14 @@ public override void OnStart(StartState state)
3333 if ( state == StartState . Editor || state == StartState . None )
3434 return ;
3535
36+ // This likely doesn't work correctly with B9PS if it's trying to modify the module config
37+ if ( part != null && part . partInfo != null && part . partInfo . partPrefab != null )
38+ {
39+ int moduleIndex = part . modules . IndexOf ( this ) ;
40+ var prefab = part . partInfo . partPrefab . modules [ moduleIndex ] as RSE_Wheels ;
41+ offLoadVolumeScale = prefab . offLoadVolumeScale ;
42+ }
43+
3644 base . OnStart ( state ) ;
3745
3846 moduleWheel = part . GetComponent < ModuleWheelBase > ( ) ;
@@ -176,11 +184,8 @@ public override void OnLoad(ConfigNode node)
176184 {
177185 base . OnLoad ( node ) ;
178186
179- if ( part ? . partInfo ? . partPrefab != null )
187+ if ( HighLogic . LoadedScene != GameScenes . LOADING )
180188 {
181- int moduleIndex = part . modules . IndexOf ( this ) ;
182- var prefab = part . partInfo . partPrefab . modules [ moduleIndex ] as RSE_Wheels ;
183- offLoadVolumeScale = prefab . offLoadVolumeScale ;
184189 return ;
185190 }
186191
Original file line number Diff line number Diff line change @@ -32,6 +32,16 @@ public override void OnStart(StartState state)
3232 if ( state == StartState . Editor || state == StartState . None )
3333 return ;
3434
35+ // This likely doesn't work correctly with B9PS if it's trying to modify the module config
36+ if ( part != null && part . partInfo != null && part . partInfo . partPrefab != null )
37+ {
38+ int moduleIndex = part . modules . IndexOf ( this ) ;
39+ var prefab = part . partInfo . partPrefab . modules [ moduleIndex ] as ShipEffectsCollisions ;
40+
41+ SoundLayerCollisionGroups = prefab . SoundLayerCollisionGroups ;
42+ return ;
43+ }
44+
3545 base . OnStart ( state ) ;
3646
3747 if ( SoundLayerCollisionGroups . Count > 0 )
@@ -120,12 +130,8 @@ public override void OnLoad(ConfigNode node)
120130 {
121131 base . OnLoad ( node ) ;
122132
123- if ( part ? . partInfo ? . partPrefab != null )
133+ if ( HighLogic . LoadedScene != GameScenes . LOADING )
124134 {
125- int moduleIndex = part . modules . IndexOf ( this ) ;
126- var prefab = part . partInfo . partPrefab . modules [ moduleIndex ] as ShipEffectsCollisions ;
127-
128- SoundLayerCollisionGroups = prefab . SoundLayerCollisionGroups ;
129135 return ;
130136 }
131137
You can’t perform that action at this time.
0 commit comments