1
1
using Celeste . Mod . SpeedrunTool . SaveLoad ;
2
- using Celeste . Mod . TASHelper . Entities ;
3
2
using Celeste . Mod . TASHelper . Module . Menu ;
4
3
using Celeste . Mod . TASHelper . Utils ;
5
4
using Microsoft . Xna . Framework ;
@@ -26,21 +25,23 @@ public static class ExtraSlActions {
26
25
public static List < SRT > SRT_Actions = new ( ) ;
27
26
28
27
// we want to ensure these actions are added lastly
28
+
29
29
[ Initialize ]
30
- public static void Load ( ) {
30
+ public static void LoadSRT ( ) {
31
+ SRT_Actions . Add ( TasHelperSL . CreateSRT ( ) ) ;
32
+ foreach ( SRT action in SRT_Actions ) {
33
+ SRT . Add ( action ) ;
34
+ }
35
+ }
36
+
37
+ public static void LoadTH ( ) {
31
38
TH_Actions . Add ( TasModSL . Create ( ) ) ;
32
39
// tas mod already adds to SRT itself
33
40
TH_Actions . Add ( TasHelperSL . Create ( ) ) ;
34
-
35
- //TH_Actions.Add(GravityHelperSL.Create());
36
-
37
- SRT_Actions . Add ( TasHelperSL . CreateSRT ( ) ) ;
41
+ TH_Actions . Add ( GravityHelperSL . Create ( ) ) ;
38
42
foreach ( TH action in TH_Actions ) {
39
43
TH . Add ( action ) ;
40
44
}
41
- foreach ( SRT action in SRT_Actions ) {
42
- SRT . Add ( action ) ;
43
- }
44
45
}
45
46
46
47
[ Unload ]
@@ -140,7 +141,6 @@ public static TH Create() {
140
141
141
142
internal static class TasHelperSL {
142
143
143
-
144
144
private static float DashTime ;
145
145
private static bool Frozen ;
146
146
private static int TransitionFrames ;
@@ -157,7 +157,6 @@ internal static class TasHelperSL {
157
157
private static Dictionary < Entity , bool > TH_LastCollidables = new ( ) ;
158
158
public static TH Create ( ) {
159
159
TH . SlAction save = ( _ , _ ) => {
160
-
161
160
DashTime = GameInfo . DashTime ;
162
161
Frozen = GameInfo . Frozen ;
163
162
TransitionFrames = GameInfo . TransitionFrames ;
@@ -169,7 +168,6 @@ public static TH Create() {
169
168
TH_LastCollidables = ActualEntityCollideHitbox . LastColldables . TH_DeepCloneShared ( ) ;
170
169
} ;
171
170
TH . SlAction load = ( _ , _ ) => {
172
-
173
171
GameInfo . DashTime = DashTime ;
174
172
GameInfo . Frozen = Frozen ;
175
173
GameInfo . TransitionFrames = TransitionFrames ;
@@ -201,14 +199,12 @@ public static TH Create() {
201
199
202
200
public static SRT CreateSRT ( ) {
203
201
SRT . SlAction save = ( _ , _ ) => {
204
-
205
202
SRT_freezeTimerBeforeUpdateBeforePredictLoops = Predictor . Core . FreezeTimerBeforeUpdate ;
206
203
SRT_CachedNodes = Gameplay . MovingEntityTrack . CachedNodes . DeepCloneShared ( ) ;
207
204
SRT_CachedStartEnd = Gameplay . MovingEntityTrack . CachedStartEnd . DeepCloneShared ( ) ;
208
205
SRT_CachedCircle = Gameplay . MovingEntityTrack . CachedCircle . DeepCloneShared ( ) ;
209
206
} ;
210
207
SRT . SlAction load = ( _ , _ ) => {
211
-
212
208
Predictor . Core . FreezeTimerBeforeUpdate = SRT_freezeTimerBeforeUpdateBeforePredictLoops ;
213
209
Gameplay . MovingEntityTrack . CachedNodes = SRT_CachedNodes . DeepCloneShared ( ) ;
214
210
Gameplay . MovingEntityTrack . CachedStartEnd = SRT_CachedStartEnd . DeepCloneShared ( ) ;
@@ -240,6 +236,8 @@ internal static class GravityHelperSL {
240
236
public static bool Installed = false ;
241
237
242
238
public static object PlayerGravityComponent ;
239
+ // dont know why, this become null after SL, so I have to manually clone it
240
+ // while the original SRT doesn't have this issue
243
241
public static TH Create ( ) {
244
242
Installed = ModUtils . GetType ( "GravityHelper" , "Celeste.Mod.GravityHelper.GravityHelperModule" ) ? . GetPropertyInfo ( "PlayerComponent" ) is not null ;
245
243
TH . SlAction save = ( _ , _ ) => {
@@ -249,7 +247,7 @@ public static TH Create() {
249
247
} ;
250
248
TH . SlAction load = ( _ , _ ) => {
251
249
if ( Installed ) {
252
- ModUtils . GetType ( "GravityHelper" , "Celeste.Mod.GravityHelper.GravityHelperModule" ) . SetPropertyValue ( "PlayerComponent" , PlayerGravityComponent ) ;
250
+ ModUtils . GetType ( "GravityHelper" , "Celeste.Mod.GravityHelper.GravityHelperModule" ) . SetPropertyValue ( "PlayerComponent" , PlayerGravityComponent . TH_DeepCloneShared ( ) ) ;
253
251
}
254
252
} ;
255
253
Action clear = ( ) => {
0 commit comments