Exemple #1
0
        private static void OnChapterPanelUpdateStats(On.Celeste.OuiChapterPanel.orig_UpdateStats orig, OuiChapterPanel self, bool wiggle,
                                                      bool?overrideStrawberryWiggle, bool?overrideDeathWiggle, bool?overrideHeartWiggle)
        {
            orig(self, wiggle, overrideStrawberryWiggle, overrideDeathWiggle, overrideHeartWiggle);

            if (Engine.Scene == overworldWrapper?.Scene)
            {
                AreaModeStats areaModeStats = self.DisplayedStats.Modes[(int)self.Area.Mode];
                DeathsCounter deathsCounter = new DynData <OuiChapterPanel>(self).Get <DeathsCounter>("deaths");
                deathsCounter.Visible = areaModeStats.Deaths > 0 && !AreaData.Get(self.Area).Interlude_Safe;

                // mod the death icon
                string pathToSkull = "CollabUtils2/skulls/" + self.Area.GetLevelSet();
                if (GFX.Gui.Has(pathToSkull))
                {
                    new DynData <DeathsCounter>(deathsCounter)["icon"] = GFX.Gui[pathToSkull];
                }
            }


            if (isPanelShowingLobby(self) || Engine.Scene == overworldWrapper?.Scene)
            {
                // turn strawberry counter into golden if there is no berry in the map
                if (AreaData.Get(self.Area).Mode[0].TotalStrawberries == 0)
                {
                    StrawberriesCounter strawberriesCounter = new DynData <OuiChapterPanel>(self).Get <StrawberriesCounter>("strawberries");
                    strawberriesCounter.Golden    = true;
                    strawberriesCounter.ShowOutOf = false;
                }
            }
        }
Exemple #2
0
        private static void onLevelUpdate(On.Celeste.Level.orig_Update orig, Level self)
        {
            orig(self);

            // check if the player is in a color grade fade trigger
            Player player = self.Tracker.GetEntity <Player>();
            ColorGradeFadeTrigger trigger = self.Tracker.GetEntities <ColorGradeFadeTrigger>().OfType <ColorGradeFadeTrigger>()
                                            .FirstOrDefault(t => t.evenDuringReflectionFall ? player?.Collider.Collide(t) ?? false : t.playerInside);

            if (player != null && trigger != null)
            {
                DynData <Level> selfData = new DynData <Level>(self);

                // the game fades from lastColorGrade to Session.ColorGrade using colorGradeEase as a lerp value.
                // let's hijack that!
                float positionLerp = trigger.GetPositionLerp(player, trigger.direction);
                if (positionLerp > 0.5f)
                {
                    // we are closer to B. let B be the target color grade when player exits the trigger / dies in it
                    selfData["lastColorGrade"] = trigger.colorGradeA;
                    self.Session.ColorGrade    = trigger.colorGradeB;
                    selfData["colorGradeEase"] = positionLerp;
                }
                else
                {
                    // we are closer to A. let A be the target color grade when player exits the trigger / dies in it
                    selfData["lastColorGrade"] = trigger.colorGradeB;
                    self.Session.ColorGrade    = trigger.colorGradeA;
                    selfData["colorGradeEase"] = 1 - positionLerp;
                }
                selfData["colorGradeEaseSpeed"] = 1f;
            }
        }
        private IEnumerator Cutscene(Level level)
        {
            // wait for the respawn animation to be over.
            while (player.StateMachine.State != 0)
            {
                yield return(null);
            }

            player.StateMachine.State = 11;

            yield return(0.5f);

            // pan the camera to the door.
            yield return(CameraTo(door.Center - new Vector2(160f - door.Size / 2, 90f), 1f, Ease.CubeOut));

            // make door open.
            door.ForceTrigger = true;

            // wait for door to be open.
            DynData <HeartGemDoor> doorData = new DynData <HeartGemDoor>(door);

            while (doorData.Get <float>("openPercent") < 1f)
            {
                yield return(null);
            }
            yield return(1f);

            // pan back to player.
            yield return(CameraTo(player.CameraTarget, 1f, Ease.CubeOut));

            // cutscene over.
            EndCutscene(level);
        }
Exemple #4
0
        private static void OnChapterPanelSwap(On.Celeste.OuiChapterPanel.orig_Swap orig, OuiChapterPanel self)
        {
            if (Engine.Scene != overworldWrapper?.Scene ||
                (!Dialog.Has(new DynData <Overworld>(overworldWrapper.WrappedScene).Get <AreaData>("collabInGameForcedArea").Name + "_collabcredits") &&
                 !CollabModule.Instance.SaveData.SessionsPerLevel.ContainsKey(self.Area.GetSID())))
            {
                // this isn't an in-game chapter panel, or there is no custom second page (no credits, no saved state) => use vanilla
                orig(self);
                return;
            }

            DynData <OuiChapterPanel> data = new DynData <OuiChapterPanel>(self);
            bool selectingMode             = data.Get <bool>("selectingMode");

            if ((int)self.Area.Mode >= 1 && selectingMode)
            {
                return;
            }

            if (!selectingMode)
            {
                orig(self);
                return;
            }

            string areaName = new DynData <Overworld>(self.Overworld).Get <AreaData>("collabInGameForcedArea").Name;

            data["collabCredits"]     = Dialog.Clean(areaName + "_collabcredits");
            data["collabCreditsTags"] = (areaName + "_collabcreditstags").DialogCleanOrNull();
            self.Focused = false;
            self.Overworld.ShowInputUI = !selectingMode;
            self.Add(new Coroutine(ChapterPanelSwapRoutine(self, data)));
        }
 internal static void Break(On.Celeste.CrumbleWallOnRumble.orig_Break orig, CrumbleWallOnRumble self)
 {
     if (self is FancyCrumbleWallOnRumble)
     {
         if (self.Collidable && self.Scene != null)
         {
             FancyCrumbleWallOnRumble block = (self as FancyCrumbleWallOnRumble);
             Audio.Play("event:/new_content/game/10_farewell/quake_rockbreak", block.Position);
             block.Collidable = false;
             for (int x = 0; x < block.Width / 8f; x++)
             {
                 for (int y = 0; y < block.Height / 8f; y++)
                 {
                     if (!IsEmpty(block.tileMap[x, y]) && !block.Scene.CollideCheck <Solid>(new Rectangle((int)block.X + x * 8, (int)block.Y + y * 8, 8, 8)))
                     {
                         block.Scene.Add(Engine.Pooler.Create <Debris>().Init(block.Position + new Vector2(4 + x * 8, 4 + y * 8), block.tileMap[x, y], true).BlastFrom(block.TopCenter));
                     }
                 }
             }
             DynData <CrumbleWallOnRumble> blockData = new DynData <CrumbleWallOnRumble>(block);
             if (blockData.Get <bool>("permanent"))
             {
                 block.SceneAs <Level>().Session.DoNotLoad.Add(blockData.Get <EntityID>("id"));
             }
             block.RemoveSelf();
         }
     }
     else
     {
         orig(self);
     }
 }
        private void OnPlayerSprite_ctor(On.Celeste.PlayerSprite.orig_ctor orig, Celeste.PlayerSprite self, PlayerSpriteMode mode)
        {
            orig(self, mode);
            if (Settings.Enabled && (self.Mode == PlayerSpriteMode.Madeline || self.Mode == PlayerSpriteMode.MadelineNoBackpack))
            {
                string id = "";
                switch (self.Mode)
                {
                case PlayerSpriteMode.Madeline:
                    id = "player_KaydenFox";
                    break;

                case PlayerSpriteMode.MadelineNoBackpack:
                    id = "player_no_backpack_KaydenFox";
                    break;
                }

                DynData <Celeste.PlayerSprite> spriteDynData = new DynData <Celeste.PlayerSprite>(self);
                spriteDynData.Set("spriteName", id);
                if (!self.HasHair)
                {
                    Celeste.PlayerSprite.CreateFramesMetadata(id);
                }

                Celeste.GFX.SpriteBank.CreateOn(self, id);
            }
        }
        public override void Added(Scene scene)
        {
            // if the gate was already opened on that save or in that session, open the door right away by setting the flag.
            (scene as Level).Session.SetFlag("opened_heartgem_door_" + Requires,
                                             (scene as Level).Session.GetFlag("opened_mini_heart_door_" + entityID) || CollabModule.Instance.SaveData.OpenedMiniHeartDoors.Contains(GetDoorSaveDataID(scene)));

            base.Added(scene);

            DynData <HeartGemDoor> self = new DynData <HeartGemDoor>(this);

            TopSolid    = self.Get <Solid>("TopSolid");
            BottomSolid = self.Get <Solid>("BotSolid");

            // resize the gate: it shouldn't take the whole screen height.
            TopSolid.Collider.Height    = height;
            BottomSolid.Collider.Height = height;
            TopSolid.Top       = Y - height;
            BottomSolid.Bottom = Y + height;

            if (Opened)
            {
                // place the blocks correctly in an open position.
                float openDistance = self.Get <float>("openDistance");
                TopSolid.Collider.Height    -= openDistance;
                BottomSolid.Collider.Height -= openDistance;
                BottomSolid.Top             += openDistance;
            }
        }
        private static bool PlayerUseRefill(On.Celeste.Player.orig_UseRefill orig, Player self, bool twoDashes)
        {
            DynData <Player> selfData = new DynData <Player>(self);

            if (selfData.Data.ContainsKey("DJMapHelper_RefillColor") && selfData["DJMapHelper_RefillColor"] != null)
            {
                bool result;

                switch (selfData.Get <RefillColor>("DJMapHelper_RefillColor"))
                {
                case RefillColor.Red:
                    result = PlayerUseRedRefill(self);
                    break;

                case RefillColor.Blue:
                    result = PlayerUseBlueRefill(self);
                    break;

                case RefillColor.Black:
                    result = PlayerUseBlackRefill(self);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(color), selfData.Get <RefillColor>("DJMapHelper_RefillColor"), null);
                }

                selfData["DJMapHelper_RefillColor"] = null;
                return(result);
            }
            else
            {
                return(orig(self, twoDashes));
            }
        }
Exemple #9
0
        protected DashStateRefill(EntityData data, Vector2 offset)
            : base(data, offset)
        {
            baseData = new DynData <Refill>(this);

            respawnTime = data.Float("respawnTime", 2.5f); // default is 2.5 sec.

            Get <PlayerCollider>().OnCollide = OnPlayer;

            if (TryCreateCustomSprite(out Sprite sprite))
            {
                Remove(baseData.Get <Sprite>("sprite"));
                Add(sprite);
                baseData["sprite"] = sprite;
            }

            if (TryCreateCustomOutline(out Sprite outline))
            {
                Remove(baseData.Get <Sprite>("outline"));
                Add(outline);
                baseData["outline"] = outline;
            }

            if (TryCreateCustomFlash(out Sprite flash))
            {
                Remove(baseData.Get <Sprite>("flash"));
                Add(flash);
                baseData["flash"] = flash;
            }
        }
        public override void Added(Scene scene)
        {
            base.Added(scene);

            DynData <CrumblePlatform> self = new DynData <CrumblePlatform>(this);

            outlineFader = self.Get <Coroutine>("outlineFader");
            falls        = self.Get <List <Coroutine> >("falls");
            fallOrder    = self.Get <List <int> >("fallOrder");
            shaker       = self.Get <ShakerList>("shaker");
            occluder     = self.Get <LightOcclude>("occluder");
            images       = self.Get <List <Image> >("images");

            foreach (Component component in this)
            {
                if (component is Coroutine coroutine && coroutine != outlineFader && !falls.Contains(coroutine))
                {
                    // this coroutine is the sequence! hijack it
                    coroutine.RemoveSelf();
                    Add(new Coroutine(customSequence()));
                    break;
                }
            }

            if (oneUse)
            {
                // prevent the outline from appearing.
                outlineFader.RemoveSelf();
            }
        }
        public TemporaryKey(EntityData data, Vector2 offset, EntityID id) : base(data.Position + offset, id, data.NodesOffset(offset))
        {
            this.follower = Get <Follower>();
            // Create sprite
            DynData <Key> dyndata = new DynData <Key>(this);

            sprite = dyndata.Get <Sprite>("sprite");
            Remove(sprite);
            sprite         = new Sprite(GFX.Game, data.Attr("directory", "collectables/FrostHelper/keytemp") + "/");
            sprite.Justify = new Vector2(0.5f, 0.5f);
            sprite.AddLoop("idle", "idle", 0.1f);
            sprite.AddLoop("enter", "enter", 0.1f);
            sprite.Play("idle");
            Add(sprite);
            dyndata.Set("sprite", sprite);
            Follower follower = this.follower;

            follower.OnLoseLeader          = (Action)Delegate.Combine(follower.OnLoseLeader, new Action(Dissolve));
            this.follower.PersistentFollow = false; // was false
            Add(new TransitionListener
            {
                OnOut = delegate(float f)
                {
                    StartedUsing = false;
                    if (!IsUsed)
                    {
                        Dissolve();
                    }
                }
            });
        }
Exemple #12
0
 internal static void Level_Update(On.Celeste.Level.orig_Update orig, Level self)
 {
     //speed changing
     if (EmoteModMain.anim_by_game == 1)
     {
         foreach (Entity entity in self.Entities)
         {
             foreach (Sprite sprite in entity.Components.GetAll <Sprite>())
             {
                 if (sprite == player.Sprite && sprite.Animating)
                 {
                     DynData <Sprite> data = new DynData <Sprite>(sprite);
                     if (EmoteModMain.Settings.AnimationSpeed != 9)
                     {
                         (data["currentAnimation"] as Sprite.Animation).Delay = currentDelay /
                                                                                speeds[EmoteModMain.Settings.AnimationSpeed];
                     }
                     else
                     {
                         (data["currentAnimation"] as Sprite.Animation).Delay = sprite.Animations[sprite.CurrentAnimationID].Delay;
                     }
                 }
             }
         }
     }
     orig(self);
 }
        public void CreateScrollArea()
        {
            AgeControlScrollView scroll = new DynData <OptionsPanel>(optionsPanel).Get <AgeControlScrollView>("controlBindingsScrollView");
            // Clones the parent of the scroll (1-ControlsConfig)
            // ScrollBar is child: 2-ControlBindingsScrollView
            GameObject o = (GameObject)GameObject.Instantiate(scroll.gameObject);

            o.transform.SetParent(frame.transform.FindChild("CentralPart"));
            o.SetActive(true);

            AgeControlScrollView newScroll = o.GetComponent <AgeControlScrollView>();

            o.name = "ModSettingsScrollView";
            newScroll.Init();
            newScroll.AgeTransform.Position         = scroll.AgeTransform.Position;
            newScroll.AgeTransform.PixelMarginTop   = scroll.AgeTransform.PixelMarginTop;
            newScroll.AgeTransform.PixelMarginLeft  = scroll.AgeTransform.PixelMarginLeft;
            newScroll.AgeTransform.PixelMarginRight = scroll.AgeTransform.PixelMarginRight;

            o.transform.FindChild("3Viewport").name          = "ModSettingsViewPort";
            o.transform.FindChild("1VerticalScrollBar").name = "ModSettingsScrollBar";
            newScroll.Viewport = o.transform.FindChild("ModSettingsViewPort").GetComponent <AgeTransform>();
            newScroll.Viewport.Init();
            newScroll.Viewport.Position = scroll.Viewport.Position;
            Util.DeleteChildrenInclusive(newScroll.Viewport.transform.FindChild("2-ControlBindingsTable").gameObject);
            newScroll.VerticalScrollBar = o.transform.FindChild("ModSettingsScrollBar").GetComponent <AgeControlScrollBar>();
            newScroll.VerticalScrollBar.Init();
            newScroll.VerticalScrollBar.AgeTransform.Position = scroll.VerticalScrollBar.AgeTransform.Position;
            newScroll.DisplayVertical = AgeScrollbarDisplay.ALWAYS;

            modSettingsScroll = o;
        }
Exemple #14
0
        private static void DreamBlock_Added(On.Celeste.DreamBlock.orig_Added orig, DreamBlock self, Scene scene)
        {
            if (MadelinePartyModule.IsSIDMadelineParty((scene as Level).Session.Area.GetSID()) && (scene as Level).Session.LevelData.Entities.Any((data) => data.Name.Equals("madelineparty/dreamBlockRNGSyncer")))
            {
                DynData <Scene> sceneData = new DynData <Scene>();
                var             seed      = sceneData.Get <int?>("madelinePartyRandomSeed");
                if (seed == null)
                {
                    seed = Calc.Random.Next();
                    sceneData["madelinePartyRandomSeed"] = seed;
                }
                DynData <DreamBlock> selfData = new DynData <DreamBlock>(self);
                selfData["madelinePartyRandom"] = new Random(seed.Value);

                Random oldRand = Calc.Random;
                Calc.Random = selfData.Get <Random>("madelinePartyRandom");

                orig(self, scene);

                Calc.Random = oldRand;
            }
            else
            {
                orig(self, scene);
            }
        }
Exemple #15
0
        public FancyFinalBossMovingBlock(EntityData data, Vector2 offset)
            : base(data.NodesWithPosition(offset), data.Width, data.Height, data.Int("nodeIndex", 0))
        {
            baseData = new DynData <FinalBossMovingBlock>(this);
            Remove(baseData.Get <TileGrid>("sprite"));
            Remove(baseData.Get <TileGrid>("highlight"));
            Remove(Get <TileInterceptor>());
            badLightOcclude = Get <LightOcclude>();

            tileMap            = GenerateTileMap(data.Attr("tileData", ""));
            tileMapHighlighted = GenerateTileMap(data.Attr("tileDataHighlight", ""));

            int newSeed = Calc.Random.Next();

            Calc.PushRandom(newSeed);
            baseData["sprite"] = GFX.FGAutotiler.GenerateMap(tileMap, default(Autotiler.Behaviour)).TileGrid;
            Add(baseData.Get <TileGrid>("sprite"));
            Calc.PopRandom();
            Calc.PushRandom(newSeed);
            TileGrid highlight = GFX.FGAutotiler.GenerateMap(tileMapHighlighted, default(Autotiler.Behaviour)).TileGrid;

            highlight.Alpha       = 0f;
            baseData["highlight"] = highlight;
            Add(baseData.Get <TileGrid>("highlight"));
            Calc.PopRandom();

            Add(new TileInterceptor(baseData.Get <TileGrid>("sprite"), false));


            highlightCollider = GenerateBetterColliderGrid(tileMapHighlighted, 8, 8);
            collider          = GenerateBetterColliderGrid(tileMap, 8, 8);
            AddLightOcclude(this, collider);
            Collider = collider;
        }
