Terraria ModLoader  0.10.1.5
A framework for Terraria mods
Terraria.ModLoader.SpawnCondition Class Reference
+ Collaboration diagram for Terraria.ModLoader.SpawnCondition:

Public Attributes

bool Active => active
 
float Chance => chance
 

Static Public Attributes

static readonly SpawnCondition AngryNimbus
 
static readonly SpawnCondition Bartender
 
static readonly SpawnCondition BeachAngler
 
static readonly SpawnCondition BoundCaveNPC
 
static readonly SpawnCondition CaveJellyfish
 
static readonly SpawnCondition CavePiranha
 
static readonly SpawnCondition Cavern
 
static readonly SpawnCondition Corruption
 
static readonly SpawnCondition CorruptWaterCritter
 
static readonly SpawnCondition CorruptWorm
 
static readonly SpawnCondition Crimson
 
static readonly SpawnCondition DarkMummy
 
static readonly SpawnCondition DefaultWaterCritter
 
static readonly SpawnCondition DesertCave
 
static readonly SpawnCondition DoctorBones
 
static readonly SpawnCondition Dungeon
 
static readonly SpawnCondition DungeonGuardian
 
static readonly SpawnCondition DungeonNormal
 
static readonly SpawnCondition EnchantedSword
 
static readonly SpawnCondition FrogCritter
 
static readonly SpawnCondition FrostLegion
 
static readonly SpawnCondition FrostMoon
 
static readonly SpawnCondition GoblinArmy
 
static readonly SpawnCondition GoblinScout
 
static readonly SpawnCondition HardmodeCrimsonWater
 
static readonly SpawnCondition HardmodeJungle
 
static readonly SpawnCondition HardmodeJungleWater
 
static readonly SpawnCondition HardmodeMushroomWater
 
static readonly SpawnCondition HoppinJack
 
static readonly SpawnCondition IceGolem
 
static readonly SpawnCondition Invasion
 
static readonly SpawnCondition JungleTemple
 
static readonly SpawnCondition JungleWater
 
static readonly SpawnCondition KingSlime
 
static readonly SpawnCondition LacBeetle
 
static readonly SpawnCondition LightMummy
 
static readonly SpawnCondition MartianMadness
 
static readonly SpawnCondition MartianProbe
 
static readonly SpawnCondition Meteor
 
static readonly SpawnCondition MouseCritter
 
static readonly SpawnCondition Mummy
 
static readonly SpawnCondition NebulaTower
 
static readonly SpawnCondition Ocean
 
static readonly SpawnCondition OceanAngler
 
static readonly SpawnCondition OceanMonster
 
static readonly SpawnCondition OldOnesArmy
 
static readonly SpawnCondition Overworld
 
static readonly SpawnCondition OverworldDay
 
static readonly SpawnCondition OverworldDayBirdCritter
 
static readonly SpawnCondition OverworldDayDesert
 
static readonly SpawnCondition OverworldDayGrassCritter
 
static readonly SpawnCondition OverworldDayRain
 
static readonly SpawnCondition OverworldDaySandCritter
 
static readonly SpawnCondition OverworldDaySlime
 
static readonly SpawnCondition OverworldDaySnowCritter
 
static readonly SpawnCondition OverworldFirefly
 
static readonly SpawnCondition OverworldHallow
 
static readonly SpawnCondition OverworldMimic
 
static readonly SpawnCondition OverworldMorningBirdCritter
 
static readonly SpawnCondition OverworldMushroom
 
static readonly SpawnCondition OverworldNight
 
static readonly SpawnCondition OverworldNightMonster
 
static readonly SpawnCondition OverworldUnderwaterCritter
 
static readonly SpawnCondition OverworldWaterCritter
 
static readonly SpawnCondition OverworldWaterSurfaceCritter
 
static readonly SpawnCondition Pirates
 
static readonly SpawnCondition PumpkinMoon
 
static readonly SpawnCondition RainbowSlime
 
static readonly SpawnCondition SandstormEvent
 
static readonly SpawnCondition Sky
 
static readonly SpawnCondition SnailCritter
 
static readonly SpawnCondition SolarEclipse
 
static readonly SpawnCondition SolarTower
 
static readonly SpawnCondition SpiderCave
 
static readonly SpawnCondition StardustTower
 
static readonly SpawnCondition SurfaceJungle
 
static readonly SpawnCondition TownCritter
 
static readonly SpawnCondition TownDefaultWaterCritter
 
static readonly SpawnCondition TownGeneralCritter
 
