Terraria.ModLoader.ModNPC.Autoload C# (CSharp) Method

Autoload() public method

public Autoload ( string &name, string &texture, string &altTextures ) : bool
name string
texture string
altTextures string
return bool
		public virtual bool Autoload(ref string name, ref string texture, ref string[] altTextures)
		{
			return mod.Properties.Autoload;
		}

Usage Example

Exemplo n.º 1
0
        private void AutoloadNPC(Type type)
        {
            ModNPC npc = (ModNPC)Activator.CreateInstance(type);

            npc.mod = this;
            string name           = type.Name;
            string texture        = (type.Namespace + "." + type.Name).Replace('.', '/');
            string defaultTexture = texture;

            if (npc.Autoload(ref name, ref texture))
            {
                AddNPC(name, npc, texture);
                string headTexture     = defaultTexture + "_Head";
                string bossHeadTexture = headTexture + "_Boss";
                npc.AutoloadHead(ref headTexture, ref bossHeadTexture);
                if (ModLoader.TextureExists(headTexture))
                {
                    AddNPCHeadTexture(npc.npc.type, headTexture);
                }
                if (ModLoader.TextureExists(bossHeadTexture))
                {
                    AddBossHeadTexture(bossHeadTexture);
                    NPCHeadLoader.npcToBossHead[npc.npc.type] = NPCHeadLoader.bossHeads[bossHeadTexture];
                }
            }
        }
All Usage Examples Of Terraria.ModLoader.ModNPC::Autoload