tModLoader v0.11.8.9
A mod to make and play Terraria mods
Terraria.ModLoader.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...

+ Collaboration diagram for Terraria.ModLoader.NPCSpawnInfo:

Public Attributes

bool desertCave
 Whether or not the player is in front of a desert wall or the NPC will spawn near one. More...
 
bool granite
 Whether or not the NPC will spawn on a granite block or the player is near a granite biome. More...
 
bool invasion
 Whether or not there is an invasion going on and the player is near it. More...
 
bool lihzahrd
 Whether or not the player is inside the jungle temple, where Lihzahrds spawn. More...
 
bool marble
 Whether or not the NPC will spawn on a marble block or the player is near a marble biome. More...
 
bool planteraDefeated
 Whether Plantera is defeated and the world is in hardmode. This isn't needed (it's easy to find by yourself), but it's a local flag in NPC.SpawnNPC, so it is included for completeness. More...
 
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:

  • ZoneDungeon
  • ZoneCorrupt
  • ZoneHoly
  • ZoneMeteor
  • ZoneJungle
  • ZoneSnow
  • ZoneCrimson
  • ZoneWaterCandle
  • ZonePeaceCandle
  • ZoneTowerSolar
  • ZoneTowerVortex
  • ZoneTowerNebula
  • ZoneTowerStardust
  • ZoneDesert
  • ZoneGlowshroom
  • ZoneUndergroundDesert
  • ZoneSkyHeight
  • ZoneOverworldHeight
  • ZoneDirtLayerHeight
  • ZoneRockLayerHeight
  • ZoneUnderworldHeight
  • ZoneBeach
  • ZoneRain
  • ZoneSandstorm
More...
 
int playerFloorX
 The x-coordinate of the tile the player is standing on. More...
 
int playerFloorY
 The y-coordinate of the tile the player is standing on. More...
 
bool playerInTown
 Whether or not the player is in a town. This is used for spawning critters instead of monsters. More...
 
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). More...
 
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. More...
 
bool sky
 Whether or not the player is in the sky biome, where harpies and wyverns spawn. More...
 
int spawnTileType
 
int spawnTileX
 The x-coordinate of the tile the NPC will spawn above. More...
 
int spawnTileY
 The y-coordinate of the tile the NPC will spawn above. More...
 
bool spiderCave
 Whether or not the player is in a spider cave or the NPC will spawn near one. More...
 
bool water
 Whether or not the tile the NPC will spawn in contains water. More...
 

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.

Definition at line 6 of file NPCSpawnInfo.cs.

Member Data Documentation

◆ desertCave

bool Terraria.ModLoader.NPCSpawnInfo.desertCave

Whether or not the player is in front of a desert wall or the NPC will spawn near one.

Definition at line 110 of file NPCSpawnInfo.cs.

◆ granite

bool Terraria.ModLoader.NPCSpawnInfo.granite

Whether or not the NPC will spawn on a granite block or the player is near a granite biome.

Definition at line 90 of file NPCSpawnInfo.cs.

◆ invasion

bool Terraria.ModLoader.NPCSpawnInfo.invasion

Whether or not there is an invasion going on and the player is near it.

Definition at line 80 of file NPCSpawnInfo.cs.

◆ lihzahrd

bool Terraria.ModLoader.NPCSpawnInfo.lihzahrd

Whether or not the player is inside the jungle temple, where Lihzahrds spawn.

Definition at line 70 of file NPCSpawnInfo.cs.

◆ marble

bool Terraria.ModLoader.NPCSpawnInfo.marble

Whether or not the NPC will spawn on a marble block or the player is near a marble biome.

Definition at line 95 of file NPCSpawnInfo.cs.

◆ planteraDefeated

bool Terraria.ModLoader.NPCSpawnInfo.planteraDefeated

Whether Plantera is defeated and the world is in hardmode. This isn't needed (it's easy to find by yourself), but it's a local flag in NPC.SpawnNPC, so it is included for completeness.

Definition at line 115 of file NPCSpawnInfo.cs.

◆ player

Player Terraria.ModLoader.NPCSpawnInfo.player

The player that this NPC is spawning around. For convenience, here are the player zones, which are also useful for determining NPC spawn:

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

Definition at line 50 of file NPCSpawnInfo.cs.

◆ playerFloorX

int Terraria.ModLoader.NPCSpawnInfo.playerFloorX

The x-coordinate of the tile the player is standing on.

Definition at line 55 of file NPCSpawnInfo.cs.

◆ playerFloorY

int Terraria.ModLoader.NPCSpawnInfo.playerFloorY

The y-coordinate of the tile the player is standing on.

Definition at line 60 of file NPCSpawnInfo.cs.

◆ playerInTown

bool Terraria.ModLoader.NPCSpawnInfo.playerInTown

Whether or not the player is in a town. This is used for spawning critters instead of monsters.

Definition at line 105 of file NPCSpawnInfo.cs.

◆ playerSafe

bool Terraria.ModLoader.NPCSpawnInfo.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).

Definition at line 75 of file NPCSpawnInfo.cs.

◆ safeRangeX

bool Terraria.ModLoader.NPCSpawnInfo.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.

Definition at line 120 of file NPCSpawnInfo.cs.

Referenced by Terraria.ModLoader.SpawnCondition.WaterSurface().

◆ sky

bool Terraria.ModLoader.NPCSpawnInfo.sky

Whether or not the player is in the sky biome, where harpies and wyverns spawn.

Definition at line 65 of file NPCSpawnInfo.cs.

◆ spawnTileType

int Terraria.ModLoader.NPCSpawnInfo.spawnTileType

Definition at line 18 of file NPCSpawnInfo.cs.

◆ spawnTileX

◆ spawnTileY

int Terraria.ModLoader.NPCSpawnInfo.spawnTileY

The y-coordinate of the tile the NPC will spawn above.

Definition at line 16 of file NPCSpawnInfo.cs.

Referenced by Terraria.ModLoader.SpawnCondition.GetTile(), and Terraria.ModLoader.SpawnCondition.WaterSurface().

◆ spiderCave

bool Terraria.ModLoader.NPCSpawnInfo.spiderCave

Whether or not the player is in a spider cave or the NPC will spawn near one.

Definition at line 100 of file NPCSpawnInfo.cs.

◆ water

bool Terraria.ModLoader.NPCSpawnInfo.water

Whether or not the tile the NPC will spawn in contains water.

Definition at line 85 of file NPCSpawnInfo.cs.