static readonly SpawnCondition TownJungleCritter
 
static readonly SpawnCondition TownOverworldUnderwaterCritter
 
static readonly SpawnCondition TownOverworldWaterCritter
 
static readonly SpawnCondition TownOverworldWaterSurfaceCritter
 
static readonly SpawnCondition TownSnowCritter
 
static readonly SpawnCondition TownWaterCritter
 
static readonly SpawnCondition Underground
 
static readonly SpawnCondition UndergroundJungle
 
static readonly SpawnCondition UndergroundMimic
 
static readonly SpawnCondition UndergroundMushroom
 
static readonly SpawnCondition Underworld
 
static readonly SpawnCondition VortexTower
 
static readonly SpawnCondition WaterCritter
 
static readonly SpawnCondition WormCritter
 
static readonly SpawnCondition Wraith
 

Static Private Member Functions

static SpawnCondition ()
 
static Tile GetTile (NPCSpawnInfo info)
 
static bool InnerThird (NPCSpawnInfo info)
 
static bool MartianProbeHelper (NPCSpawnInfo info)
 
static bool OuterThird (NPCSpawnInfo info)
 
static bool WaterSurface (NPCSpawnInfo info)
 

Private Attributes

bool active
 
float blockWeight
 
float chance
 
List< SpawnConditionchildren
 
Func< NPCSpawnInfo, bool > condition
 

Detailed Description

Definition at line 34 of file NPCSpawnHelper.cs.

Constructor & Destructor Documentation

static Terraria.ModLoader.SpawnCondition.SpawnCondition ( )
staticprivate

Definition at line 185 of file NPCSpawnHelper.cs.

References Terraria.ModLoader.NPCSpawnInfo.desertCave, Terraria.ModLoader.NPCSpawnInfo.invasion, Terraria.ModLoader.NPCSpawnInfo.lihzahrd, Terraria.ModLoader.NPCSpawnInfo.player, Terraria.ModLoader.NPCSpawnInfo.playerInTown, Terraria.ModLoader.NPCSpawnInfo.playerSafe, Terraria.ModLoader.NPCSpawnInfo.sky, Terraria.ModLoader.NPCSpawnInfo.spawnTileType, Terraria.ModLoader.NPCSpawnInfo.spawnTileX, Terraria.ModLoader.NPCSpawnInfo.spawnTileY, Terraria.ModLoader.NPCSpawnInfo.spiderCave, and Terraria.ModLoader.NPCSpawnInfo.water.

