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

◆ SetDefaults()

static void Terraria.ModLoader.NPCLoader.SetDefaults ( NPC npc,
bool createModNPC = true )
inlinestaticpackage

Definition at line 443 of file NPCLoader.cs.

444 {
445 if (IsModNPC(npc))
446 {
447 if (createModNPC)
448 {
449 npc.ModNPC = GetNPC(npc.type).NewInstance(npc);
450 }
451 else
452 {
453 Array.Resize(ref npc.buffImmune, BuffLoader.BuffCount);
454 }
455 }
456 GlobalLoaderUtils<GlobalNPC, NPC>.SetDefaults(npc, ref npc._globals, delegate(NPC n)
457 {
458 n.ModNPC?.SetDefaults();
459 });
460 }
static ModNPC GetNPC(int type)
Gets the ModNPC template instance corresponding to the specified type (not the clone/new instance whi...
Definition NPCLoader.cs:295
static bool IsModNPC(NPC npc)
Definition NPCLoader.cs:438

References Terraria.NPC._globals, Terraria.ModLoader.BuffLoader.BuffCount, Terraria.NPC.buffImmune, Terraria.ModLoader.NPCLoader.GetNPC(), Terraria.ModLoader.NPCLoader.IsModNPC(), and Terraria.NPC.type.

Referenced by Terraria.NPC.SetDefaults(), and Terraria.ModLoader.ModNPC.SetupContent().

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