Exemple #16
0
        public override void Update()
        {
            base.Update();

            // if we are supposed to push the player and the player is hitting us...
            Player p;

            if (pushPlayer && (p = CollideFirst <Player>()) != null)
            {
                DynData <Player> playerData = new DynData <Player>(p);
                if (AllowLeftToRight)
                {
                    // player is moving right, not on the ground, not climbing, not blocked => push them to the right
                    if (p.Speed.X >= 0f && !playerData.Get <bool>("onGround") && (p.StateMachine.State != 1 || playerData.Get <int>("lastClimbMove") == -1) &&
                        !((bool)playerJumpthruBoostBlockedCheck.Invoke(p, new object[0])))
                    {
                        p.MoveH(40f * Engine.DeltaTime);
                    }
                }
                else
                {
                    // player is moving left, not on the ground, not climbing, not blocked => push them to the left
                    if (p.Speed.X <= 0f && !playerData.Get <bool>("onGround") && (p.StateMachine.State != 1 || playerData.Get <int>("lastClimbMove") == -1) &&
                        !((bool)playerJumpthruBoostBlockedCheck.Invoke(p, new object[0])))
                    {
                        p.MoveH(-40f * Engine.DeltaTime);
                    }
                }
            }
        }
Exemple #17
0
        public MoreCustomNPC(EntityData data, Vector2 offset, EntityID id) : base(data, offset, id)
        {
            DynData <CustomNPC> npcData = new DynData <CustomNPC>(this);

            string frames = data.Attr("frames", "");

            if (!string.IsNullOrEmpty(frames))
            {
                // "textures" currently contains all frames, but we only want some.
                List <MTexture> npcTextures = npcData.Get <List <MTexture> >("textures");
                List <MTexture> allTextures = new List <MTexture>(npcTextures);

                // clear the texture list, then only add back the textures we want!
                npcTextures         = new List <MTexture>();
                npcData["textures"] = npcTextures;
                foreach (int frame in Calc.ReadCSVIntWithTricks(frames))
                {
                    npcTextures.Add(allTextures[frame]);
                }
            }

            if (data.Nodes.Length >= 2)
            {
                // the nodes define a "talker zone", with one being the top left, and the other the bottom right.
                // we're adding 8 to bottom and right because nodes are rendered as 8x8 rectangles in Ahorn,
                // and we want to take the bottom/right of those rectangles.
                Vector2[] nodesOffset = data.NodesOffset(offset);
                float     top         = Math.Min(nodesOffset[0].Y, nodesOffset[1].Y);
                float     bottom      = Math.Max(nodesOffset[0].Y, nodesOffset[1].Y) + 8;
                float     left        = Math.Min(nodesOffset[0].X, nodesOffset[1].X);
                float     right       = Math.Max(nodesOffset[0].X, nodesOffset[1].X) + 8;

                talkerZone = new Rectangle((int)(left - Position.X), (int)(top - Position.Y), (int)(right - left), (int)(bottom - top));
            }
        }
Exemple #18
0
        public CustomDreamBlock(Vector2 position, int width, int height, bool featherMode, bool oneUse, int refillCount, bool below, bool quickDestroy)
            : base(position, width, height, null, false, oneUse, below)
        {
            baseData     = new DynData <DreamBlock>(this);
            QuickDestroy = quickDestroy;
            RefillCount  = refillCount;

            FeatherMode = featherMode;
            //if (altLineColor) { Dropped in favour of symbol
            //    activeLineColor = Calc.HexToColor("FF66D9");
            //}
            shakeParticle = new ParticleType(SwitchGate.P_Behind)
            {
                Color          = ActiveLineColor,
                ColorMode      = ParticleType.ColorModes.Static,
                Acceleration   = Vector2.Zero,
                DirectionRange = (float)Math.PI / 2
            };

            featherTextures = new MTexture[] {
                GFX.Game["particles/CommunalHelper/featherBig"],
                GFX.Game["particles/CommunalHelper/featherMedium"],
                GFX.Game["particles/CommunalHelper/featherSmall"]
            };

            doubleRefillStarTextures = new MTexture[4] {
                GFX.Game["objects/CommunalHelper/customDreamBlock/particles"].GetSubtexture(14, 0, 7, 7),
                GFX.Game["objects/CommunalHelper/customDreamBlock/particles"].GetSubtexture(7, 0, 7, 7),
                GFX.Game["objects/CommunalHelper/customDreamBlock/particles"].GetSubtexture(0, 0, 7, 7),
                GFX.Game["objects/CommunalHelper/customDreamBlock/particles"].GetSubtexture(7, 0, 7, 7)
            };
        }
