tModLoader v2024.10
A mod to make and play Terraria mods
NPCSpawnInfo Struct Reference

A struct that stores information regarding where an NPC is naturally spawning and the player it is spawning around. This serves to reduce the parameter count for ModNPC.CanSpawn and GlobalNPC.EditSpawnPool. More...

Public Attributes

bool DesertCave
 Whether or not the player is in front of a desert wall or the NPC will spawn near one.
 
bool Granite
 Whether or not the NPC will spawn on a granite block or the player is near a granite biome.
 
bool Invasion
 Whether or not there is an invasion going on and the player is near it.
 
bool Lihzahrd
 Whether or not the player is inside the jungle temple, where Lihzahrds spawn.
 
bool Marble
 Whether or not the NPC will spawn on a marble block or the player is near a marble biome.
 
Player Player
 The player that this NPC is spawning around. For convenience, here are the player zones, which are also useful for determining NPC spawn: (ZoneGranite, ZoneMarble, ZoneHive, ZoneGemCave are not actually proper spawning related checks, they are for visuals only (RGB), determined by the backwall type)

  • ZoneDungeon
  • ZoneCorrupt
  • ZoneHallow
  • ZoneMeteor
  • ZoneJungle
  • ZoneSnow
  • ZoneCrimson
  • ZoneWaterCandle
  • ZonePeaceCandle
  • ZoneTowerSolar
  • ZoneTowerVortex
  • ZoneTowerNebula
  • ZoneTowerStardust
  • ZoneDesert
  • ZoneGlowshroom
  • ZoneUndergroundDesert
  • ZoneSkyHeight
  • ZoneOverworldHeight
  • ZoneDirtLayerHeight
  • ZoneRockLayerHeight
  • ZoneUnderworldHeight
  • ZoneBeach
  • ZoneRain
  • ZoneSandstorm
  • ZoneOldOneArmy
  • ZoneGraveyard

 
int PlayerFloorX
 The x-coordinate of the tile the player is standing on.
 
int PlayerFloorY
 The y-coordinate of the tile the player is standing on.
 
bool PlayerInTown
 Whether or not the player is in a town. This is used for spawning critters instead of monsters.
 
bool PlayerSafe
 Whether or not the player is in front of a player-placed wall or in a large town. If this is true, enemies that can attack through walls should not spawn (unless an invasion is in progress).
 
bool SafeRangeX
 Whether or not the NPC is horizontally within the range near the player in which NPCs cannot spawn. If this is true, it also means that it is vertically outside of the range near the player in which NPCs cannot spawn.
 
bool Sky
 Whether or not the player is in the sky biome, where harpies and wyverns spawn.
 
int SpawnTileType
 
int SpawnTileX
 The x-coordinate of the tile the NPC will spawn above.
 
int SpawnTileY
 The y-coordinate of the tile the NPC will spawn above.
 
bool SpiderCave
 Whether or not the player is in a spider cave or the NPC will spawn near one.
 
bool Water
 Whether or not the tile the NPC will spawn in contains water.
 

Detailed Description

A struct that stores information regarding where an NPC is naturally spawning and the player it is spawning around. This serves to reduce the parameter count for ModNPC.CanSpawn and GlobalNPC.EditSpawnPool.