Terraria.ModLoader.NPCLoader.ReserveNPCID C# (CSharp) Method

ReserveNPCID() static private method

static private ReserveNPCID ( ) : int
return int
        internal static int ReserveNPCID()
        {
            if (ModNet.AllowVanillaClients) throw new Exception("Adding npcs breaks vanilla client compatiblity");

            int reserveID = nextNPC;
            nextNPC++;
            return reserveID;
        }

Usage Example

Ejemplo n.º 1
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;
        }
All Usage Examples Of Terraria.ModLoader.NPCLoader::ReserveNPCID