internal void SetupNPC(NPC npc) { ModNPC newNPC = (ModNPC)Activator.CreateInstance(GetType()); newNPC.npc = npc; npc.modNPC = newNPC; newNPC.mod = mod; newNPC.SetDefaults(); }
public int NPCType(string name) { ModNPC npc = GetNPC(name); if (npc == null) { return(0); } return(npc.npc.type); }
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; }
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); } }