Exemplo n.º 1
0
 internal static void AddBossBarStyle(ModBossBarStyle bossBarStyle)
 {
     lock (bossBarStyles) {
         bossBarStyles.Add(bossBarStyle);
         ModTypeLookup <ModBossBarStyle> .Register(bossBarStyle);
     }
 }
Exemplo n.º 2
0
 internal static void Add(ModMenu modMenu)
 {
     lock (menus) {
         menus.Add(modMenu);
         ModTypeLookup <ModMenu> .Register(modMenu);
     }
 }
Exemplo n.º 3
0
        internal static void Unload()
        {
            ContentInstance.Clear();
            ModTypeLookup.Clear();
            ItemLoader.Unload();
            EquipLoader.Unload();
            ModPrefix.Unload();
            ModDust.Unload();
            TileLoader.Unload();
            ModTileEntity.UnloadAll();
            WallLoader.Unload();
            ProjectileLoader.Unload();
            NPCLoader.Unload();
            NPCHeadLoader.Unload();
            PlayerHooks.Unload();
            BuffLoader.Unload();
            MountLoader.Unload();
            RarityLoader.Unload();
            DamageClassLoader.Unload();
            ModGore.Unload();
            SoundLoader.Unload();
            DisposeMusic();
            BackgroundTextureLoader.Unload();
            UgBgStyleLoader.Unload();
            SurfaceBgStyleLoader.Unload();
            GlobalBgStyleLoader.Unload();
            WaterStyleLoader.Unload();
            WaterfallStyleLoader.Unload();
            WorldHooks.Unload();
            ResizeArrays(true);
            for (int k = 0; k < Recipe.maxRecipes; k++)
            {
                Main.recipe[k] = new Recipe();
            }
            Recipe.numRecipes = 0;
            RecipeGroupHelper.ResetRecipeGroups();
            Recipe.SetupRecipes();
            MapLoader.UnloadModMap();
            ItemSorting.SetupWhiteLists();
            HotKeyLoader.Unload();
            RecipeHooks.Unload();
            CommandManager.Unload();
            TagSerializer.Reload();
            ModNet.Unload();
            Config.ConfigManager.Unload();
            CustomCurrencyManager.Initialize();
            EffectsTracker.RemoveModEffects();

            // ItemID.Search = IdDictionary.Create<ItemID, short>();
            // NPCID.Search = IdDictionary.Create<NPCID, short>();
            // ProjectileID.Search = IdDictionary.Create<ProjectileID, short>();
            // TileID.Search = IdDictionary.Create<TileID, ushort>();
            // WallID.Search = IdDictionary.Create<WallID, ushort>();
            // BuffID.Search = IdDictionary.Create<BuffID, int>();

            ContentSamples.Initialize();

            CleanupModReferences();
        }
Exemplo n.º 4
0
        protected override void Register()
        {
            InfoName = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.InfoDisplayName.{Name}");

            ModTypeLookup <InfoDisplay> .Register(this);

            Type = InfoDisplayLoader.Add(this);
        }
Exemplo n.º 5
0
        protected override sealed void Register()
        {
            Type = (ushort)WallLoader.ReserveWallID();

            ModTypeLookup <ModWall> .Register(this);

            WallLoader.walls.Add(this);
        }
Exemplo n.º 6
0
        protected sealed override void Register()
        {
            Type = WaterfallStyleLoader.ReserveStyle();

            ModTypeLookup <ModWaterfallStyle> .Register(this);

            WaterfallStyleLoader.waterfallStyles.Add(this);
        }
Exemplo n.º 7
0
        protected override sealed void Register()
        {
            Slot = UgBgStyleLoader.ReserveBackgroundSlot();

            ModTypeLookup <ModUgBgStyle> .Register(this);

            UgBgStyleLoader.ugBgStyles.Add(this);
        }
Exemplo n.º 8
0
        protected override sealed void Register()
        {
            Slot = SurfaceBgStyleLoader.ReserveBackgroundSlot();

            ModTypeLookup <ModSurfaceBgStyle> .Register(this);

            SurfaceBgStyleLoader.surfaceBgStyles.Add(this);
        }