185  {
186  NebulaTower = new SpawnCondition((info) => info.player.ZoneTowerNebula);
187  VortexTower = new SpawnCondition((info) => info.player.ZoneTowerVortex);
188  StardustTower = new SpawnCondition((info) => info.player.ZoneTowerStardust);
189  SolarTower = new SpawnCondition((info) => info.player.ZoneTowerSolar);
190  Sky = new SpawnCondition((info) => info.sky);
191  Invasion = new SpawnCondition((info) => info.invasion);
192  GoblinArmy = new SpawnCondition(Invasion, (info) => Main.invasionType == 1);
193  FrostLegion = new SpawnCondition(Invasion, (info) => Main.invasionType == 2);
194  Pirates = new SpawnCondition(Invasion, (info) => Main.invasionType == 3);
195  MartianMadness = new SpawnCondition(Invasion, (info) => Main.invasionType == 4);
196  Bartender = new SpawnCondition((info) => !NPC.savedBartender && DD2Event.ReadyToFindBartender
197  && !NPC.AnyNPCs(NPCID.BartenderUnconscious) && !info.water, 1f / 80f);
198  SpiderCave = new SpawnCondition((info) => GetTile(info).wall == WallID.SpiderUnsafe || info.spiderCave);
199  DesertCave = new SpawnCondition((info) => (WallID.Sets.Conversion.HardenedSand[GetTile(info).wall]
200  || WallID.Sets.Conversion.Sandstone[GetTile(info).wall] || info.desertCave)
201  && WorldGen.checkUnderground(info.spawnTileX, info.spawnTileY));
202  HardmodeJungleWater = new SpawnCondition((info) => Main.hardMode && info.water && info.player.ZoneJungle, 2f / 3f);
203  HardmodeCrimsonWater = new SpawnCondition((info) => Main.hardMode && info.water && info.player.ZoneCrimson, 8f / 9f);
204  Ocean = new SpawnCondition((info) => info.water && (info.spawnTileX < 250 || info.spawnTileX > Main.maxTilesX - 250)
205  && Main.tileSand[info.spawnTileType] && info.spawnTileY < Main.rockLayer);
206  OceanAngler = new SpawnCondition(Ocean, (info) => !NPC.savedAngler && !NPC.AnyNPCs(NPCID.SleepingAngler)
207  && WaterSurface(info));
208  OceanMonster = new SpawnCondition(Ocean, (info) => true);
209  BeachAngler = new SpawnCondition((info) => !info.water && !NPC.savedAngler && !NPC.AnyNPCs(NPCID.SleepingAngler)
210  && (info.spawnTileX < 340 || info.spawnTileX > Main.maxTilesX - 340) && Main.tileSand[info.spawnTileType]
211  && info.spawnTileY < Main.worldSurface);
212  JungleWater = new SpawnCondition((info) => info.water && info.spawnTileType == TileID.JungleGrass);
213  CavePiranha = new SpawnCondition((info) => info.water && info.spawnTileY > Main.rockLayer, 0.5f);
214  CaveJellyfish = new SpawnCondition((info) => info.water && info.spawnTileY > Main.worldSurface, 1f / 3f);
215  WaterCritter = new SpawnCondition((info) => info.water, 0.25f);
216  CorruptWaterCritter = new SpawnCondition(WaterCritter, (info) => info.player.ZoneCorrupt);
217  OverworldWaterCritter = new SpawnCondition(WaterCritter, (info) => info.spawnTileY < Main.worldSurface
218  && info.spawnTileY > 50 && Main.dayTime, 2f / 3f);
221  DefaultWaterCritter = new SpawnCondition(WaterCritter, (info) => true);
222  BoundCaveNPC = new SpawnCondition((info) => !info.water && info.spawnTileY >= Main.rockLayer
223  && info.spawnTileY < Main.maxTilesY - 210, 1f / 20f);
224  TownCritter = new SpawnCondition((info) => info.playerInTown);
225  TownWaterCritter = new SpawnCondition(TownCritter, (info) => info.water);
226  TownOverworldWaterCritter = new SpawnCondition(TownWaterCritter, (info) => info.spawnTileY < Main.worldSurface
227  && info.spawnTileY > 50 && Main.dayTime, 2f / 3f);
231  TownSnowCritter = new SpawnCondition(TownCritter, (info) => info.spawnTileType == TileID.SnowBlock
232  || info.spawnTileType == TileID.IceBlock);
233  TownJungleCritter = new SpawnCondition(TownCritter, (info) => info.spawnTileType == TileID.JungleGrass);
234  TownGeneralCritter = new SpawnCondition(TownCritter, (info) => info.spawnTileType == TileID.Grass
235  || info.spawnTileType == TileID.HallowedGrass || info.spawnTileY > Main.worldSurface);
236  Dungeon = new SpawnCondition((info) => info.player.ZoneDungeon);
237  DungeonGuardian = new SpawnCondition(Dungeon, (info) => !NPC.downedBoss3);
238  DungeonNormal = new SpawnCondition(Dungeon, (info) => true);
239  Meteor = new SpawnCondition((info) => info.player.ZoneMeteor);
240  OldOnesArmy = new SpawnCondition((info) => DD2Event.Ongoing && info.player.ZoneOldOneArmy);
241  FrostMoon = new SpawnCondition((info) => info.spawnTileY <= Main.worldSurface && !Main.dayTime && Main.snowMoon);
242  PumpkinMoon = new SpawnCondition((info) => info.spawnTileY <= Main.worldSurface
243  && !Main.dayTime && Main.pumpkinMoon);
244  SolarEclipse = new SpawnCondition((info) => info.spawnTileY <= Main.worldSurface && Main.dayTime && Main.eclipse);
245  HardmodeMushroomWater = new SpawnCondition((info) => Main.hardMode && info.spawnTileType == TileID.MushroomGrass
246  && info.water);
247  OverworldMushroom = new SpawnCondition((info) => info.spawnTileType == TileID.MushroomGrass
248  && info.spawnTileY <= Main.worldSurface, 2f / 3f);
249  UndergroundMushroom = new SpawnCondition((info) => info.spawnTileType == TileID.MushroomGrass
250  && Main.hardMode && info.spawnTileY >= Main.worldSurface, 2f / 3f);
251  CorruptWorm = new SpawnCondition((info) => info.player.ZoneCorrupt && !info.playerSafe, 1f / 65f);
252  UndergroundMimic = new SpawnCondition((info) => Main.hardMode && info.spawnTileY > Main.worldSurface, 1f / 70f);
253  OverworldMimic = new SpawnCondition((info) => Main.hardMode && GetTile(info).wall == WallID.DirtUnsafe, 0.05f);
254  Wraith = new SpawnCondition((info) => Main.hardMode && info.spawnTileY <= Main.worldSurface
255  && !Main.dayTime, 0.05f);
256  Wraith.WeightFunc = () => {
257  float inverseChance = 0.95f;
258  if (Main.moonPhase == 4) {
259  inverseChance *= 0.8f;
260  }
261  return 1f - inverseChance;
262  };
263  HoppinJack = new SpawnCondition((info) => Main.hardMode && Main.halloween
264  && info.spawnTileY <= Main.worldSurface && !Main.dayTime, 0.1f);
265  DoctorBones = new SpawnCondition((info) => info.spawnTileType == TileID.JungleGrass && !Main.dayTime, 0.002f);
266  LacBeetle = new SpawnCondition((info) => info.spawnTileType == TileID.JungleGrass
267  && info.spawnTileY > Main.worldSurface, 1f / 60f);
268  WormCritter = new SpawnCondition((info) => info.spawnTileY > Main.worldSurface
269  && info.spawnTileY < Main.maxTilesY - 210 && !info.player.ZoneSnow && !info.player.ZoneCrimson
270  && !info.player.ZoneCorrupt && !info.player.ZoneJungle && !info.player.ZoneHoly, 1f / 8f);
271  MouseCritter = new SpawnCondition((info) => info.spawnTileY > Main.worldSurface
272  && info.spawnTileY < Main.maxTilesY - 210 && !info.player.ZoneSnow && !info.player.ZoneCrimson
273  && !info.player.ZoneCorrupt && !info.player.ZoneJungle && !info.player.ZoneHoly, 1f / 13f);
274  SnailCritter = new SpawnCondition((info) => info.spawnTileY > Main.worldSurface
275  && info.spawnTileY < (Main.rockLayer + Main.maxTilesY) / 2 && !info.player.ZoneSnow
276  && !info.player.ZoneCrimson && !info.player.ZoneCorrupt && !info.player.ZoneHoly, 1f / 13f);
277  FrogCritter = new SpawnCondition((info) => info.spawnTileY < Main.worldSurface && info.player.ZoneJungle, 1f / 9f);
278  HardmodeJungle = new SpawnCondition((info) => info.spawnTileType == TileID.JungleGrass && Main.hardMode, 2f / 3f);
279  JungleTemple = new SpawnCondition((info) => info.spawnTileType == TileID.LihzahrdBrick && info.lihzahrd);
280  UndergroundJungle = new SpawnCondition((info) => info.spawnTileType == TileID.JungleGrass
281  && info.spawnTileY > (Main.worldSurface + Main.rockLayer) / 2);
282  SurfaceJungle = new SpawnCondition((info) => info.spawnTileType == TileID.JungleGrass, 11f / 32f);
283  SandstormEvent = new SpawnCondition((info) => Sandstorm.Happening && info.player.ZoneSandstorm
284  && TileID.Sets.Conversion.Sand[info.spawnTileType]
285  && NPC.Spawning_SandstoneCheck(info.spawnTileX, info.spawnTileY));
286  Mummy = new SpawnCondition((info) => Main.hardMode && info.spawnTileType == TileID.Sand, 1f / 3f);
287  DarkMummy = new SpawnCondition((info) => Main.hardMode && (info.spawnTileType == TileID.Ebonsand
288  || info.spawnTileType == TileID.Crimsand), 0.5f);
289  LightMummy = new SpawnCondition((info) => Main.hardMode && info.spawnTileType == TileID.Pearlsand, 0.5f);
290  OverworldHallow = new SpawnCondition((info) => Main.hardMode && !info.water && info.spawnTileY < Main.rockLayer
291  && (info.spawnTileType == TileID.Pearlsand || info.spawnTileType == TileID.Pearlstone
292  || info.spawnTileType == TileID.HallowedGrass || info.spawnTileType == TileID.HallowedIce));
293  EnchantedSword = new SpawnCondition((info) => !info.playerSafe && Main.hardMode && !info.water
294  && info.spawnTileY >= Main.rockLayer && (info.spawnTileType == TileID.Pearlsand
295  || info.spawnTileType == TileID.Pearlstone || info.spawnTileType == TileID.HallowedGrass
296  || info.spawnTileType == TileID.HallowedIce), 0.02f);
297  Crimson = new SpawnCondition((info) => (info.spawnTileType == TileID.Crimtane && info.player.ZoneCrimson)
298  || info.spawnTileType == TileID.FleshGrass || info.spawnTileType == TileID.FleshIce
299  || info.spawnTileType == TileID.Crimstone || info.spawnTileType == TileID.Crimsand);
300  Corruption = new SpawnCondition((info) => (info.spawnTileType == TileID.Demonite && info.player.ZoneCorrupt)
301  || info.spawnTileType == TileID.CorruptGrass || info.spawnTileType == TileID.Ebonstone
302  || info.spawnTileType == TileID.Ebonsand || info.spawnTileType == TileID.CorruptIce);
303  Overworld = new SpawnCondition((info) => info.spawnTileY <= Main.worldSurface);
304  IceGolem = new SpawnCondition(Overworld, (info) => info.player.ZoneSnow && Main.hardMode
305  && Main.cloudAlpha > 0f && !NPC.AnyNPCs(NPCID.IceGolem), 0.05f);
306  RainbowSlime = new SpawnCondition(Overworld, (info) => info.player.ZoneHoly && Main.hardMode
307  && Main.cloudAlpha > 0f && !NPC.AnyNPCs(NPCID.RainbowSlime), 0.05f);
308  AngryNimbus = new SpawnCondition(Overworld, (info) => !info.player.ZoneSnow && Main.hardMode
309  && Main.cloudAlpha > 0f && NPC.CountNPCS(NPCID.AngryNimbus) < 2, 0.1f);
310  MartianProbe = new SpawnCondition(Overworld, (info) => MartianProbeHelper(info) && Main.hardMode
311  && NPC.downedGolemBoss && !NPC.AnyNPCs(NPCID.MartianProbe), 1f / 400f);
312  MartianProbe.WeightFunc = () => {
313  float inverseChance = 399f / 400f;
314  if (!NPC.downedMartians) {
315  inverseChance *= 0.99f;
316  }
317  return 1f - inverseChance;
318  };
319  OverworldDay = new SpawnCondition(Overworld, (info) => Main.dayTime);
321  && (GetTile(info).type == TileID.SnowBlock || GetTile(info).type == TileID.IceBlock), 1f / 15f);
323  && (GetTile(info).type == TileID.Grass || GetTile(info).type == TileID.HallowedGrass), 1f / 15f);
325  && GetTile(info).type == TileID.Sand, 1f / 15f);
326  OverworldMorningBirdCritter = new SpawnCondition(OverworldDay, (info) => InnerThird(info) && Main.time < 18000.0
327  && (GetTile(info).type == TileID.Grass || GetTile(info).type == TileID.HallowedGrass), 0.25f);
329  && (GetTile(info).type == TileID.Grass || GetTile(info).type == TileID.HallowedGrass
330  || GetTile(info).type == TileID.SnowBlock), 1f / 15f);
331  KingSlime = new SpawnCondition(OverworldDay, (info) => OuterThird(info) && GetTile(info).type == TileID.Grass
332  && !NPC.AnyNPCs(NPCID.KingSlime), 1f / 300f);
333  OverworldDayDesert = new SpawnCondition(OverworldDay, (info) => GetTile(info).type == TileID.Sand
334  && !info.water, 0.2f);
335  GoblinScout = new SpawnCondition(OverworldDay, (info) => OuterThird(info), 1f / 15f);
336  GoblinScout.WeightFunc = () => {
337  float inverseChance = 14f / 15f;
338  if (!NPC.downedGoblins && WorldGen.shadowOrbSmashed) {
339  return inverseChance *= (6f / 7f);
340  }
341  return 1f - inverseChance;
342  };
343  OverworldDayRain = new SpawnCondition(OverworldDay, (info) => Main.raining, 2f / 3f);
344  OverworldDaySlime = new SpawnCondition(OverworldDay, (info) => true);
345  OverworldNight = new SpawnCondition(Overworld, (info) => true);
346  OverworldFirefly = new SpawnCondition(OverworldNight, (info) => GetTile(info).type == TileID.Grass
347  || GetTile(info).type == TileID.HallowedGrass, 0.1f);
348  OverworldFirefly.WeightFunc = () => 1f / (float)NPC.fireFlyChance;
349  OverworldNightMonster = new SpawnCondition(OverworldNight, (info) => true);
350  Underground = new SpawnCondition((info) => info.spawnTileY <= Main.rockLayer);
351  Underworld = new SpawnCondition((info) => info.spawnTileY > Main.maxTilesY - 190);
352  Cavern = new SpawnCondition((info) => true);
353  }
static readonly SpawnCondition Crimson
static readonly SpawnCondition IceGolem
static readonly SpawnCondition SandstormEvent
static bool MartianProbeHelper(NPCSpawnInfo info)
static readonly SpawnCondition Overworld
static readonly SpawnCondition Dungeon
static readonly SpawnCondition KingSlime
static readonly SpawnCondition Wraith
static readonly SpawnCondition UndergroundMushroom
static readonly SpawnCondition TownCritter
static bool InnerThird(NPCSpawnInfo info)
static readonly SpawnCondition SurfaceJungle
static readonly SpawnCondition MartianProbe
static readonly SpawnCondition DefaultWaterCritter
static readonly SpawnCondition TownWaterCritter
static readonly SpawnCondition Sky
static readonly SpawnCondition CaveJellyfish
static readonly SpawnCondition VortexTower
static readonly SpawnCondition OverworldDayRain
static readonly SpawnCondition DoctorBones
static readonly SpawnCondition JungleTemple
static readonly SpawnCondition SolarTower
static readonly SpawnCondition Pirates
static readonly SpawnCondition MouseCritter
static readonly SpawnCondition LacBeetle
static readonly SpawnCondition OceanAngler
static readonly SpawnCondition Underground
static bool WaterSurface(NPCSpawnInfo info)
static readonly SpawnCondition PumpkinMoon
static readonly SpawnCondition OverworldMushroom
static readonly SpawnCondition GoblinArmy
static readonly SpawnCondition Corruption
static readonly SpawnCondition OverworldDaySlime
static readonly SpawnCondition OverworldNight
static readonly SpawnCondition Cavern
static readonly SpawnCondition TownGeneralCritter
static readonly SpawnCondition TownOverworldUnderwaterCritter
static readonly SpawnCondition UndergroundJungle
static readonly SpawnCondition AngryNimbus
static readonly SpawnCondition OverworldMimic
static readonly SpawnCondition OverworldNightMonster
static readonly SpawnCondition OverworldDayGrassCritter
static readonly SpawnCondition EnchantedSword
static Tile GetTile(NPCSpawnInfo info)
static readonly SpawnCondition TownOverworldWaterCritter
static readonly SpawnCondition OverworldWaterSurfaceCritter
static readonly SpawnCondition Ocean
static readonly SpawnCondition BeachAngler
static readonly SpawnCondition TownDefaultWaterCritter
static readonly SpawnCondition Mummy
static readonly SpawnCondition TownSnowCritter
static readonly SpawnCondition OverworldDaySandCritter
static readonly SpawnCondition FrostMoon
static readonly SpawnCondition CavePiranha
static readonly SpawnCondition NebulaTower
static readonly SpawnCondition DungeonGuardian
static readonly SpawnCondition HoppinJack
static readonly SpawnCondition WormCritter
static readonly SpawnCondition OverworldWaterCritter
static readonly SpawnCondition OverworldHallow
static readonly SpawnCondition SnailCritter
static readonly SpawnCondition OverworldMorningBirdCritter
static readonly SpawnCondition SolarEclipse
static readonly SpawnCondition BoundCaveNPC
static readonly SpawnCondition DarkMummy
static readonly SpawnCondition Bartender
static readonly SpawnCondition WaterCritter
static readonly SpawnCondition JungleWater
static readonly SpawnCondition DungeonNormal
static readonly SpawnCondition SpiderCave
static readonly SpawnCondition UndergroundMimic
static readonly SpawnCondition Underworld
static bool OuterThird(NPCSpawnInfo info)
static readonly SpawnCondition OverworldDayDesert
static readonly SpawnCondition DesertCave
static readonly SpawnCondition LightMummy
static readonly SpawnCondition HardmodeMushroomWater
static readonly SpawnCondition RainbowSlime
static readonly SpawnCondition Meteor
static readonly SpawnCondition MartianMadness
static readonly SpawnCondition FrogCritter
static readonly SpawnCondition OverworldDay
static readonly SpawnCondition HardmodeJungle
static readonly SpawnCondition GoblinScout
static readonly SpawnCondition OverworldFirefly
static readonly SpawnCondition TownJungleCritter
static readonly SpawnCondition FrostLegion
static readonly SpawnCondition OverworldDayBirdCritter
static readonly SpawnCondition CorruptWorm
static readonly SpawnCondition OverworldDaySnowCritter
static readonly SpawnCondition CorruptWaterCritter
static readonly SpawnCondition OldOnesArmy
static readonly SpawnCondition StardustTower
static readonly SpawnCondition OverworldUnderwaterCritter
static readonly SpawnCondition Invasion
static readonly SpawnCondition HardmodeCrimsonWater
static readonly SpawnCondition OceanMonster
static readonly SpawnCondition TownOverworldWaterSurfaceCritter
static readonly SpawnCondition HardmodeJungleWater