Exemple #19
0
        private static void SetTasBindingsV1312()
        {
            DynData <Settings> settings = Settings.Instance.GetDynDataInstance();

            settings.Set("Left", Keys.None);
            settings.Set("Right", Keys.None);
            settings.Set("Down", Keys.None);
            settings.Set("Up", Keys.None);

            settings.Set("Grab", new List <Keys>());
            settings.Set("Jump", new List <Keys>());
            settings.Set("Dash", new List <Keys>());
            settings.Set("Talk", new List <Keys>());
            settings.Set("Pause", new List <Keys>());
            settings.Set("Confirm", new List <Keys>());
            settings.Set("Cancel", new List <Keys>());
            settings.Set("Journal", new List <Keys>());
            settings.Set("QuickRestart", new List <Keys>());

            settings.Set("BtnGrab", new List <Buttons> {
                Grab
            });
            settings.Set("BtnJump", new List <Buttons> {
                JumpAndConfirm, Jump2
            });
            settings.Set("BtnDash", new List <Buttons> {
                DashAndTalkAndCancel, Dash2AndCancel
            });
            settings.Set("BtnTalk", new List <Buttons> {
                DashAndTalkAndCancel
            });
            settings.Set("BtnAltQuickRestart", new List <Buttons> {
                QuickRestart
            });
        }
Exemple #20
0
        private void CustomiseChapterPanel(On.Celeste.OuiChapterPanel.orig_Reset orig, OuiChapterPanel self)
        {
            ResetCrystalHeart(self);

            var oldRealStats      = self.RealStats;
            var oldDisplayedStats = self.DisplayedStats;

            orig(self);
            AddExtraModes(self);

            // check if we're returning from an alt-side
            var selfdata = new DynData <OuiChapterPanel>(self);

            if (returningAltSide < 0)
            {
                selfdata.Data.Remove("TrueMode");
            }
            else
            {
                selfdata["TrueMode"] = returningAltSide;
                //Logger.Log("AltSidesHelper", $"returningAltSide = {returningAltSide}, mode count = {((IList)modesField.GetValue(self)).Count}.");
                // only run this when called in the correct
                if (!shouldResetStats)
                {
                    UpdateDataForTrueMode(self, returningAltSide);
                }
            }

            if (!shouldResetStats)
            {
                self.RealStats      = oldRealStats;
                self.DisplayedStats = oldDisplayedStats;
            }
            CustomizeCrystalHeart(self);
        }
Exemple #21
0
        void CreatePortal(Vector2 pos, string dir, uadzca ps)
        {
            var data = new EntityData
            {
                Values = new Dictionary <string, object>
                {
                    { "readyColor", ps.ColorStr },
                    { "direction", dir }
                },
                Position = pos
            };
            var all = Engine.Scene.Tracker.GetEntities <Portal>();

            foreach (var item in all)
            {
                var pdata = new DynData <Portal>((Portal)item);
                if (pdata["custom"] != null /*8&& all.Count((t) => {
                                             * ;
                                             * return new DynData<Portal>((Portal)t)["custom"] != null;
                                             * }) > 1*/)
                {
                    item.RemoveSelf();
                    break;
                }
            }

            var p      = new Portal(null, data, Vector2.Zero);
            var p2data = new DynData <Portal>(p);

            p2data["custom"] = true;
            //currentCustomPortal = p;
            Scene.Add(p);
            updatePortalsNextFrame = true;
        }
Exemple #22
0
        public FancyFallingBlock(EntityData data, Vector2 offset)
            : base(data.Position + offset, '3', data.Width, data.Height, data.Bool("finalBoss", false), data.Bool("behind", false), data.Bool("climbFall", true))
        {
            baseData = new DynData <FallingBlock>(this);
            Remove(baseData.Get <TileGrid>("tiles"));
            Remove(Get <TileInterceptor>());
            badLightOcclude = Get <LightOcclude>();

            int newSeed = Calc.Random.Next();

            Calc.PushRandom(newSeed);
            tileMap = GenerateTileMap(data.Attr("tileData", ""));
            Autotiler.Generated generated = GFX.FGAutotiler.GenerateMap(tileMap, default(Autotiler.Behaviour));
            baseData["tiles"] = generated.TileGrid;
            Add(baseData.Get <TileGrid>("tiles"));
            Add(animatedTiles = generated.SpriteOverlay);
            Calc.PopRandom();

            if (data.Bool("finalBoss", false))
            {
                VirtualMap <char> tileMapHighlighted = GenerateTileMap(data.Attr("tileDataHighlight", ""));
                Calc.PushRandom(newSeed);
                TileGrid highlight = GFX.FGAutotiler.GenerateMap(tileMapHighlighted, default(Autotiler.Behaviour)).TileGrid;
                highlight.Alpha       = 0f;
                baseData["highlight"] = highlight;
                Add(baseData.Get <TileGrid>("highlight"));
                Calc.PopRandom();
            }

            ColliderList colliders = GenerateBetterColliderGrid(tileMap, 8, 8);

            AddLightOcclude(this, colliders);
            Collider = colliders;
            Add(new TileInterceptor(baseData.Get <TileGrid>("tiles"), false));
        }