Exemplo n.º 9
0
        protected sealed override void Register()
        {
            ModTypeLookup <ModTile> .Register(this);

            Type = (ushort)TileLoader.ReserveTileID();

            TileLoader.tiles.Add(this);
        }
Exemplo n.º 10
0
        protected override void Register()
        {
            index = DamageClassLoader.Add(this);

            ClassName = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.DamageClassName.{Name}");

            ModTypeLookup <DamageClass> .Register(this);
        }
Exemplo n.º 11
0
        protected sealed override void Register()
        {
            if (Mount.mounts == null || Mount.mounts.Length == MountID.Count)
            {
                Mount.Initialize();
            }

            Type = MountLoader.ReserveMountID();

            ModTypeLookup <ModMount> .Register(this);

            MountLoader.mountDatas[Type] = this;

            foreach (MountTextureType textureType in Enum.GetValues(typeof(MountTextureType)))
            {
                string extraTexture = GetExtraTexture(textureType);

                if (string.IsNullOrEmpty(extraTexture) || !ModContent.TryGetTexture(extraTexture, out var textureAsset))
                {
                    continue;
                }

                switch (textureType)
                {
                case MountTextureType.Back:
                    MountData.backTexture = textureAsset;
                    break;

                case MountTextureType.BackGlow:
                    MountData.backTextureGlow = textureAsset;
                    break;

                case MountTextureType.BackExtra:
                    MountData.backTextureExtra = textureAsset;
                    break;

                case MountTextureType.BackExtraGlow:
                    MountData.backTextureExtraGlow = textureAsset;
                    break;

                case MountTextureType.Front:
                    MountData.frontTexture = textureAsset;
                    break;

                case MountTextureType.FrontGlow:
                    MountData.frontTextureGlow = textureAsset;
                    break;

                case MountTextureType.FrontExtra:
                    MountData.frontTextureExtra = textureAsset;
                    break;

                case MountTextureType.FrontExtraGlow:
                    MountData.frontTextureExtraGlow = textureAsset;
                    break;
                }
            }
        }
Exemplo n.º 12
0
        protected override sealed void Register()
        {
            Type = ModDust.ReserveDustID();

            ModTypeLookup <ModDust> .Register(this);

            ModDust.dusts.Add(this);
            Texture2D = !string.IsNullOrEmpty(Texture) ? ModContent.GetTexture(Texture).Value : TextureAssets.Dust.Value;
        }
Exemplo n.º 13
0
        protected sealed override void Register()
        {
            ModTypeLookup <ModProjectile> .Register(this);

            projectile.type = ProjectileLoader.ReserveProjectileID();
            DisplayName     = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.ProjectileName.{Name}");

            ProjectileLoader.projectiles.Add(this);
        }
Exemplo n.º 14
0
        protected sealed override void Register()
        {
            NPCLoader.VerifyGlobalNPC(this);

            ModTypeLookup <GlobalNPC> .Register(this);

            index = NPCLoader.globalNPCs.Count;

            NPCLoader.globalNPCs.Add(this);
        }
Exemplo n.º 15
0
        protected sealed override void Register()
        {
            ContainerName = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.Containers.{Name}", true);

            ModTypeLookup <ModTile> .Register(this);

            Type = (ushort)TileLoader.ReserveTileID();

            TileLoader.tiles.Add(this);
        }
Exemplo n.º 16
0
        protected sealed override void Register()
        {
            ItemLoader.VerifyGlobalItem(this);

            ModTypeLookup <GlobalItem> .Register(this);

            index = (ushort)ItemLoader.globalItems.Count;

            ItemLoader.globalItems.Add(this);
        }
Exemplo n.º 17
0
        protected sealed override void Register()
        {
            ProjectileLoader.VerifyGlobalProjectile(this);

            ModTypeLookup <GlobalProjectile> .Register(this);

            index = ProjectileLoader.globalProjectiles.Count;

            ProjectileLoader.globalProjectiles.Add(this);
        }
Exemplo n.º 18
0
        protected override sealed void Register()
        {
            ModTypeLookup <ModBuff> .Register(this);

            Type        = BuffLoader.ReserveBuffID();
            DisplayName = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.BuffName.{Name}");
            Description = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.BuffDescription.{Name}");

            BuffLoader.buffs.Add(this);
        }
Exemplo n.º 19
0
        protected sealed override void Register()
        {
            ModTypeLookup <ModPrefix> .Register(this);

            DisplayName = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.Prefix.{Name}");
            Type        = ModPrefix.ReservePrefixID();

            ModPrefix.prefixes.Add(this);
            ModPrefix.categoryPrefixes[Category].Add(this);
        }
Exemplo n.º 20
0
        internal static void RegisterDefaultClasses()
        {
            int i = 0;

            foreach (var damageClass in DamageClasses)
            {
                damageClass.Type = i++;
                ContentInstance.Register(damageClass);
                ModTypeLookup <DamageClass> .Register(damageClass);
            }
        }
Exemplo n.º 21
0
        internal static void RegisterDefaultDisplays()
        {
            int i = 0;

            foreach (var infoDisplay in InfoDisplays)
            {
                infoDisplay.Type = i++;
                ContentInstance.Register(infoDisplay);
                ModTypeLookup <InfoDisplay> .Register(infoDisplay);
            }
        }
Exemplo n.º 22
0
        public virtual void Load(Mod mod)
        {
            Mod = mod;

            if (!Mod.loading)
            {
                throw new Exception("AddTileEntity can only be called from Mod.Load or Mod.Autoload");
            }

            manager.Register(this);
            ModTypeLookup <ModTileEntity> .Register(this);
        }
Exemplo n.º 23
0
        internal static void AddBossBar(ModBossBar bossBar)
        {
            bossBar.index = bossBars.Count;
            bossBars.Add(bossBar);
            ModTypeLookup <ModBossBar> .Register(bossBar);

            //Texture is optional
            if (ModContent.TextureExists(bossBar.Texture))
            {
                bossBarTextures[bossBar.index] = ModContent.GetTexture(bossBar.Texture);
            }
        }
Exemplo n.º 24
0
        public virtual void Load(Mod mod)
        {
            Mod = mod;

            if (!Mod.loading)
            {
                throw new Exception("AddTileEntity can only be called from Mod.Load or Mod.Autoload");
            }

            //TODO: TileENtityLoader??
            int id = ReserveTileEntityID();

            Type = id;
            type = (byte)id;

            ModTypeLookup <ModTileEntity> .Register(this);

            tileEntities.Add(this);
        }
Exemplo n.º 25
0
        protected sealed override void Register()
        {
            ModTypeLookup <ModNPC> .Register(this);

            npc.type    = NPCLoader.ReserveNPCID();
            DisplayName = Mod.GetOrCreateTranslation($"Mods.{Mod.Name}.NPCName.{Name}");

            NPCLoader.npcs.Add(this);

            Type type         = GetType();
            var  autoloadHead = type.GetAttribute <AutoloadHead>();

            if (autoloadHead != null)
            {
                Mod.AddNPCHeadTexture(npc.type, HeadTexture);
            }
            var autoloadBossHead = type.GetAttribute <AutoloadBossHead>();

            if (autoloadBossHead != null)
            {
                Mod.AddBossHeadTexture(BossHeadTexture, npc.type);
            }
        }
Exemplo n.º 26
0
        protected sealed override void Register()
        {
            ModTypeLookup <ModWorld> .Register(this);

            WorldHooks.Add(this);
        }
Exemplo n.º 27
0
        protected sealed override void Register()
        {
            ModTypeLookup <GlobalTile> .Register(this);

            TileLoader.globalTiles.Add(this);
        }
Exemplo n.º 28
0
        protected override sealed void Register()
        {
            ModTypeLookup <GlobalBgStyle> .Register(this);

            GlobalBgStyleLoader.globalBgStyles.Add(this);
        }
Exemplo n.º 29
0
        protected sealed override void Register()
        {
            ModTypeLookup <ModPlayer> .Register(this);

            PlayerHooks.Add(this);
        }
Exemplo n.º 30
0
        protected sealed override void Register()
        {
            ModTypeLookup <GlobalWall> .Register(this);

            WallLoader.globalWalls.Add(this);
        }