Skip to content

Commit

Permalink
Do not replace sprite mode if no change to Backpack inventory
Browse files Browse the repository at this point in the history
Which should hopefully fix compatibility issues with Jungle Helper's lantern, since it is based on sprite mode
  • Loading branch information
maddie480 committed Sep 11, 2024
1 parent c9557b4 commit 5064305
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Triggers/SetCustomInventoryTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
namespace Celeste.Mod.MaxHelpingHand.Triggers {
[CustomEntity("MaxHelpingHand/SetCustomInventoryTrigger")]
public class SetCustomInventoryTrigger : Trigger {
private int dashes = 1;
private bool dreamDash = false;
private bool groundRefills = true;
private bool backpack = true;
private readonly int dashes;
private readonly bool dreamDash;
private readonly bool groundRefills;
private readonly bool backpack;

public SetCustomInventoryTrigger(EntityData data, Vector2 offset) : base(data, offset) {
dashes = data.Int("dashes");
Expand All @@ -17,9 +17,12 @@ public SetCustomInventoryTrigger(EntityData data, Vector2 offset) : base(data, o
}

public override void OnEnter(Player player) {
(Scene as Level).Session.Inventory = new PlayerInventory(dashes, dreamDash, backpack, !groundRefills);
Session session = (Scene as Level).Session;
bool hadBackpack = session.Inventory.Backpack;

if (!SaveData.Instance.Assists.PlayAsBadeline) {
session.Inventory = new PlayerInventory(dashes, dreamDash, backpack, !groundRefills);

if (!SaveData.Instance.Assists.PlayAsBadeline && hadBackpack != backpack) {
player.ResetSprite(backpack ? PlayerSpriteMode.Madeline : PlayerSpriteMode.MadelineNoBackpack);
}
}
Expand Down

0 comments on commit 5064305

Please sign in to comment.