|
4 | 4 | using Monocle; |
5 | 5 | using Celeste.Mod.Entities; |
6 | 6 | using System.Reflection; |
7 | | - |
| 7 | +using System; |
| 8 | + |
8 | 9 | /* |
9 | 10 | * Safe Respawn Crumble (Spring Collab 2020) |
10 | 11 | * https://github.com/EverestAPI/SpringCollab2020/ |
|
16 | 17 | * It performs a similar role to Mario Maker's pink block platform, |
17 | 18 | * which only spawns when a user playtests their level from an aerial position |
18 | 19 | * and disappears once the user jumps off of it. |
19 | | - */ |
| 20 | + */ |
20 | 21 | namespace Celeste.Mod.SpringCollab2020.Entities { |
21 | 22 | [Tracked(false)] |
22 | 23 | [CustomEntity("SpringCollab2020/safeRespawnCrumble")] |
@@ -45,7 +46,7 @@ public override void Added(Scene scene) { |
45 | 46 | outlineTiles.Add(toDraw); |
46 | 47 | } else { |
47 | 48 | // Select left, middle, or right |
48 | | - for (int tile = 0; (float)tile < base.Width; tile += 8) { |
| 49 | + for (int tile = 0; (float) tile < base.Width; tile += 8) { |
49 | 50 | int tileTex; |
50 | 51 | if (tile == 0) |
51 | 52 | tileTex = 0; |
@@ -92,7 +93,7 @@ public override void Added(Scene scene) { |
92 | 93 | } |
93 | 94 |
|
94 | 95 | private IEnumerator Sequence() { |
95 | | - for (;;) { |
| 96 | + for (; ; ) { |
96 | 97 | // Wait until activated |
97 | 98 | Collidable = false; |
98 | 99 | while (!activated) |
@@ -153,18 +154,23 @@ private IEnumerator TileFade(float to, List<Image> targetTiles, bool fast = fals |
153 | 154 |
|
154 | 155 | // Bubble and player detection hooks |
155 | 156 | public static void Load() { |
156 | | - On.Celeste.Player.CassetteFlyEnd += SafeActivatorCasetteFly; |
| 157 | + On.Celeste.Player.CassetteFlyCoroutine += SafeActivatorCassetteFly; |
157 | 158 | On.Celeste.Player.IntroRespawnBegin += SafeActivatorRespawn; |
158 | | - } |
| 159 | + } |
| 160 | + |
159 | 161 | public static void Unload() { |
160 | | - On.Celeste.Player.CassetteFlyEnd -= SafeActivatorCasetteFly; |
| 162 | + On.Celeste.Player.CassetteFlyCoroutine -= SafeActivatorCassetteFly; |
161 | 163 | On.Celeste.Player.IntroRespawnBegin -= SafeActivatorRespawn; |
| 164 | + } |
| 165 | + |
| 166 | + private static IEnumerator SafeActivatorCassetteFly(On.Celeste.Player.orig_CassetteFlyCoroutine orig, Player self) { |
| 167 | + IEnumerator origEnum = orig(self); |
| 168 | + while (origEnum.MoveNext()) |
| 169 | + yield return origEnum.Current; |
| 170 | + |
| 171 | + SafeActivate(self, false); |
162 | 172 | } |
163 | 173 |
|
164 | | - private static void SafeActivatorCasetteFly(On.Celeste.Player.orig_CassetteFlyEnd orig, Player self) { |
165 | | - orig(self); |
166 | | - SafeActivate(self, false); |
167 | | - } |
168 | 174 | private static void SafeActivatorRespawn(On.Celeste.Player.orig_IntroRespawnBegin orig, Player self) { |
169 | 175 | orig(self); |
170 | 176 | SafeActivate(self, true); |
|
0 commit comments