From 5064305f39640fe7888fad336d23f0b873b48e7c Mon Sep 17 00:00:00 2001 From: Maddie <52103563+maddie480@users.noreply.github.com> Date: Wed, 11 Sep 2024 21:28:41 +0200 Subject: [PATCH] Do not replace sprite mode if no change to Backpack inventory Which should hopefully fix compatibility issues with Jungle Helper's lantern, since it is based on sprite mode --- Triggers/SetCustomInventoryTrigger.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Triggers/SetCustomInventoryTrigger.cs b/Triggers/SetCustomInventoryTrigger.cs index b92de85b..b84b3784 100644 --- a/Triggers/SetCustomInventoryTrigger.cs +++ b/Triggers/SetCustomInventoryTrigger.cs @@ -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"); @@ -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); } }