Skip to content

Commit

Permalink
fix Nullable`1 crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
Viv-0 committed Jan 18, 2024
1 parent b626b93 commit a82597c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Code/Entities/FloorBooster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ private static int Player_NormalUpdate(On.Celeste.Player.orig_NormalUpdate orig,
{
DynamicData playerData = DynamicData.For(self);

// thanks max480 for the bug report.
// thanks maddie480 for the bug report.
if (!playerData.Data.ContainsKey("lastFloorBooster"))
playerData.Set("lastFloorBooster", null);

Expand Down
9 changes: 7 additions & 2 deletions Code/Entities/PurpleBooster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
using MonoMod.Utils;
using System;
using System.Collections;
using System.Reflection;

namespace Celeste.Mod.VortexHelper.Entities;

[CustomEntity("VortexHelper/PurpleBooster")]
[Tracked]
public class PurpleBooster : Entity
{
// TEMPORARY - MonoMod has a bug rn that crashes if you use DynamicData setting on a Nullable`1
private static FieldInfo player_LaunchApproachX = typeof(Player).GetField("launchApproachX", BindingFlags.Instance | BindingFlags.NonPublic);

internal const string POSSIBLE_EARLY_DASHSPEED = "purpleBoostPossibleEarlyDashSpeed";
internal const string QUALITYOFLIFEUPDATE = "purpleBoostQoL";

Expand Down Expand Up @@ -343,7 +347,7 @@ public static void PurpleBoostBegin()
flag = null;
else
{
MapMetaModeProperties meta = level.Session.MapData.GetMeta();
MapMetaModeProperties meta = level.Session.MapData.Meta;
flag = meta?.TheoInBubble;
}

Expand Down Expand Up @@ -522,7 +526,8 @@ public static void PurpleBoosterExplodeLaunch(Player player, DynamicData playerD
bool QoL = playerData?.Get(QUALITYOFLIFEUPDATE) is bool b && b;
Input.Rumble(RumbleStrength.Strong, RumbleLength.Medium);
Celeste.Freeze(QoL ? 0.05f : 0.1f);
playerData.Set("launchApproachX", null);
player_LaunchApproachX.SetValue(player, null);
//playerData.Set("launchApproachX", new float?()); TEMPORARY - MonoMod has a bug rn that crashes if you use DynamicData setting on a Nullable`1
Level level = player.SceneAs<Level>();

if (origin is not null)
Expand Down

0 comments on commit a82597c

Please sign in to comment.