Exemple #23
0
        private static void customizeParticles(On.Celeste.HeartGem.orig_Awake orig, HeartGem self, Scene scene)
        {
            orig(self, scene);

            if (!self.IsGhost && LobbyHelper.IsHeartSide(self.SceneAs <Level>().Session.Area.GetSID()))
            {
                // we are in a heartside: make the heart particles match the heart sprite.
                DynData <HeartGem> selfData = new DynData <HeartGem>(self);
                switch (selfData.Get <Sprite>("sprite").Texture.AtlasPath)
                {
                case "collectables/heartGem/1/00":
                    selfData["shineParticle"] = HeartGem.P_RedShine;
                    break;

                case "collectables/heartGem/2/00":
                    selfData["shineParticle"] = HeartGem.P_GoldShine;
                    break;

                case "CollabUtils2/crystalHeart/expert/00":
                    selfData["shineParticle"] = new ParticleType(HeartGem.P_BlueShine)
                    {
                        Color = Color.Orange
                    };
                    break;

                case "CollabUtils2/crystalHeart/grandmaster/00":
                    selfData["shineParticle"] = new ParticleType(HeartGem.P_BlueShine)
                    {
                        Color = Color.DarkViolet
                    };
                    break;
                }
            }
        }
        private static bool onSwitchActivate(On.Celeste.Switch.orig_Activate orig, Switch self)
        {
            if (self.Entity.GetType().ToString() == "Celeste.Mod.OutbackHelper.MovingTouchSwitch")
            {
                DynData <TouchSwitch> selfData = new DynData <TouchSwitch>((TouchSwitch)self.Entity);
                if (selfData.Data.ContainsKey("flag"))
                {
                    DynData <Switch> selfSwitch = new DynData <Switch>(self);
                    string           flag       = selfData.Get <string>("flag");
                    Level            level      = self.Entity.SceneAs <Level>();

                    // do what the regular Switch.Activate() method does
                    if (self.Finished || self.Activated)
                    {
                        return(false);
                    }
                    selfSwitch["Activated"] = true;
                    if (self.OnActivate != null)
                    {
                        self.OnActivate();
                    }

                    // use the same logic as flag touch switches to determine if the group is complete.
                    return(FlagTouchSwitch.HandleCollectedFlagTouchSwitch(flag, inverted: false, selfData.Get <bool>("persistent"), level, selfData.Get <int>("id"),
                                                                          selfData.Get <List <FlagTouchSwitch> >("allTouchSwitchesInRoom"), selfData.Get <List <TouchSwitch> >("allMovingFlagTouchSwitchesInRoom"), () => { }));
                }
            }

            // if we are here, it means we aren't dealing with a flag moving touch switch.
            // so, we want regular behavior!
            return(orig(self));
        }
        public bool StartStarFly(Player player)
        {
            DynData <Player> data = new DynData <Player>(player);

            player.RefillStamina();
            bool result;

            if (player.StateMachine.State == Player.StReflectionFall)
            {
                result = false;
            }
            else
            {
                data["fh.customFeather"] = this;
                if (player.StateMachine.State == CustomFeatherState)
                {
                    data["starFlyTimer"] = FlyTime;
                    player.Sprite.Color  = FlyColor;
                    Input.Rumble(RumbleStrength.Medium, RumbleLength.Medium);
                }
                else
                {
                    player.StateMachine.State = CustomFeatherState;
                }
                result = true;
            }
            return(result);
        }
        public SeekerCustomColors(EntityData data, Vector2 offset) : base(data, offset)
        {
            if (basePAttack == null)
            {
                basePAttack    = P_Attack;
                basePHitWall   = P_HitWall;
                basePStomp     = P_Stomp;
                basePRegen     = P_Regen;
                baseTrailColor = TrailColor;
            }

            pAttack = new ParticleType(P_Attack)
            {
                Color  = Calc.HexToColor(data.Attr("attackParticleColor1")),
                Color2 = Calc.HexToColor(data.Attr("attackParticleColor2"))
            };
            pHitWall = new ParticleType(P_HitWall)
            {
                Color  = Calc.HexToColor(data.Attr("attackParticleColor1")),
                Color2 = Calc.HexToColor(data.Attr("attackParticleColor2"))
            };
            pStomp = new ParticleType(P_Stomp)
            {
                Color  = Calc.HexToColor(data.Attr("attackParticleColor1")),
                Color2 = Calc.HexToColor(data.Attr("attackParticleColor2"))
            };
            pRegen = new ParticleType(P_Regen)
            {
                Color  = Calc.HexToColor(data.Attr("regenParticleColor1")),
                Color2 = Calc.HexToColor(data.Attr("regenParticleColor2"))
            };
            trailColor = Calc.HexToColor(data.Attr("trailColor"));

            self = new DynData <Seeker>(this);
        }
