Example #1
0
        internal void SetupNPC(NPC npc)
        {
            ModNPC newNPC = (ModNPC)Activator.CreateInstance(GetType());

            newNPC.npc = npc;
            npc.modNPC = newNPC;
            newNPC.mod = mod;
            newNPC.SetDefaults();
        }
Example #2
0
        public int NPCType(string name)
        {
            ModNPC npc = GetNPC(name);

            if (npc == null)
            {
                return(0);
            }
            return(npc.npc.type);
        }
Example #3
0
        public void AddNPC(string name, ModNPC npc, string texture)
        {
            int id = NPCLoader.ReserveNPCID();

            npc.npc.name       = name;
            npc.npc.type       = id;
            npcs[name]         = npc;
            NPCLoader.npcs[id] = npc;
            npc.texture        = texture;
            npc.mod            = this;
        }
Example #4
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('.', '/');

            if (npc.Autoload(ref name, ref texture))
            {
                AddNPC(name, npc, texture);
            }
        }