Member Function Documentation

static Tile Terraria.ModLoader.SpawnCondition.GetTile ( NPCSpawnInfo  info)
staticprivate

Definition at line 355 of file NPCSpawnHelper.cs.

References Terraria.ModLoader.NPCSpawnInfo.spawnTileX, and Terraria.ModLoader.NPCSpawnInfo.spawnTileY.

355  {
356  return Main.tile[info.spawnTileX, info.spawnTileY];
357  }
static bool Terraria.ModLoader.SpawnCondition.InnerThird ( NPCSpawnInfo  info)
staticprivate

Definition at line 377 of file NPCSpawnHelper.cs.

References Terraria.ModLoader.NPCSpawnInfo.spawnTileX.

377  {
378  return Math.Abs(info.spawnTileX - Main.spawnTileX) < Main.maxTilesX / 3;
379  }
static bool Terraria.ModLoader.SpawnCondition.MartianProbeHelper ( NPCSpawnInfo  info)
staticprivate

Definition at line 372 of file NPCSpawnHelper.cs.

References Terraria.ModLoader.NPCSpawnInfo.spawnTileX.

372  {
373  return (float)Math.Abs(info.spawnTileX - Main.maxTilesX / 2) / (float)(Main.maxTilesX / 2) > 0.33f
374  && !NPC.AnyDanger();
375  }
static bool Terraria.ModLoader.SpawnCondition.OuterThird ( NPCSpawnInfo  info)
staticprivate

Definition at line 381 of file NPCSpawnHelper.cs.

References Terraria.ModLoader.NPCSpawnInfo.spawnTileX.

381  {
382  return Math.Abs(info.spawnTileX - Main.spawnTileX) > Main.maxTilesX / 3;
383  }
static bool Terraria.ModLoader.SpawnCondition.WaterSurface ( NPCSpawnInfo  info)
staticprivate

Definition at line 359 of file NPCSpawnHelper.cs.

References Terraria.ModLoader.NPCSpawnInfo.safeRangeX, Terraria.ModLoader.NPCSpawnInfo.spawnTileX, and Terraria.ModLoader.NPCSpawnInfo.spawnTileY.

359  {
360  if (info.safeRangeX) {
361  return false;
362  }
363  for (int k = info.spawnTileY - 1; k > info.spawnTileY - 50; k--) {
364  if (Main.tile[info.spawnTileX, k].liquid == 0 && !WorldGen.SolidTile(info.spawnTileX, k)
365  && !WorldGen.SolidTile(info.spawnTileX, k + 1) && !WorldGen.SolidTile(info.spawnTileX, k + 2)) {
366  return true;
367  }
368  }
369  return false;
370  }

Member Data Documentation

bool Terraria.ModLoader.SpawnCondition.active
private

