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

◆ AutoStaticDefaults()

virtual void Terraria.ModLoader.ModNPC.AutoStaticDefaults ( )
inlinevirtual

Automatically sets certain static defaults. Override this if you do not want the properties to be set for you.

Definition at line 146 of file ModNPC.cs.

147 {
148 TextureAssets.Npc[NPC.type] = ModContent.Request<Texture2D>(Texture);
149 if (Banner != 0 && BannerItem != 0)
150 {
151 NPCLoader.bannerToItem[Banner] = BannerItem;
152 }
153 else if (Banner != 0 || BannerItem != 0)
154 {
155 Logging.tML.Warn((object)Language.GetTextValue("tModLoader.LoadWarningBannerOrBannerItemNotSet", base.Mod.DisplayName, Name));
156 }
157 if (NPC.lifeMax > 32767 || NPC.boss)
158 {
159 Main.npcLifeBytes[NPC.type] = 4;
160 }
161 else if (NPC.lifeMax > 127)
162 {
163 Main.npcLifeBytes[NPC.type] = 2;
164 }
165 else
166 {
167 Main.npcLifeBytes[NPC.type] = 1;
168 }
169 }
static Asset< Texture2D >[] Npc
static string GetTextValue(string key)
Retrieves the text value for a specified localization key. The text returned will be for the currentl...
Definition Language.cs:35
Contains methods to access or retrieve localization values. The Localization Guideteaches more about ...
Definition Language.cs:12
int Banner
The type of NPC that this NPC will be considered as when determining banner drops and banner bonuses....
Definition ModNPC.cs:74
virtual string Texture
The file name of this type's texture file in the mod loader's file space.
Definition ModNPC.cs:36
int BannerItem
The type of the item this NPC drops for every 50 times it is defeated. For any ModNPC whose banner fi...
Definition ModNPC.cs:77
NPC NPC
The NPC object that this ModNPC controls.
Definition ModNPC.cs:23
bool boss
Set to true if the NPC is a boss. Prevents off-screen despawn. Bosses also need [AutoloadBossHead] an...
Definition NPC.cs:1141
int lifeMax
The maximum life of this NPC.
Definition NPC.cs:1077
int type
The NPC ID of this NPC. The NPC ID is a unique number assigned to each NPC loaded into the game....
Definition NPC.cs:990
string Name
The internal name of this instance.
Definition IModType.cs:13

References Terraria.ModLoader.ModNPC.Banner, Terraria.ModLoader.ModNPC.BannerItem, Terraria.ModLoader.NPCLoader.bannerToItem, Terraria.NPC.boss, Terraria.Localization.Language.GetTextValue(), Terraria.NPC.lifeMax, Terraria.ModLoader.IModType.Name, Terraria.GameContent.TextureAssets.Npc, Terraria.Main.npcLifeBytes, Terraria.ModLoader.ModNPC.Texture, Terraria.ModLoader.Logging.tML, and Terraria.NPC.type.

Referenced by Terraria.ModLoader.ModNPC.SetupContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: