Esempio n. 1
0
        private void onStrawberryCollected(On.Celeste.Strawberry.orig_OnPlayer orig, Strawberry self, Player player)
        {
            if (!Settings.AllStrawberriesAreGoldens)
            {
                orig(self, player);
                return;
            }

            // if the strawberry is actually collected by the player, vanilla code switches ReturnHomeWhenLost to true.
            // so, we'll use that to spare us some reflection or IL modding.
            bool origReturnHome = self.ReturnHomeWhenLost;

            self.ReturnHomeWhenLost = false;

            orig(self, player);

            bool wasCollected = self.ReturnHomeWhenLost;

            self.ReturnHomeWhenLost = origReturnHome;

            if (wasCollected)
            {
                // store the inventory to restore it if needed.
                new DynData <Strawberry>(self)["playerInventoryOnCollection"] = player.Inventory;
            }
        }
Esempio n. 2
0
 private void PatchCollectBerry(On.Celeste.Strawberry.orig_OnPlayer orig, Strawberry self, Player player)
 {
     PerformAutoBubble(self);
     orig(self, player);
 }