private PlayerDeadBody Player_Die(On.Celeste.Player.orig_Die orig, Player self, Vector2 direction, bool evenIfInvincible, bool registerDeathInStats) { if (self.Dashes == 2) { twoDashesOnSpawn = true; } else { twoDashesOnSpawn = false; } foreach (Seeker seeker in spawnHelper.spawnedSeekers) { SeekerName nameObj = seeker.Get <SeekerName>(); nameObj.Name = null; } foreach (Snowball seeker in spawnHelper.spawnedSnowballs) { SnowballName nameObj = seeker.Get <SnowballName>(); nameObj.Name = null; } return(orig(self, direction, evenIfInvincible, registerDeathInStats)); }
private void HudRenderer_RenderContent(On.Celeste.HudRenderer.orig_RenderContent orig, HudRenderer self, Monocle.Scene scene) { if (!Settings.Enabled) { orig(self, scene); return; } if (effectTime != Settings.EffectTime) { timerHelper.ChangeTimerIntervals(); effectTime = Settings.EffectTime; } Monocle.Draw.SpriteBatch.Begin(); if (Settings.EnableInfoPanel) { infoPanel.Update(); infoPanel.SetFont(Monocle.Draw.DefaultFont, Monocle.Draw.SpriteBatch.GraphicsDevice); infoPanel.Draw(Monocle.Draw.SpriteBatch); } if (Settings.ShowSeekerNames) { foreach (Seeker seeker in spawnHelper.spawnedSeekers) { SeekerName nameObj = seeker.Get <SeekerName>(); if (nameObj.Name != null) { string name = nameObj.Name; DrawTextOverObject(name, seeker.Position); } } } if (Settings.ShowSnowballNames) { foreach (Snowball snowball in spawnHelper.spawnedSnowballs) { SnowballName nameObj = snowball.Get <SnowballName>(); if (nameObj.Name != null) { string name = nameObj.Name; DrawTextOverObject(name, snowball.Position); } } } Monocle.Draw.SpriteBatch.End(); orig(self, scene); }
public void SpawnSeeker(bool addToList, string name) { if (currentLevel == null) { return; } if (currentLevel.Bounds.Width / 8 > 659 || currentLevel.Bounds.Height / 8 > 407) { return; } if (!extendedPathfinder) { extendedPathfinder = true; currentLevel.Pathfinder = new Pathfinder(currentLevel); } for (int i = 0; i < 100; i++) { int x = rand.Next(currentLevel.Bounds.Width) + currentLevel.Bounds.X; int y = rand.Next(currentLevel.Bounds.Height) + currentLevel.Bounds.Y; // should be at least 100 pixels from the player double playerDistance = Math.Sqrt(Math.Pow(MathHelper.Distance(x, ply.X), 2) + Math.Pow(MathHelper.Distance(y, ply.Y), 2)); // also check if we are not spawning in a wall, that would be a shame Rectangle collideRectangle = new Rectangle(x - 8, y - 8, 16, 16); if (playerDistance > 50 && !currentLevel.CollideCheck <Solid>(collideRectangle) && !currentLevel.CollideCheck <Seeker>(collideRectangle)) { // build a Seeker with a proper EntityID to make Speedrun Tool happy (this is useless in vanilla Celeste but the constructor call is intercepted by Speedrun Tool) EntityData seekerData = generateBasicEntityData(currentLevel, 10 + 1); seekerData.Position = new Vector2(x, y); Seeker seeker = new Seeker(seekerData, Vector2.Zero); SeekerName seekerName = new SeekerName(true, true, name); seeker.Add(seekerName); if (addToList) { spawnedSeekers.Add(seeker); } currentLevel.Add(seeker); break; } } }