Exemple #27
0
        private void GameSelectionPanel_Display(On.GameSelectionPanel.orig_Display orig, GameSelectionPanel self, bool isMultiplayer, string mpSaveKey, int slotCount, GameSelectionPanel.GameSelectionFinishedHandler onGameSelectionFinished)
        {
            Log("Attempting to Display!");
            IDatabase <ShipConfig> db = Databases.GetDatabase <ShipConfig>(false);

            Log("Database loaded!");
            if (db.GetValue(this.GetConfig().Name) != null)
            {
                // It already exists within the database, so we can continue
                Log("The shipconfig with name: " + this.GetConfig().Name + " already exists inside the database!");
            }
            else
            {
                db.Add(this.GetConfig());
            }
            DynData <GameSelectionPanel> paneldyn = new DynData <GameSelectionPanel>(self);

            paneldyn.Set <IDatabase <ShipConfig> >("shipConfigDB", db);
            Log("Database set!");

            orig(self, isMultiplayer, mpSaveKey, slotCount, onGameSelectionFinished);

            Log("Available Ships:");
            foreach (string s in paneldyn.Get <List <Amplitude.StaticString> >("availableShips"))
            {
                Log(s);
            }
            Log("DB:");
            foreach (ShipConfig s in paneldyn.Get <IDatabase <ShipConfig> >("shipConfigDB"))
            {
                Log("Name: " + s.Name + " localized: " + s.GetLocalizedName() + " desc: " + s.GetLocalizedDescription() + " abscissa val: " + s.AbscissaValue);
            }
        }
        private static void ModHitbox(On.Monocle.Entity.orig_DebugRender orig, Entity self, Camera camera)
        {
            if (!CelesteTasModule.Settings.ShowHitboxes)
            {
                orig(self, camera);
                return;
            }

            orig(self, camera);

            if (self is FinalBossBeam finalBossBeam)
            {
                DynData <FinalBossBeam> dynData = finalBossBeam.GetDynDataInstance();
                if (dynData.Get <float>("chargeTimer") <= 0f && dynData.Get <float>("activeTimer") > 0f)
                {
                    FinalBoss boss    = dynData.Get <FinalBoss>("boss");
                    float     angle   = dynData.Get <float>("angle");
                    Vector2   vector  = boss.BeamOrigin + Calc.AngleToVector(angle, 12f);
                    Vector2   vector2 = boss.BeamOrigin + Calc.AngleToVector(angle, 2000f);
                    Vector2   value   = (vector2 - vector).Perpendicular().SafeNormalize(2f);
                    Player    player  = boss.Scene.CollideFirst <Player>(vector + value, vector2 + value);
                    Draw.Line(vector + value, vector2 + value, Color.Aqua);
                    Draw.Line(vector - value, vector2 - value, Color.Aqua);
                    Draw.Line(vector, vector2, Color.Aqua);
                }
            }
        }
        public override void OnEnd(Level level)
        {
            player.StateMachine.State = 0;
            player.ForceCameraUpdate  = false;

            if (WasSkipped)
            {
                // snap camera to player
                level.Camera.Position = player.CameraTarget;

                // instant open the door
                DynData <HeartGemDoor> doorData = new DynData <HeartGemDoor>(door);
                doorData["openPercent"] = 1f;
                doorData["Opened"]      = true;
                doorData["Counter"]     = door.Requires;
                float openDistance = doorData.Get <float>("openDistance");
                door.TopSolid.Bottom = door.Y - openDistance;
                door.BottomSolid.Top = door.Y + openDistance;

                // and throw the open animation out of the window.
                foreach (Component component in door)
                {
                    if (component is Coroutine)
                    {
                        component.RemoveSelf();
                        break;
                    }
                }
            }
        }
Exemple #30
0
        public HeartGemShard(HeartGem heart, Vector2 position, int index)
            : base(position)
        {
            Heart     = heart;
            heartData = new DynData <HeartGem>(Heart);

            this.index = index;

            Depth = Depths.Pickups;

            Collider             = new Hitbox(12f, 12f, -6f, -6f);
            Add(holdableCollider = new HoldableCollider(OnHoldable));
            Add(new PlayerCollider(OnPlayer));

            moveWiggler           = Wiggler.Create(0.8f, 2f);
            moveWiggler.StartZero = true;
            Add(moveWiggler);
            Add(collectSfx = new SoundSource());

            Add(shaker      = new Shaker(on: false));
            shaker.Interval = 0.1f;

            // index % 3 determines which third of the heart this piece looks like
            Add(sprite       = new Image(GFX.Game.GetAtlasSubtexturesAt("collectables/CommunalHelper/heartGemShard/shard", index % 3)).CenterOrigin());
            Add(outline      = new Image(GFX.Game.GetAtlasSubtexturesAt("collectables/CommunalHelper/heartGemShard/shard_outline", index % 3)).CenterOrigin());
            Add(scaleWiggler = Wiggler.Create(0.5f, 4f, f => sprite.Scale = Vector2.One * (1f + f * 0.25f)));

            Add(new BloomPoint(Heart.IsFake ? 0f : 0.75f, 16f));
            Add(new MirrorReflection());
        }