Definition at line 42 of file NPCSpawnHelper.cs.

bool Terraria.ModLoader.SpawnCondition.Active => active

Definition at line 48 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.AngryNimbus
static

Definition at line 165 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Bartender
static

Definition at line 100 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.BeachAngler
static

Definition at line 108 of file NPCSpawnHelper.cs.

float Terraria.ModLoader.SpawnCondition.blockWeight
private

Definition at line 38 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.BoundCaveNPC
static

Definition at line 118 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.CaveJellyfish
static

Definition at line 111 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.CavePiranha
static

Definition at line 110 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Cavern
static

Definition at line 183 of file NPCSpawnHelper.cs.

float Terraria.ModLoader.SpawnCondition.chance
private

Definition at line 41 of file NPCSpawnHelper.cs.

float Terraria.ModLoader.SpawnCondition.Chance => chance

Definition at line 47 of file NPCSpawnHelper.cs.

List<SpawnCondition> Terraria.ModLoader.SpawnCondition.children
private

Definition at line 37 of file NPCSpawnHelper.cs.

Func<NPCSpawnInfo, bool> Terraria.ModLoader.SpawnCondition.condition
private

Definition at line 36 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Corruption
static

Definition at line 161 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.CorruptWaterCritter
static

Definition at line 113 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.CorruptWorm
static

