55
66namespace Celeste . Mod . VortexHelper . Entities {
77 [ CustomEntity ( "VortexHelper/BowlPuffer" ) ]
8- class BowlPuffer : Actor {
8+ public class BowlPuffer : Actor {
99
1010 [ Tracked ( false ) ]
1111 public class BowlPufferCollider : Component {
@@ -330,18 +330,7 @@ private void Explode(bool playsound = true) {
330330 }
331331
332332 private void DoEntityCustomInteraction ( ) {
333- // Player
334- Player player = CollideFirst < Player > ( ) ;
335- if ( player != null ) {
336- player . ExplodeLaunch ( Position , snapUp : false , sidesOnly : true ) ;
337- }
338- player = SceneAs < Level > ( ) . Tracker . GetEntity < Player > ( ) ;
339-
340- // Theo Crystal
341- TheoCrystal theoCrystal = CollideFirst < TheoCrystal > ( ) ;
342- if ( theoCrystal != null && ! Scene . CollideCheck < Solid > ( Position , theoCrystal . Center ) ) {
343- theoCrystal . ExplodeLaunch ( Position ) ;
344- }
333+ Player player = SceneAs < Level > ( ) . Tracker . GetEntity < Player > ( ) ;
345334
346335 // Touch Switches
347336 foreach ( TouchSwitch entity2 in Scene . Tracker . GetEntities < TouchSwitch > ( ) ) {
@@ -358,69 +347,57 @@ private void DoEntityCustomInteraction() {
358347 }
359348
360349 foreach ( Actor e in CollideAll < Actor > ( ) ) {
361- if ( e is Puffer ) {
362- VortexHelperModule . Puffer_Explode . Invoke ( e , new object [ ] { } ) ;
363- VortexHelperModule . Puffer_GotoGone . Invoke ( e , new object [ ] { } ) ;
364- continue ;
365- }
366-
367- if ( e is BowlPuffer && e != this ) {
368- BowlPuffer e_ = e as BowlPuffer ;
369- e_ . chainExplode = ( ! e_ . exploded && e_ . state != States . Gone ) ;
370-
350+ switch ( e ) {
351+ case Player p :
352+ p . ExplodeLaunch ( Position , snapUp : false , sidesOnly : true ) ;
353+ break ;
354+ case TheoCrystal crystal :
355+ if ( ! Scene . CollideCheck < Solid > ( Position , crystal . Center ) )
356+ crystal . ExplodeLaunch ( Position ) ;
357+ break ;
358+ case Puffer puffer :
359+ VortexHelperModule . Puffer_Explode . Invoke ( puffer , null ) ;
360+ VortexHelperModule . Puffer_GotoGone . Invoke ( puffer , null ) ;
361+ break ;
362+ case BowlPuffer puffer :
363+ puffer . chainExplode = ! puffer . exploded && puffer . state != States . Gone ;
364+ break ;
371365 }
372366 }
373367
374368 foreach ( Solid e in CollideAll < Solid > ( ) ) {
375- // Temple Cracked Blocks
376- if ( e is TempleCrackedBlock ) {
377- ( e as TempleCrackedBlock ) . Break ( Position ) ; continue ;
378- }
379-
380- // Color Switches
381- if ( e is ColorSwitch ) {
382- ( e as ColorSwitch ) . Switch ( Calc . FourWayNormal ( e . Center - Center ) ) ; continue ;
383- }
384-
385- // Dash Blocks
386- if ( e is DashBlock ) {
387- ( e as DashBlock ) . Break ( Center , Calc . FourWayNormal ( e . Center - Center ) , true , true ) ; continue ;
388- }
389-
390- // Falling Blocks
391- if ( e is FallingBlock ) {
392- ( e as FallingBlock ) . Triggered = true ; continue ;
393- }
394-
395- // Move Blocks
396- if ( e is MoveBlock ) {
397- ( e as MoveBlock ) . OnStaticMoverTrigger ( null ) ; continue ;
398- }
399-
400- // Kevins
401- if ( e is CrushBlock ) {
402- // e.OnDashed(Player player = null, Vector2 direction = Calc.FourWayNormal(e.Center - Center));
403- VortexHelperModule . CrushBlock_OnDashed . Invoke ( e as CrushBlock , new object [ ] { null , Calc . FourWayNormal ( e . Center - Center ) } ) ;
404- continue ;
405- }
406-
407- // Bubble Wrap Blocks
408- if ( e is BubbleWrapBlock ) {
409- ( e as BubbleWrapBlock ) . Break ( ) ;
410- continue ;
411- }
412-
413- // Lightning Breaker Boxes
414- if ( e is LightningBreakerBox ) {
415- if ( player != null ) {
416- float stamina = player . Stamina ;
417- int dashes = player . Dashes ;
418- ( e as LightningBreakerBox ) . OnDashCollide ( player , Calc . FourWayNormal ( e . Center - Center ) ) ;
419- player . Dashes = dashes ;
420- player . Stamina = stamina ;
421- }
422- continue ;
423- }
369+ switch ( e ) {
370+ case TempleCrackedBlock block :
371+ block . Break ( Position ) ;
372+ break ;
373+ case ColorSwitch @switch :
374+ @switch . Switch ( Calc . FourWayNormal ( e . Center - Center ) ) ;
375+ break ;
376+ case DashBlock block :
377+ block . Break ( Center , Calc . FourWayNormal ( e . Center - Center ) , true , true ) ;
378+ break ;
379+ case FallingBlock block :
380+ block . Triggered = true ;
381+ break ;
382+ case MoveBlock block :
383+ block . OnStaticMoverTrigger ( null ) ;
384+ break ;
385+ case CrushBlock block :
386+ VortexHelperModule . CrushBlock_OnDashed . Invoke ( block , new object [ ] { null , Calc . FourWayNormal ( block . Center - Center ) } ) ;
387+ break ;
388+ case BubbleWrapBlock block :
389+ block . Break ( ) ;
390+ break ;
391+ case LightningBreakerBox box :
392+ if ( player != null ) {
393+ float stamina = player . Stamina ;
394+ int dashes = player . Dashes ;
395+ box . OnDashCollide ( player , Calc . FourWayNormal ( box . Center - Center ) ) ;
396+ player . Dashes = dashes ;
397+ player . Stamina = stamina ;
398+ }
399+ break ;
400+ } ;
424401 }
425402 }
426403
0 commit comments