Skip to content

Commit

Permalink
fix: Using captured variable in CustomPuffer hook
Browse files Browse the repository at this point in the history
  • Loading branch information
psyGamer committed Feb 2, 2025
1 parent 8546854 commit b806c70
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ private static void Initialize() {
}
});

if (ModUtils.GetType("CrystallineHelper", "vitmod.CustomPuffer") is { } customPufferType &&
customPufferType.CreateGetDelegate<Entity, Circle>("pushRadius") is { } getPushRadius) {
customPufferType.GetMethodInfo("Explode")
.HookBefore<Entity>(self => pufferPushRadius.Add(new Circle(getPushRadius.Invoke(self).Radius, self.X, self.Y)));
if (ModUtils.GetType("CrystallineHelper", "vitmod.CustomPuffer") is { } customPufferType) {
customPufferType.GetMethodInfo("Explode")?
.HookBefore<Entity>(self => pufferPushRadius.Add(new Circle(self.GetFieldValue<Circle>("pushRadius")!.Radius, self.X, self.Y)));
// its debug render also needs optimize
// but i have no good idea, so i put it aside
}
Expand Down

0 comments on commit b806c70

Please sign in to comment.