Definition at line 139 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Crimson
static

Definition at line 160 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.DarkMummy
static

Definition at line 156 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.DefaultWaterCritter
static

Definition at line 117 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.DesertCave
static

Definition at line 102 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.DoctorBones
static

Definition at line 144 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Dungeon
static

Definition at line 128 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.DungeonGuardian
static

Definition at line 129 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.DungeonNormal
static

Definition at line 130 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.EnchantedSword
static

Definition at line 159 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.FrogCritter
static

Definition at line 149 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.FrostLegion
static

Definition at line 97 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.FrostMoon
static

Definition at line 133 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.GoblinArmy
static

Definition at line 96 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.GoblinScout
static

Definition at line 175 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.HardmodeCrimsonWater
static

Definition at line 104 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.HardmodeJungle
static

Definition at line 150 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.HardmodeJungleWater
static

Definition at line 103 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.HardmodeMushroomWater
static

Definition at line 136 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.HoppinJack
static

Definition at line 143 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.IceGolem
static

Definition at line 163 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Invasion
static

Definition at line 95 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.JungleTemple
static

Definition at line 151 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.JungleWater
static

Definition at line 109 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.KingSlime
static

Definition at line 173 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.LacBeetle
static

Definition at line 145 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.LightMummy
static

Definition at line 157 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.MartianMadness
static

Definition at line 99 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.MartianProbe
static

Definition at line 166 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Meteor
static

Definition at line 131 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.MouseCritter
static

Definition at line 147 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Mummy
static

Definition at line 155 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.NebulaTower
static

Definition at line 90 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Ocean
static

Definition at line 105 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OceanAngler
static

Definition at line 106 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OceanMonster
static

Definition at line 107 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OldOnesArmy
static

Definition at line 132 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Overworld
static

Definition at line 162 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldDay
static

Definition at line 167 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldDayBirdCritter
static

Definition at line 172 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldDayDesert
static

Definition at line 174 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldDayGrassCritter
static

Definition at line 169 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldDayRain
static

Definition at line 176 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldDaySandCritter
static

Definition at line 170 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldDaySlime
static

Definition at line 177 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldDaySnowCritter
static

Definition at line 168 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldFirefly
static

Definition at line 179 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldHallow
static

Definition at line 158 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldMimic
static

Definition at line 141 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldMorningBirdCritter
static

Definition at line 171 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldMushroom
static

Definition at line 137 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldNight
static

Definition at line 178 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldNightMonster
static

Definition at line 180 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldUnderwaterCritter
static

Definition at line 116 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldWaterCritter
static

Definition at line 114 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.OverworldWaterSurfaceCritter
static

Definition at line 115 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Pirates
static

Definition at line 98 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.PumpkinMoon
static

Definition at line 134 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.RainbowSlime
static

Definition at line 164 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.SandstormEvent
static

Definition at line 154 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Sky
static

Definition at line 94 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.SnailCritter
static

Definition at line 148 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.SolarEclipse
static

Definition at line 135 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.SolarTower
static

Definition at line 93 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.SpiderCave
static

Definition at line 101 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.StardustTower
static

Definition at line 92 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.SurfaceJungle
static

Definition at line 153 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.TownCritter
static

Definition at line 119 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.TownDefaultWaterCritter
static

Definition at line 124 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.TownGeneralCritter
static

Definition at line 127 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.TownJungleCritter
static

Definition at line 126 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.TownOverworldUnderwaterCritter
static

Definition at line 123 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.TownOverworldWaterCritter
static

Definition at line 121 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.TownOverworldWaterSurfaceCritter
static

Definition at line 122 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.TownSnowCritter
static

Definition at line 125 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.TownWaterCritter
static

Definition at line 120 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Underground
static

Definition at line 181 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.UndergroundJungle
static

Definition at line 152 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.UndergroundMimic
static

Definition at line 140 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.UndergroundMushroom
static

Definition at line 138 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Underworld
static

Definition at line 182 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.VortexTower
static

Definition at line 91 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.WaterCritter
static

Definition at line 112 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.WormCritter
static

Definition at line 146 of file NPCSpawnHelper.cs.

readonly SpawnCondition Terraria.ModLoader.SpawnCondition.Wraith
static

Definition at line 142 of file NPCSpawnHelper.cs.