Skip to content

Commit 2f18b3b

Browse files
committedNov 30, 2023
bugfix: predictor makes gravity helper not working
1 parent ecbe18b commit 2f18b3b

File tree

6 files changed

+21
-22
lines changed

6 files changed

+21
-22
lines changed
 

‎Source/Entities/PauseUpdater.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ public static class PauseUpdater {
99
private static int levelPauseTags;
1010

1111
[Tracked]
12-
public class PauseUpdateComponent :Component{
13-
public PauseUpdateComponent() : base(true, false){
12+
public class PauseUpdateComponent : Component {
13+
public PauseUpdateComponent() : base(true, false) {
1414

1515
}
1616
}
@@ -23,6 +23,7 @@ public static void Initialize() {
2323
}
2424
catch {
2525
// idk, but there's such bug report
26+
// https://discord.com/channels/403698615446536203/1175568290303725669
2627
levelPauseTags = 0;
2728
Logger.Log(LogLevel.Info, "TAS Helper", "An error occurred when PauseUpdater initializes!");
2829
}

‎Source/Gameplay/ActualCollideHitboxDelegatee.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal static class ActualCollideHitboxDelegatee {
1313

1414
[Initialize]
1515
private static void Initiailize() {
16-
16+
1717
typeof(ActualEntityCollideHitbox).GetMethod("SaveActualCollidable", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).HookAfter<Entity>(
1818
e => {
1919
if (TasHelperSettings.Enabled && SpinnerCalculateHelper.HazardType(e) != null) {
@@ -25,7 +25,7 @@ private static void Initiailize() {
2525
typeof(ActualEntityCollideHitbox).GetMethod("Clear", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).HookAfter(() => {
2626
LastCollidables.Clear();
2727
});
28-
28+
2929
typeof(ActualEntityCollideHitbox).GetMethod("LoadActualCollidePosition", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).IlHook(il => {
3030
ILCursor cursor = new(il);
3131
Instruction start = cursor.Next;

‎Source/TinySRT/ExtraSlActions.cs

+13-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Celeste.Mod.SpeedrunTool.SaveLoad;
2-
using Celeste.Mod.TASHelper.Entities;
32
using Celeste.Mod.TASHelper.Module.Menu;
43
using Celeste.Mod.TASHelper.Utils;
54
using Microsoft.Xna.Framework;
@@ -26,21 +25,23 @@ public static class ExtraSlActions {
2625
public static List<SRT> SRT_Actions = new();
2726

2827
// we want to ensure these actions are added lastly
28+
2929
[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() {
3138
TH_Actions.Add(TasModSL.Create());
3239
// tas mod already adds to SRT itself
3340
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());
3842
foreach (TH action in TH_Actions) {
3943
TH.Add(action);
4044
}
41-
foreach (SRT action in SRT_Actions) {
42-
SRT.Add(action);
43-
}
4445
}
4546

4647
[Unload]
@@ -140,7 +141,6 @@ public static TH Create() {
140141

141142
internal static class TasHelperSL {
142143

143-
144144
private static float DashTime;
145145
private static bool Frozen;
146146
private static int TransitionFrames;
@@ -157,7 +157,6 @@ internal static class TasHelperSL {
157157
private static Dictionary<Entity, bool> TH_LastCollidables = new();
158158
public static TH Create() {
159159
TH.SlAction save = (_, _) => {
160-
161160
DashTime = GameInfo.DashTime;
162161
Frozen = GameInfo.Frozen;
163162
TransitionFrames = GameInfo.TransitionFrames;
@@ -169,7 +168,6 @@ public static TH Create() {
169168
TH_LastCollidables = ActualEntityCollideHitbox.LastColldables.TH_DeepCloneShared();
170169
};
171170
TH.SlAction load = (_, _) => {
172-
173171
GameInfo.DashTime = DashTime;
174172
GameInfo.Frozen = Frozen;
175173
GameInfo.TransitionFrames = TransitionFrames;
@@ -201,14 +199,12 @@ public static TH Create() {
201199

202200
public static SRT CreateSRT() {
203201
SRT.SlAction save = (_, _) => {
204-
205202
SRT_freezeTimerBeforeUpdateBeforePredictLoops = Predictor.Core.FreezeTimerBeforeUpdate;
206203
SRT_CachedNodes = Gameplay.MovingEntityTrack.CachedNodes.DeepCloneShared();
207204
SRT_CachedStartEnd = Gameplay.MovingEntityTrack.CachedStartEnd.DeepCloneShared();
208205
SRT_CachedCircle = Gameplay.MovingEntityTrack.CachedCircle.DeepCloneShared();
209206
};
210207
SRT.SlAction load = (_, _) => {
211-
212208
Predictor.Core.FreezeTimerBeforeUpdate = SRT_freezeTimerBeforeUpdateBeforePredictLoops;
213209
Gameplay.MovingEntityTrack.CachedNodes = SRT_CachedNodes.DeepCloneShared();
214210
Gameplay.MovingEntityTrack.CachedStartEnd = SRT_CachedStartEnd.DeepCloneShared();
@@ -240,6 +236,8 @@ internal static class GravityHelperSL {
240236
public static bool Installed = false;
241237

242238
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
243241
public static TH Create() {
244242
Installed = ModUtils.GetType("GravityHelper", "Celeste.Mod.GravityHelper.GravityHelperModule")?.GetPropertyInfo("PlayerComponent") is not null;
245243
TH.SlAction save = (_, _) => {
@@ -249,7 +247,7 @@ public static TH Create() {
249247
};
250248
TH.SlAction load = (_, _) => {
251249
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());
253251
}
254252
};
255253
Action clear = () => {

‎Source/TinySRT/SlExtensions.cs

-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
using FMOD.Studio;
66
using Force.DeepCloner;
77
using Force.DeepCloner.Helpers;
8-
using Mono.Cecil.Cil;
98
using Monocle;
10-
using MonoMod.Cil;
119
using System.Collections.Concurrent;
1210
using System.Reflection;
1311
using System.Runtime.CompilerServices;

‎Source/TinySRT/TH_SaveLoadAction.cs

+2
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ public static void InitActions() {
228228
TH_FrostHelperUtils.SupportFrostHelper();
229229
SupportVivHelper();
230230

231+
ExtraSlActions.LoadTH();
232+
231233
// 放最后,确保收集了所有克隆的 VirtualAssets 与 EventInstance
232234
ReloadVirtualAssets();
233235
ReleaseEventInstances();

‎everest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- Name: TASHelper
2-
Version: 1.8.8
2+
Version: 1.8.9
33
DLL: bin/Release/net4.5.2/TASHelper.dll
44
Dependencies:
55
- Name: Everest

0 commit comments

Comments
 (0)
Please sign in to comment.