@@ -38,12 +38,12 @@ static VTOLTakeoff_Gravship()
3838
3939 public VerticalProtocolProperties_Gravship LandingProperties_Gravship => LandingProperties as VerticalProtocolProperties_Gravship ;
4040
41- private void Init ( )
41+ private static void Init ( )
4242 {
4343 LongEventHandler . ExecuteWhenFinished ( ( ) =>
4444 {
45- thrusterFlameBlock = new ( ) ;
46- engineGlowBlock = new ( ) ;
45+ thrusterFlameBlock = new MaterialPropertyBlock ( ) ;
46+ engineGlowBlock = new MaterialPropertyBlock ( ) ;
4747 } ) ;
4848 }
4949
@@ -73,9 +73,9 @@ protected override (Vector3 drawPos, float rotation, DynamicShadowData shadowDat
7373 drawPos += ( offset2 - offset ) . RotatedBy ( Vehicle ? . Rotation . AsAngle ?? 0f ) + offset ;
7474 }
7575
76- if ( ModsConfig . OdysseyActive && LaunchProperties_Gravship != null && Vehicle is VehiclePawnWithMap vehicle )
76+ if ( ModsConfig . OdysseyActive && LaunchProperties_Gravship != null && Vehicle is VehiclePawnWithMap vehiclePawnWithMap )
7777 {
78- if ( GravshipUtility . GetPlayerGravEngine_NewTemp ( vehicle . VehicleMap ) is Building_GravEngine engine )
78+ if ( GravshipUtility . GetPlayerGravEngine_NewTemp ( vehiclePawnWithMap . VehicleMap ) is { } engine )
7979 {
8080 var color = Color . white . WithAlpha ( 0 ) ;
8181 if ( ! LaunchProperties_Gravship . thrusterFlameCurve . NullOrEmpty ( ) )
@@ -88,7 +88,7 @@ protected override (Vector3 drawPos, float rotation, DynamicShadowData shadowDat
8888 }
8989 thrusterFlameBlock . Clear ( ) ;
9090 thrusterFlameBlock . SetColor ( ShaderPropertyColor2 , color ) ;
91- engine ? . GravshipComponents . OfType < CompGravshipThruster > ( )
91+ engine . GravshipComponents . OfType < CompGravshipThruster > ( )
9292 . Where ( t => t . CanBeActive )
9393 . Where ( t => ( t . Props . exhaustSettings ? . enabled ?? false ) && t . Props . exhaustSettings . ExhaustFleckDef != null )
9494 . Do ( t =>
@@ -107,11 +107,11 @@ protected override (Vector3 drawPos, float rotation, DynamicShadowData shadowDat
107107 {
108108 shaderParameter . Apply ( thrusterFlameBlock ) ;
109109 }
110- GenDraw . DrawQuad ( material , vector2 . SetToAltitude ( AltitudeLayer . Skyfaller ) . YOffsetFull ( vehicle ) , Quaternion . AngleAxis ( rot . AsAngle + rotation , Vector3 . up ) , num , thrusterFlameBlock ) ;
110+ GenDraw . DrawQuad ( material , vector2 . SetToAltitude ( AltitudeLayer . Skyfaller ) . YOffsetFull ( vehiclePawnWithMap ) , Quaternion . AngleAxis ( rot . AsAngle + rotation , Vector3 . up ) , num , thrusterFlameBlock ) ;
111111 } ) ;
112112
113113 var color2 = Color . white . WithAlpha ( 0 ) ;
114- color2 *= Mathf . Lerp ( 0.75f , 1f , Mathf . PerlinNoise1D ( ( ticksPassed + ticksPassedVertical ) / TotalTicks_Takeoff ) * 100f ) ;
114+ color2 *= Mathf . Lerp ( 0.75f , 1f , Mathf . PerlinNoise1D ( ( ticksPassed + ticksPassedVertical ) / ( float ) TotalTicks_Takeoff ) * 100f ) ;
115115 if ( ! LaunchProperties_Gravship . engineGlowVerticalCurve . NullOrEmpty ( ) )
116116 {
117117 color2 . a += LaunchProperties_Gravship . engineGlowVerticalCurve . Evaluate ( TimeInAnimationVTOL ) ;
@@ -153,9 +153,9 @@ protected override (Vector3 drawPos, float rotation, DynamicShadowData shadowDat
153153 drawPos += ( offset2 - offset ) . RotatedBy ( Vehicle ? . Rotation . AsAngle ?? 0f ) + offset ;
154154 }
155155
156- if ( ModsConfig . OdysseyActive && LandingProperties_Gravship != null && Vehicle is VehiclePawnWithMap vehicle )
156+ if ( ModsConfig . OdysseyActive && LandingProperties_Gravship != null && Vehicle is VehiclePawnWithMap vehiclePawnWithMap )
157157 {
158- if ( GravshipUtility . GetPlayerGravEngine_NewTemp ( vehicle . VehicleMap ) is Building_GravEngine engine )
158+ if ( GravshipUtility . GetPlayerGravEngine_NewTemp ( vehiclePawnWithMap . VehicleMap ) is { } engine )
159159 {
160160 var color = Color . white . WithAlpha ( 0 ) ;
161161 if ( ! LandingProperties_Gravship . thrusterFlameCurve . NullOrEmpty ( ) )
@@ -168,7 +168,7 @@ protected override (Vector3 drawPos, float rotation, DynamicShadowData shadowDat
168168 }
169169 thrusterFlameBlock . Clear ( ) ;
170170 thrusterFlameBlock . SetColor ( ShaderPropertyColor2 , color ) ;
171- engine ? . GravshipComponents . OfType < CompGravshipThruster > ( )
171+ engine . GravshipComponents . OfType < CompGravshipThruster > ( )
172172 . Where ( t => t . CanBeActive )
173173 . Where ( t => ( t . Props . exhaustSettings ? . enabled ?? false ) && t . Props . exhaustSettings . ExhaustFleckDef != null )
174174 . Do ( t =>
@@ -187,11 +187,12 @@ protected override (Vector3 drawPos, float rotation, DynamicShadowData shadowDat
187187 {
188188 shaderParameter . Apply ( thrusterFlameBlock ) ;
189189 }
190- GenDraw . DrawQuad ( material , vector2 . SetToAltitude ( AltitudeLayer . Skyfaller ) . YOffsetFull ( vehicle ) , Quaternion . AngleAxis ( rot . AsAngle + rotation , Vector3 . up ) , num , thrusterFlameBlock ) ;
190+ GenDraw . DrawQuad ( material , vector2 . SetToAltitude ( AltitudeLayer . Skyfaller ) . YOffsetFull ( vehiclePawnWithMap ) , Quaternion . AngleAxis ( rot . AsAngle + rotation , Vector3 . up ) , num , thrusterFlameBlock ) ;
191191 } ) ;
192192
193193 var color2 = Color . white . WithAlpha ( 0 ) ;
194- color2 *= Mathf . Lerp ( 0.75f , 1f , Mathf . PerlinNoise1D ( ( ticksPassed + ticksPassedVertical ) / TotalTicks_Takeoff ) * 100f ) ;
194+ color2 *= Mathf . Lerp ( 0.75f , 1f ,
195+ Mathf . PerlinNoise1D ( ( ticksPassed + ticksPassedVertical ) / ( float ) TotalTicks_Takeoff ) * 100f ) ;
195196 if ( ! LandingProperties_Gravship . engineGlowVerticalCurve . NullOrEmpty ( ) )
196197 {
197198 color2 . a += LandingProperties_Gravship . engineGlowVerticalCurve . Evaluate ( TimeInAnimationVTOL ) ;
@@ -208,29 +209,29 @@ protected override (Vector3 drawPos, float rotation, DynamicShadowData shadowDat
208209 return ( drawPos , rotation , shadowData ) ;
209210 }
210211
211- public override void OrderProtocol ( LaunchType launchType )
212+ public override void OrderProtocol ( LaunchType launchType_ )
212213 {
213- base . OrderProtocol ( launchType ) ;
214- if ( ! ModsConfig . OdysseyActive || Vehicle is not VehiclePawnWithMap vehicle ) return ;
214+ base . OrderProtocol ( launchType_ ) ;
215+ if ( ! ModsConfig . OdysseyActive || Vehicle is not VehiclePawnWithMap vehiclePawnWithMap ) return ;
215216
216- if ( launchType == LaunchType . Takeoff && GravshipUtility . GetPlayerGravEngine_NewTemp ( vehicle . VehicleMap ) is Building_GravEngine engine )
217+ if ( launchType_ == LaunchType . Takeoff && GravshipUtility . GetPlayerGravEngine_NewTemp ( vehiclePawnWithMap . VehicleMap ) is { } engine )
217218 {
218- if ( launchType == LaunchType . Takeoff )
219- {
220- engine . cooldownCompleteTick = GenTicks . TicksGame + ( int ) GravshipUtility . LaunchCooldownFromQuality ( engine . launchInfo ? . quality ?? 1f ) ;
221- }
219+ engine . cooldownCompleteTick = GenTicks . TicksGame + ( int ) GravshipUtility . LaunchCooldownFromQuality ( engine . launchInfo ? . quality ?? 1f ) ;
222220 }
223221 }
224222
225223 public override IEnumerable < ArrivalOption > GetArrivalOptions ( GlobalTargetInfo target )
226224 {
227- foreach ( var option in base . GetArrivalOptions ( target ) )
225+ if ( target . WorldObject is MapParent { Spawned : true , HasMap : true } mapParent && ! mapParent . EnterCooldownBlocksEntering ( ) )
228226 {
229- yield return option ;
227+ yield return new ArrivalOption ( "VF_LandVehicleTargetedLanding" . Translate ( mapParent . Label ) , new ArrivalAction_LoadMap ( vehicle , AerialVehicleArrivalModeDefOf . TargetedLanding ) ) ;
230228 }
231- if ( target . WorldObject is MapParent { Spawned : true , HasMap : false } mapParent && ! mapParent . EnterCooldownBlocksEntering ( ) )
229+ else
232230 {
233- yield return new ArrivalOption ( "VF_LandVehicleTargetedLanding" . Translate ( mapParent . Label ) , new ArrivalAction_LoadMap ( vehicle , AerialVehicleArrivalModeDefOf . TargetedLanding ) ) ;
231+ foreach ( var option in base . GetArrivalOptions ( target ) )
232+ {
233+ yield return option ;
234+ }
234235 }
235236 }
236237 }
0 commit comments