@@ -9,7 +9,20 @@ internal class DreamHoldable : Holdable
99 public bool AllowDreamDash
1010 {
1111 get => dreamDashCollider . Active ;
12- set => dreamDashCollider . Active = value ;
12+ set
13+ {
14+ bool changed = dreamDashCollider . Active != value ;
15+ dreamDashCollider . Active = value ;
16+
17+ if ( changed && value )
18+ {
19+ onActivate ? . Invoke ( ) ;
20+ }
21+ else if ( changed && ! value )
22+ {
23+ onDeactivate ? . Invoke ( ) ;
24+ }
25+ }
1326 }
1427
1528 private readonly Action onActivate , onDeactivate ;
@@ -34,9 +47,9 @@ private void OnDreamDashEnter(Player player)
3447 player . starFlyBloom ??= new ( new Vector2 ( 0f , - 6f ) , 0f , 16f ) { Visible = false } ;
3548 }
3649
37- public void OnDreamDashExit ( Player player )
50+ private void OnDreamDashExit ( Player player )
3851 {
39- DisableDreamDash ( ) ;
52+ AllowDreamDash = false ;
4053 if ( Input . GrabCheck && player . DashDir . Y <= 0 && player . Holding == null )
4154 {
4255 // force-allow pickup
@@ -50,22 +63,6 @@ public void OnDreamDashExit(Player player)
5063 }
5164 }
5265
53- private void EnableDreamDash ( )
54- {
55- if ( AllowDreamDash )
56- return ;
57- AllowDreamDash = true ;
58- onActivate ? . Invoke ( ) ;
59- }
60-
61- private void DisableDreamDash ( )
62- {
63- if ( ! AllowDreamDash )
64- return ;
65- AllowDreamDash = false ;
66- onDeactivate ? . Invoke ( ) ;
67- }
68-
6966 public override void Added ( Entity entity )
7067 {
7168 base . Added ( entity ) ;
@@ -100,7 +97,7 @@ public override void Update()
10097
10198 if ( ( Holder is null && ( ( Entity as Actor ) ? . OnGround ( ) ?? false ) ) || ( Holder is Player player && player . OnGround ( ) ) )
10299 {
103- EnableDreamDash ( ) ;
100+ AllowDreamDash = true ;
104101 }
105102 }
106103
@@ -134,7 +131,7 @@ private static bool Holdable_Check(On.Celeste.Holdable.orig_Check orig, Holdable
134131 private static bool Holdable_HitSpring ( On . Celeste . Holdable . orig_HitSpring orig , Holdable self , Spring spring )
135132 {
136133 if ( self is DreamHoldable holdable )
137- holdable . EnableDreamDash ( ) ;
134+ holdable . AllowDreamDash = true ;
138135 return orig ( self , spring ) ;
139136 }
140137
@@ -162,7 +159,7 @@ private static bool Player_SideBounce(On.Celeste.Player.orig_SideBounce orig, Pl
162159 {
163160 bool result = orig ( self , dir , fromX , fromY ) ;
164161 if ( result && self . Holding is DreamHoldable holdable )
165- holdable . EnableDreamDash ( ) ;
162+ holdable . AllowDreamDash = true ;
166163 return result ;
167164 }
168165
0 commit comments