tModLoader v2022.09
A mod to make and play Terraria mods
|
Inherits Terraria.Entity, and IEntityWithGlobals< GlobalNPC >.
Public Member Functions | |
void | AddBuff (int type, int time, bool quiet=false) |
void | AI () |
void | AI_000_TransformBoundNPC (int playerID, int npcType) |
void | AI_001_SetRainbowSlimeColor () |
NPC | AI_113_WindyBalloon_GetSlaveNPC () |
bool | AI_120_HallowBoss_IsGenuinelyEnraged () |
bool | AI_120_HallowBoss_IsInPhase2 () |
void | AI_122_PirateGhost () |
bool | AnyInteractions () |
void | ApplyInteraction (int player) |
void | AttemptToConvertNPCToEvil (bool crimson) |
int | BannerID () |
void | BigMimicSpawnSmoke () |
void | BloodNautilus_GetMouthPositionAndRotation (out Vector2 mouthPosition, out Vector2 mouthDirection) |
bool | Boss_CanShootExtraAt (int playerIndex, int rotationIndexToAttack, int rotationSize, float attackScanDistance, bool alwaysSkipMainTarget=true) |
bool | CanBeChasedBy (object attacker=null, bool ignoreDontTakeDamage=false) |
bool | CanReflectProjectile (Projectile proj) |
void | CheckActive () |
int | checkArmorPenetration (int armorPenetration) |
void | checkDead () |
void | CheckDrowning () |
object | Clone () |
void | CloneDefaults (int Type) |
void | CopyInteractions (NPC npc) |
void | DelBuff (int buffIndex) |
void | DiscourageDespawn (int despawnTime) |
bool | DoesntDespawnToInactivity () |
void | DropItemInstanced (Vector2 Position, Vector2 HitboxSize, int itemType, int itemStack=1, bool interactionRequired=true) |
void | DropTombstoneTownNPC (NetworkText deathText) |
void | EncourageDespawn (int despawnTime) |
bool | ExcludedFromDeathTally () |
void | FaceTarget () |
int | FindBuffIndex (int type) |
int | FindClosestPlayer () |
int | FindClosestPlayer (out float distanceToPlayer) |
void | FindFrame () |
Color | GetAlpha (Color newColor) |
int | GetAttackDamage_ForProjectiles (float normalDamage, float expertDamage) |
int | GetAttackDamage_ForProjectiles_MultiLerp (float normalDamage, float expertDamage, float masterDamage) |
int | GetAttackDamage_LerpBetweenFinalValues (float normalDamage, float expertDamage) |
float | GetAttackDamage_LerpBetweenFinalValuesFloat (float normalDamage, float expertDamage) |
int | GetAttackDamage_ScaledByStrength (float normalDamage) |
string | GetBestiaryCreditId () |
Color | GetBestiaryEntryColor () |
float | GetBossHeadRotation () |
SpriteEffects | GetBossHeadSpriteEffects () |
int | GetBossHeadTextureIndex () |
string | GetChat () |
Color | GetColor (Color newColor) |
NetworkText | GetFullNetName () |
NetworkText | GetGivenNetName () |
NetworkText | GetGivenOrTypeNetName () |
T | GetGlobalNPC< T > (bool exactType=true) |
Gets the instance of the specified GlobalNPC type. This will throw exceptions on failure. More... | |
T | GetGlobalNPC< T > (T baseInstance) |
Gets the local instance of the type of the specified GlobalNPC instance. This will throw exceptions on failure. More... | |
void | GetImmuneTime (int fromWho, int time) |
float | GetLifePercent () |
void | GetLifeStats (out int statLife, out int statLifeMax) |
NPCSpawnParams | GetMatchingSpawnParams () |
float | GetMyBalance () |
string | getNewNPCName () |
Color | GetNPCColorTintedByBuffs (Color npcColor) |
PartyHatColor | GetPartyHatColor () |
Rectangle | getRect () |
int | GetShootingFrame (float circleY) |
IEntitySource | GetSource_Buff (int buffIndex) |
bool | GetSpecialEventTextIfNotEmpty (string specialTextKey, object substitutes, ref string specialEventText) |
Tuple< Vector2, float > | GetSwingStats (int swingMax, int swingCurrent, int aimDir, int itemWidth, int itemHeight) |
NPCAimedTarget | GetTargetData (bool ignorePlayerTankPets=true) |
void | GetTileCollisionParameters (out Vector2 cPosition, out int cWidth, out int cHeight) |
NetworkText | GetTypeNetName () |
bool | GetWereThereAnyInteractions () |
bool | HasBuff (int type) |
Returns whether or not this NPC currently has a (de)buff of the provided type. | |
bool | HasBuff< T > () |
bool | HasLuckTextForWizard (out string specialEventText) |
bool | HasSpecialEventText (string specialTextCategoryKey, out string specialEventText) |
void | HealEffect (int healAmount, bool broadcast=true) |
void | HitEffect (int hitDirection=0, double dmg=10.0) |
bool | HittableForOnHitRewards () |
void | IdleSounds () |
void | moneyPing (Vector2 pos) |
bool | NPCCanStickToWalls () |
void | NPCLoot () |
void | PlayerInteraction (int player) |
void | PopAllAttachedProjectilesAndTakeDamageForThem () |
void | ReflectProjectile (Projectile proj) |
void | ReflectProjectiles (Rectangle myRect) |
void | RequestBuffRemoval (int buffTypeToRemove) |
void | ScaleStats (int? activePlayersCount, GameModeData gameModeData, float? strengthOverride) |
void | ScaleStats_UseStrengthMultiplier (float strength) |
void | SetDefaults (int Type, NPCSpawnParams spawnparams=default(NPCSpawnParams)) |
void | SetDefaults_ForNetId (int Type, float scaleOverride) |
void | SetDefaults_ForNetId (int Type, NPCSpawnParams spawnparams, float scaleOverride) |
void | SetDefaultsKeepPlayerInteraction (int Type) |
void | SetFrameSize () |
bool | ShouldBestiaryGirlBeLycantrope () |
bool | ShouldFaceTarget (ref NPCUtils.TargetSearchResults searchResults, NPCUtils.TargetType? overrideTargetType=null) |
void | SimpleFlyMovement (Vector2 desiredVelocity, float moveSpeed) |
void | SitDown (Point anchorTilePosition, out int direction, out Vector2 bottom) |
Helper method for getting the parameters for seating a town NPC. Assumes the tile at anchorTilePosition is a valid tile for sitting | |
void | SpawnWithHigherTime (int timeMult) |
double | StrikeNPC (int Damage, float knockBack, int hitDirection, bool crit=false, bool noEffect=false, bool fromNet=false) |
double | StrikeNPCNoInteraction (int Damage, float knockBack, int hitDirection, bool crit=false, bool noEffect=false, bool fromNet=false) |
void | TargetClosest (bool faceTarget=true) |
void | TargetClosest_WOF (bool faceTarget=true) |
void | TargetClosestUpgraded (bool faceTarget=true, Vector2? checkPosition=null) |
void | Teleport (Vector2 newPos, int Style=0, int extraInfo=0) |
override string | ToString () |
void | Transform (int newType) |
void | TransformVisuals (int oldType, int newType) |
bool | TryGetGlobalNPC< T > (out T result, bool exactType=true) |
Gets the instance of the specified GlobalNPC type. More... | |
bool | TryGetGlobalNPC< T > (T baseInstance, out T result) |
Safely attempts to get the local instance of the type of the specified GlobalNPC instance. More... | |
void | TryPortalJumping () |
void | TweakSwingStats (int swingMax, int swingCurrent, int aimDir, ref Rectangle itemRectangle) |
void | UpdateAltTexture () |
void | UpdateNPC (int i) |
void | UpdateNPC_BuffSetFlags (bool lowerBuffTime=true) |
bool | UsesPartyHat () |
void | VanillaAI () |
void | VanillaFindFrame (int num, bool isLikeATownNPC, int type) |
void | VanillaHitEffect (int hitDirection=0, double dmg=10.0) |
Public Member Functions inherited from Terraria.Entity | |
float | AngleFrom (Vector2 Source) |
float | AngleTo (Vector2 Destination) |
Vector2 | DirectionFrom (Vector2 Source) |
Vector2 | DirectionTo (Vector2 Destination) |
float | Distance (Vector2 Other) |
float | DistanceSQ (Vector2 Other) |
IEntitySource | GetSource_Accessory (Item item, string? context=null) |
IEntitySource | GetSource_CatchEntity (Entity caughtEntity, string? context=null) |
IEntitySource | GetSource_Death (string? context=null) |
IEntitySource | GetSource_DropAsItem (string? context=null) |
IEntitySource | GetSource_FromAI (string? context=null) |
IEntitySource | GetSource_FromThis (string? context=null) |
IEntitySource | GetSource_GiftOrReward (string? context=null) |
IEntitySource | GetSource_ItemUse (Item item, string? context=null) |
IEntitySource | GetSource_ItemUse_WithPotentialAmmo (Item item, int ammoItemId, string? context=null) |
IEntitySource | GetSource_Loot (string? context=null) |
IEntitySource | GetSource_Misc (string context) |
IEntitySource | GetSource_OnHit (Entity victim, string? context=null) |
IEntitySource | GetSource_OnHurt (Entity attacker, string? context=null) |
IEntitySource | GetSource_OpenItem (int itemType, string? context=null) |
IEntitySource | GetSource_ReleaseEntity (string? context=null) |
IEntitySource | GetSource_TileInteraction (int tileCoordsX, int tileCoordsY, string? context=null) |
bool | WithinRange (Vector2 Target, float MaxRange) |
Static Public Member Functions | |
static Color | AI_121_QueenSlime_GetDustColor () |
static bool | AnyDanger (bool quickBossNPCCheck=false, bool ignorePillars=false) |
static bool | AnyHelpfulFairies () |
static bool | AnyNPCs (int Type) |
static bool | AnyoneNearCultists () |
static bool | BigMimicSummonCheck (int x, int y, Player user) |
static Color | buffColor (Color newColor, float R, float G, float B, float A) |
static bool | BusyWithAnyInvasionOfSorts () |
static bool | CanReleaseNPCs (int who) |
static bool | CheckCatchNPC (NPC npc, Rectangle catchToolRectangle, Item item, Player player, bool lavaProofTool=false) |
Runs most code related to the process of checking whether or not an NPC can be caught. After that, CombinedHooks.OnCatchNPC is run, followed by the code responsible for catching the NPC if applicable. You will need to call this manually if you want to make an NPC-catching tool which acts differently from vanilla's, such as one that uses a projectile instead of an item. As a note, if calling this manually, you will need to check npc.active && npc.catchItem > 0 yourself. More... | |
static void | ClearFoundActiveNPCs () |
static void | ClearFoundNPCTypesForBestiary () |
static int | CountNPCS (int Type) |
static int | DefaultHeadIndexToType (int headIndex) |
static bool | DespawnEncouragement_AIStyle2_FloatingEye_IsDiscouraged (int npcID, Vector2 npcPosition, int target=255) |
static bool | DespawnEncouragement_AIStyle3_Fighters_CanBeBusyWithAction (int npcID) |
static bool | DespawnEncouragement_AIStyle3_Fighters_NotDiscouraged (int npcID, Vector2 position, NPC npcInstance) |
static void | FairyEffects (Vector2 Position, int type) |
static bool | FindCattailTop (int landX, int landY, out int cattailX, out int cattailY) |
static int | FindFirstNPC (int Type) |
static bool | FindTreeBranch (int landX, int landY, out int treeBranchX, out int treeBranchY) |
static int | GetActivePlayerCount () |
static int | GetAvailableAmountOfNPCsToSpawnFromTraps (int amountWeWant) |
static float | GetBalance () |
static IEntitySource | GetBossSpawnSource (int targetPlayerIndex) |
static int | GetBrainOfCthuluCreepersCount () |
static int | GetEaterOfWorldsSegmentsCount () |
static int | GetEaterOfWorldsSegmentsCountByGamemode (int gamemode) |
static string | GetFirstNPCNameOrNull (int npcType) |
static string | GetFullnameByID (int npcID) |
static void | GetMeleeCollisionData (Rectangle victimHitbox, int enemyIndex, ref int specialHitSetter, ref float damageMultiplier, ref Rectangle npcRect) |
static int | GetNPCInvasionGroup (int npcID) |
static bool | GetNPCLocation (int i, bool seekHead, bool averageDirection, out int index, out Vector2 pos) |
static int | GetStackForSlimeItemDrop (int item) |
static void | GetStatScalingFactors (int numPlayers, out float balance, out float boost) |
static void | HealEffect (Rectangle r, int healAmount, bool broadcast=true) |
static int[,,,] | InitializeMoonLordAttacks () |
static int[,] | InitializeMoonLordAttacks2 () |
static bool | IsADeerclopsNearScreen () |
static bool | IsValidSpawningGroundTile (int x, int y) |
static void | LadyBugKilled (Vector2 Position, bool GoldLadyBug=false) |
static bool | MechSpawn (float x, float y, int type) |
static bool | NearSpikeBall (int x, int y) |
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 multiplayer clients. The X and Y parameters dictate the centered spawn position. ai0, ai1, ai2, and ai3 will initialize the NPC.ai[] array with the supplied values. This can be used to pass in information to the NPC. The NPC AI code will have to be written to utilize those values. Target can be set to a Player.whoAmI to have the NPC targetting a specific Player immediately on spawn. Start can be used to ensure that an NPC spawns in a slot after an existing NPC. This can be used to ensure that the spawned NPC draws behind an existing NPC. This is useful for bosses that spawn minions. The return value is the index of the spawned NPC within the Main.npc array. More... | |
static NPC | NewNPCDirect (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) |
This particular overload returns the actual NPC instance rather than the index of the spawned NPC within the Main.npc array. A short-hand for More... | |
static NPC | NewNPCDirect (IEntitySource source, Vector2 position, int type, int start=0, float ai0=0f, float ai1=0f, float ai2=0f, float ai3=0f, int target=255) |
This particular overload returns the actual NPC instance rather than the index of the spawned NPC within the Main.npc array. It also uses a Vector2 for the spawn position instead of X and Y. A short-hand for More... | |
static void | OnGameEventClearedForTheFirstTime (int gameEventId) |
static void | ReleaseNPC (int x, int y, int Type, int Style, int who) |
static void | ResetBadgerHatTime () |
static void | ResetKillCount () |
static void | ResetNetOffsets () |
static void | SetEventFlagCleared (ref bool eventFlag, int gameEventId) |
static void | setFireFlyChance () |
static void | setNPCName (string newName, int npcType, bool resetExtras=false) |
static void | SetWorldSpecificMonstersByWorldID () |
static bool | ShouldEmpressBeEnraged () |
static void | SlimeRainSpawns (int plr) |
static void | SpawnBoss (int spawnPositionX, int spawnPositionY, int Type, int targetPlayerIndex) |
static bool | Spawning_FlyingAntlionCheck (int x, int y) |
static bool | Spawning_SandstoneCheck (int x, int y) |
static void | SpawnNPC () |
static void | SpawnOnPlayer (int plr, int Type) |
static void | SpawnSkeletron (int onWho) |
static void | SpawnWOF (Vector2 pos) |
static int | TypeToDefaultHeadIndex (int type) |
static void | UpdateFoundActiveNPCs () |
static void | UpdateRGBPeriheralProbe () |
static bool | WouldBeEncouragedToDespawn (int aistyle, int type) |
Static Public Member Functions inherited from Terraria.Entity | |
static IEntitySource | GetSource_NaturalSpawn () |
static ? IEntitySource | GetSource_None () |
static IEntitySource | GetSource_TownSpawn () |
static ? IEntitySource | InheritSource (Entity entity) |
Public Attributes | |
float[] | ai = new float[maxAI] |
int | aiAction |
int | aiStyle |
int | alpha |
int | altTexture |
bool | behindTiles |
bool | betsysCurse |
bool | boss |
int | breath |
int | breathCounter |
bool[] | buffImmune = new bool[BuffLoader.BuffCount] |
int[] | buffTime = new int[5] |
int[] | buffType = new int[5] |
bool | canGhostHeal = true |
int | catchItem |
The numerical ID of the item that this NPC becomes when caught. Mainly used for critters that can be caught with bug nets, such as butterflies and worms. Bug nets and other catching tools will only work on NPCs with this field set to something greater than 0. | |
bool | celled |
bool | chaseable = true |
bool | closeDoor |
bool | coldDamage |
Denotes whether or not this NPC counts as dealing cold damage for the purposes of the Warmth Potion. Defaults to false. | |
bool | collideX |
bool | collideY |
Color | color |
bool | confused |
int | damage |
The amount of contact damage this NPC deals. Changing this WILL NOT change the amount of damage done by projectiles. | |
bool | daybreak |
SoundStyle? | DeathSound |
int | defDamage |
int | defDefense |
int | defense |
bool | despawnEncouraged |
int | directionY = 1 |
bool | dontCountMe |
bool | dontTakeDamage |
bool | dontTakeDamageFromHostiles |
int | doorX |
int | doorY |
bool | dripping |
bool | drippingSlime |
bool | drippingSparkleSlime |
bool | dryadBane |
bool | dryadWard |
int | extraValue |
bool | ForcePartyHatOn |
Rectangle | frame |
double | frameCounter |
bool | friendly |
int | friendlyRegen |
float | gfxOffY |
bool | hide |
SoundStyle? | HitSound |
bool | homeless |
int | homeTileX = -1 |
int | homeTileY = -1 |
int | housingCategory |
bool | ichor |
bool | immortal |
int[] | immune = new int[256] |
bool | IsABestiaryIconDummy |
bool | javelined |
bool | justHit |
float | knockBackResist = 1f |
int | lastInteraction = 255 |
int | lastPortalColorIndex |
bool | lavaImmune |
int | life |
int | lifeMax |
int | lifeRegen |
int | lifeRegenCount |
int | lifeRegenExpectedLossPerSecond = -1 |
float[] | localAI = new float[maxAI] |
bool | loveStruck |
bool | markedByScytheWhip |
bool | midas |
float | nameOver |
bool | netAlways |
int | netID |
Vector2 | netOffset = Vector2.Zero |
int | netSkip |
int | netSpam |
bool | netUpdate |
bool | netUpdate2 |
bool | noGravity |
bool | noTileCollide |
float | npcSlots = 1f |
bool | oiled |
int | oldDirectionY |
bool | oldHomeless |
int | oldHomeTileX = -1 |
int | oldHomeTileY = -1 |
Vector2[] | oldPos = new Vector2[10] |
float[] | oldRot = new float[10] |
int | oldTarget |
bool | onFire |
bool | onFire2 |
bool | onFire3 |
bool | onFrostBurn |
bool | onFrostBurn2 |
bool[] | playerInteraction = new bool[256] |
bool | poisoned |
int | rarity |
int | realLife = -1 |
Stores the index of a single NPC. This NPC will then share a health pool with that NPC. Used for the Destroyer's various segments and the Wall of Flesh's eyes and mouth. | |
bool | reflectsProjectiles |
short | releaseOwner = 255 |
float | rotation |
float | scale = 1f |
bool | setFrameSize |
bool | shadowFlame |
bool | soulDrain |
int | soundDelay |
bool | SpawnedFromStatue |
int | spriteDirection = -1 |
bool | stairFall |
int | statsAreScaledForThisManyPlayers |
float | stepSpeed |
bool | stinky |
float | strengthMultiplier = 1f |
float | takenDamageMultiplier = 1f |
int | target = -1 |
Rectangle | targetRect |
bool | teleporting |
int | teleportStyle |
float | teleportTime |
bool | tentacleSpiked |
int | timeLeft |
bool | townNPC |
int | townNpcVariationIndex |
bool | trapImmune |
int | type |
float | value |
bool | venom |
Public Attributes inherited from Terraria.Entity | |
bool | active |
int | direction = 1 |
int | height |
bool | honeyWet |
bool | lavaWet |
int | oldDirection |
Vector2 | oldPosition |
Vector2 | oldVelocity |
Vector2 | position |
Vector2 | velocity |
bool | wet |
byte | wetCount |
int | whoAmI |
int | width |
Static Public Attributes | |
static int | activeTime = 750 |
static readonly int | AFKTimeNeededForNoWorms = 300 |
static bool | boughtBunny = false |
static bool | boughtCat = false |
static bool | boughtDog = false |
const int | breathMax = 200 |
static int | butterflyChance = 0 |
static int[,] | cavernMonsterType = new int[2, 3] |
static bool | combatBookWasUsed = false |
Denotes whether or not Advanced Combat Techniques has been used in the current world. | |
static int | crimsonBoss = -1 |
static bool | downedAncientCultist = false |
Denotes whether or not the Lunatic Cultist has been defeated at least once in the current world. | |
static bool | downedBoss1 = false |
Denotes whether or not the Eye of Cthulhu has been defeated at least once in the current world. | |
static bool | downedBoss2 = false |
Denotes whether or not the Eater of Worlds OR the Brain of Cthulhu have been defeated at least once in the current world. This does NOT track the two of them separately; you will need to establish your own fields in a ModSystem for that. | |
static bool | downedBoss3 = false |
Denotes whether or not Skeletron has been defeated at least once in the current world. | |
static bool | downedChristmasIceQueen = false |
Denotes whether or not at least one Ice Queen has been defeated in the current world. | |
static bool | downedChristmasSantank = false |
Denotes whether or not at least one Santa-NK1 has been defeated in the current world. | |
static bool | downedChristmasTree = false |
Denotes whether or not at least one Everscream has been defeated in the current world. | |
static bool | downedClown = false |
Denotes whether or not at least one Clown has been killed in the current world. Only used to make the Clothier sell the Clown set once at least one has been killed. | |
static bool | downedDeerclops = false |
Denotes whether or not the Deerclops has been defeated at least once in the current world. | |
static bool | downedEmpressOfLight = false |
Denotes whether or not the Empress of Light has been defeated at least once in the current world. | |
static bool | downedFishron = false |
Denotes whether or not Duke Fishron has been defeated at least once in the current world. | |
static bool | downedFrost = false |
Denotes whether or not the Frost Legion has been defeated at least once in the current world. | |
static bool | downedGoblins = false |
Denotes whether or not at least one Goblin Army has been defeated in the current world. | |
static bool | downedGolemBoss = false |
Denotes whether or not Golem has been defeated at least once in the current world. | |
static bool | downedHalloweenKing = false |
Denotes whether or not at least one Pumpking has been defeated in the current world. | |
static bool | downedHalloweenTree = false |
Denotes whether or not at least one Mourning Wood has been defeated in the current world. | |
static bool | downedMartians = false |
Denotes whether or not at least one Martian Madness event has been cleared in the current world. | |
static bool | downedMechBoss1 = false |
Denotes whether or not the Destroyer has been defeated at least once in the current world. | |
static bool | downedMechBoss2 = false |
Denotes whether or not the Twins have been defeated at least once in the current world. | |
static bool | downedMechBoss3 = false |
Denotes whether or not Skeletron Prime has been defeated at least once in the current world. | |
static bool | downedMechBossAny = false |
Denotes whether or not ANY Mechanical Boss has been defeated at least once in the current world. | |
static bool | downedMoonlord = false |
Denotes whether or not the Moon Lord has been defeated at least once in the current world. | |
static bool | downedPirates = false |
Denotes whether or not at least one Pirate Invasion has been defeated in the current world. | |
static bool | downedPlantBoss = false |
Denotes whether or not Plantera has been defeated at least once in the current world. | |
static bool | downedQueenBee = false |
Denotes whether or not at least one Queen Bee has been defeated in the current world. | |
static bool | downedQueenSlime = false |
Denotes whether or not Queen Slime has been defeated at least once in the current world. | |
static bool | downedSlimeKing = false |
Denotes whether or not King Slime has been defeated at least once in the current world. | |
static bool | downedTowerNebula = false |
Denotes whether or not the Nebula Pillar has been defeated at least once in the current world. | |
static bool | downedTowerSolar = false |
Denotes whether or not the Solar Pillar has been defeated at least once in the current world. | |
static bool | downedTowerStardust = false |
Denotes whether or not the Stardust Pillar has been defeated at least once in the current world. | |
static bool | downedTowerVortex = false |
Denotes whether or not the Vortex Pillar has been defeated at least once in the current world. | |
static bool | fairyLog = false |
static int | fireFlyChance = 0 |
static int | fireFlyFriendly = 0 |
static int | fireFlyMultiple = 0 |
static bool | freeCake = false |
static int | goldCritterChance = 400 |
static int | golemBoss = -1 |
static int | immuneTime = 20 |
static int[] | killCount = new int[670] |
static int | ladyBugBadLuckTime = -10800 |
static int | ladyBugGoodLuckTime = 43200 |
static int[] | lazyNPCOwnedProjectileSearchArray = new int[200] |
static bool | LunarApocalypseIsUp = false |
static int | LunarShieldPowerExpert = 150 |
static int | LunarShieldPowerNormal = 100 |
static int | maxAI = 4 |
const int | maxBuffs = 5 |
const int | MaxMoonLordCountdown = 3600 |
static readonly int[,,,] | MoonLordAttacksArray = InitializeMoonLordAttacks() |
static readonly int[,] | MoonLordAttacksArray2 = InitializeMoonLordAttacks2() |
static int | MoonLordCountdown = 0 |
static int | MoonLordFightingDistance = 4500 |
const float | nameOverDistance = 350f |
const float | nameOverIncrement = 0.025f |
static bool[] | npcsFoundForCheckActive = new bool[670] |
static int | offSetDelayTime = 60 |
static int | plantBoss = -1 |
static CoinLossRevengeSystem | RevengeManager = new CoinLossRevengeSystem() |
static int | safeRangeX = (int)((double)(sWidth / 16) * 0.52) |
static int | safeRangeY = (int)((double)(sHeight / 16) * 0.52) |
static bool | savedAngler = false |
static bool | savedBartender = false |
static bool | savedGoblin = false |
static bool | savedGolfer = false |
static bool | savedMech = false |
static bool | savedStylist = false |
static bool | savedTaxCollector = false |
static bool | savedWizard = false |
static int | sHeight = 1080 |
static int | ShieldStrengthTowerNebula = 0 |
static int | ShieldStrengthTowerSolar = 0 |
static int | ShieldStrengthTowerStardust = 0 |
static int | ShieldStrengthTowerVortex = 0 |
static int | sWidth = 1920 |
static bool | taxCollector = false |
static bool | TowerActiveNebula = false |
static bool | TowerActiveSolar = false |
static bool | TowerActiveStardust = false |
static bool | TowerActiveVortex = false |
static bool | travelNPC = false |
static float | waveKills = 0f |
static int | waveNumber = 0 |
Properties | |
IBigProgressBar | BossBar [get, set] |
Assign a special boss bar, vanilla or modded. Not used by vanilla. More... | |
bool | CanBeTalkedTo [get] |
bool | CanTalk [get] |
bool | CountsAsACritter [get] |
static bool | downedTowers [get] |
string | FullName [get] |
The FULL name of this NPC. If the NPC doesn't have a given name, this will just return the type name. A Stylist without a given name will always return "Stylist" here. If the NPC does have a given name, this will return the NPC's full name; given name first, then type name. Full name with a given name is given in the format of "X the Y", where X is their given name and Y is their type name. For example, a Stylist might return "Scarlett the Stylist" here; with Scarlett being her given name, and Stylist being her type name. | |
string | GivenName [get, set] |
The GIVEN name of this NPC. Can be set directly. Given names are unique to each NPC, though two NPCs can have the same given name. Some vanilla examples of given names are Andrew (for the Guide), Yorai (for the Princess), Whitney (for the Steampunker), or Scarlett (for the Stylist). | |
string | GivenOrTypeName [get] |
If this NPC has a given name, returns their given name; otherwise, returns their type name. | |
RefReadOnlyArray< Instanced< GlobalNPC > > | Globals [get] |
NPCHappiness | Happiness [get] |
Provides access to (static) happiness data associated with this NPC's type. | |
bool | HasGivenName [get] |
Whether or not this NPC has a given name. | |
bool | HasNPCTarget [get] |
bool | HasPlayerTarget [get] |
bool | HasValidTarget [get] |
bool | isLikeATownNPC [get] |
ModNPC | ModNPC [get, set] |
float | Opacity [get, set] |
static int | ShieldStrengthTowerMax [get] |
bool | ShowNameOnHover [get, set] |
bool | SupportsNPCTargets [get] |
static bool | TooWindyForButterflies [get] |
static bool | TowersDefeated [get] |
int | TranslatedTargetIndex [get] |
string | TypeName [get] |
The TYPE name of this NPC. Type names are the base titles given to any NPC, and are typically shared amongst all instances of an NPC. For example, the Stylist's type name will always be "Stylist". To modify the type name of a specific NPC, make use of the ModifyTypeName hooks in GlobalNPC and ModLoader.ModNPC, according to your needs. | |
int | WhoAmIToTargettingIndex [get] |
Properties inherited from Terraria.Entity | |
Vector2 | Bottom [get, set] |
Vector2 | BottomLeft [get, set] |
Vector2 | BottomRight [get, set] |
Vector2 | Center [get, set] |
Rectangle | Hitbox [get, set] |
Vector2 | Left [get, set] |
Vector2 | Right [get, set] |
Vector2 | Size [get, set] |
Vector2 | Top [get, set] |
Vector2 | TopLeft [get, set] |
Vector2 | TopRight [get, set] |
virtual Vector2 | VisualPosition [get] |
|
static |
Runs most code related to the process of checking whether or not an NPC can be caught.
After that, CombinedHooks.OnCatchNPC is run, followed by the code responsible for catching the NPC if applicable.
You will need to call this manually if you want to make an NPC-catching tool which acts differently from vanilla's, such as one that uses a projectile instead of an item.
As a note, if calling this manually, you will need to check npc.active && npc.catchItem > 0
yourself.
npc | The NPC which can potentially be caught. |
catchToolRectangle | The hitbox of the tool being used to catch the NPC — be it an item, a projectile, or something else entirely. |
item | The item to be used as a reference for the purposes of CombinedHooks.CanCatchNPC and CombinedHooks.OnCatchNPC. |
player | The player that owns the referenced item. |
lavaProofTool | Whether or not the tool is lavaproof for the purposes of catching vanilla's Underworld critters. Defaults to false. |
T Terraria.NPC.GetGlobalNPC< T > | ( | bool | exactType = true | ) |
Gets the instance of the specified GlobalNPC type. This will throw exceptions on failure.
KeyNotFoundException |
|
T | : | GlobalNPC | |
T | : | GlobalType.GetGlobal | |
T | : | NPC | |
T | : | GlobalNPC | |
T | : | T | |
T | : | globalNPCs | |
T | : | exactType |
T Terraria.NPC.GetGlobalNPC< T > | ( | T | baseInstance | ) |
Gets the local instance of the type of the specified GlobalNPC instance. This will throw exceptions on failure.
KeyNotFoundException |
|
T | : | GlobalNPC | |
T | : | GlobalType.GetGlobal | |
T | : | NPC | |
T | : | GlobalNPC | |
T | : | T | |
T | : | globalNPCs | |
T | : | baseInstance |
bool Terraria.NPC.HasBuff< T > | ( | ) |
T | : | ModBuff | |
T | : | HasBuff | |
T | : | ModContent.BuffType<T>() |
|
static |
Spawns an NPC into the game world with the given type. This method should not be called on multiplayer clients. The X and Y parameters dictate the centered spawn position. ai0, ai1, ai2, and ai3 will initialize the NPC.ai[] array with the supplied values. This can be used to pass in information to the NPC. The NPC AI code will have to be written to utilize those values. Target can be set to a Player.whoAmI to have the NPC targetting a specific Player immediately on spawn. Start can be used to ensure that an NPC spawns in a slot after an existing NPC. This can be used to ensure that the spawned NPC draws behind an existing NPC. This is useful for bosses that spawn minions. The return value is the index of the spawned NPC within the Main.npc array.
source | |
X | |
Y | |
Type | Either an NPCID entry or ModContent.NPCType<T>, for example NPCID.BabySlime or ModContent.NPCType<MyModNPC>() |
Start | |
ai0 | |
ai1 | |
ai2 | |
ai3 | |
Target |
|
static |
|
static |
bool Terraria.NPC.TryGetGlobalNPC< T > | ( | out T | result, |
bool | exactType = true |
||
) |
Gets the instance of the specified GlobalNPC type.
T | : | GlobalNPC | |
T | : | GlobalType.TryGetGlobal | |
T | : | GlobalNPC | |
T | : | T | |
T | : | globalNPCs | |
T | : | exactType | |
T | : | out | |
T | : | result |
bool Terraria.NPC.TryGetGlobalNPC< T > | ( | T | baseInstance, |
out T | result | ||
) |
Safely attempts to get the local instance of the type of the specified GlobalNPC instance.
T | : | GlobalNPC | |
T | : | GlobalType.TryGetGlobal | |
T | : | GlobalNPC | |
T | : | T | |
T | : | globalNPCs | |
T | : | baseInstance | |
T | : | out | |
T | : | result |
|
getset |
Assign a special boss bar, vanilla or modded. Not used by vanilla.
To assign a modded boss bar, use NPC.BossBar = ModContent.GetInstance<ExampleBossBar>(); where ExampleBossBar is a ModBossBar
To assign a vanilla boss bar for whatever reason, fetch it first through the NPC type using Main.BigBossProgressBar.TryGetSpecialVanillaBossBar