TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ SlimeRainSpawns()

static void Terraria.NPC.SlimeRainSpawns ( int plr)
inlinestatic

Definition at line 85827 of file NPC.cs.

85828 {
85829 //IL_00ce: Unknown result type (might be due to invalid IL or missing references)
85830 //IL_00e7: Unknown result type (might be due to invalid IL or missing references)
85831 //IL_0103: Unknown result type (might be due to invalid IL or missing references)
85832 int logicCheckScreenHeight = Main.LogicCheckScreenHeight;
85833 int logicCheckScreenWidth = Main.LogicCheckScreenWidth;
85834 float num = 15f;
85835 Player player = Main.player[plr];
85836 if ((double)player.position.Y > Main.worldSurface * 16.0 + (double)(logicCheckScreenHeight / 2) || player.nearbyActiveNPCs > num)
85837 {
85838 return;
85839 }
85840 float num2 = player.nearbyActiveNPCs / num;
85841 int num3 = 45 + (int)(450f * num2);
85842 if (Main.expertMode)
85843 {
85844 num3 = (int)((double)num3 * 0.85);
85845 }
85846 if (Main.GameModeInfo.IsJourneyMode)
85847 {
85849 if (power != null && power.GetIsUnlocked())
85850 {
85851 if (power.GetShouldDisableSpawnsFor(plr))
85852 {
85853 return;
85854 }
85855 if (power.GetRemappedSliderValueFor(plr, out var num4))
85856 {
85857 num3 = (int)((float)num3 / num4);
85858 }
85859 }
85860 }
85861 if (Main.rand.Next(num3) != 0)
85862 {
85863 return;
85864 }
85865 int num5 = (int)(player.Center.X - (float)logicCheckScreenWidth);
85867 int minValue = (int)((double)player.Center.Y - (double)logicCheckScreenHeight * 1.5);
85868 int maxValue2 = (int)((double)player.Center.Y - (double)logicCheckScreenHeight * 0.75);
85869 int num6 = Main.rand.Next(num5, maxValue);
85870 int num7 = Main.rand.Next(minValue, maxValue2);
85871 num6 /= 16;
85872 num7 /= 16;
85873 if (num6 < 10 || num6 > Main.maxTilesX + 10 || (double)num7 < Main.worldSurface * 0.3 || (double)num7 > Main.worldSurface || Collision.SolidTiles(num6 - 3, num6 + 3, num7 - 5, num7 + 2) || Main.wallHouse[Main.tile[num6, num7].wall])
85874 {
85875 return;
85876 }
85877 int num8 = NewNPC(GetSpawnSourceForNaturalSpawn(), num6 * 16 + 8, num7 * 16, 1);
85878 if (Main.rand.Next(200) == 0)
85879 {
85880 Main.npc[num8].SetDefaults(-4);
85881 }
85882 else if (Main.expertMode)
85883 {
85884 if (Main.rand.Next(7) == 0)
85885 {
85886 Main.npc[num8].SetDefaults(-7);
85887 }
85888 else if (Main.rand.Next(3) == 0)
85889 {
85890 Main.npc[num8].SetDefaults(-3);
85891 }
85892 }
85893 else if (Main.rand.Next(10) == 0)
85894 {
85895 Main.npc[num8].SetDefaults(-7);
85896 }
85897 else if (Main.rand.Next(5) < 2)
85898 {
85899 Main.npc[num8].SetDefaults(-3);
85900 }
85901 }
static int NewNPC(IEntitySource source, int X, int Y, int Type, int Start=0, float ai0=0f, float ai1=0f, float ai2=0f, float ai3=0f, int Target=255)
Spawns an NPC into the game world with the given type. This method should not be called on multipla...
Definition NPC.cs:91239
static IEntitySource GetSpawnSourceForNaturalSpawn()
Definition NPC.cs:107538

References Terraria.Entity.Center, Terraria.Main.expertMode, Terraria.Main.GameModeInfo, Terraria.GameContent.Creative.CreativePowerManager.Instance, Terraria.Main.LogicCheckScreenHeight, Terraria.Main.LogicCheckScreenWidth, Terraria.Main.maxTilesX, Terraria.Player.nearbyActiveNPCs, Terraria.Main.npc, Terraria.Main.player, Terraria.Entity.position, Terraria.Main.rand, Terraria.Collision.SolidTiles(), Terraria.Main.tile, Terraria.Main.wallHouse, and Terraria.Main.worldSurface.

+ Here is the call graph for this function: