예제 #1
0
 private static void ResizeArrays(bool unloading = false)
 {
     ItemLoader.ResizeArrays(unloading);
     EquipLoader.ResizeAndFillArrays();
     ModPrefix.ResizeArrays();
     Main.InitializeItemAnimations();
     ModDust.ResizeArrays();
     TileLoader.ResizeArrays(unloading);
     WallLoader.ResizeArrays(unloading);
     ProjectileLoader.ResizeArrays();
     NPCLoader.ResizeArrays(unloading);
     NPCHeadLoader.ResizeAndFillArrays();
     ModGore.ResizeAndFillArrays();
     SoundLoader.ResizeAndFillArrays();
     MountLoader.ResizeArrays();
     BuffLoader.ResizeArrays();
     PlayerHooks.RebuildHooks();
     BackgroundTextureLoader.ResizeAndFillArrays();
     UgBgStyleLoader.ResizeAndFillArrays();
     SurfaceBgStyleLoader.ResizeAndFillArrays();
     GlobalBgStyleLoader.ResizeAndFillArrays(unloading);
     WaterStyleLoader.ResizeArrays();
     WaterfallStyleLoader.ResizeArrays();
     WorldHooks.ResizeArrays();
     foreach (LocalizedText text in LanguageManager.Instance._localizedTexts.Values)
     {
         text.Override = null;
     }
 }
예제 #2
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();
        }
예제 #3
0
 //in Terraria.Main.DrawInventory replace
 //  Lang.mapLegend[MapHelper.TileToLookup(Main.recipe[Main.availableRecipe[num60]].requiredTile[num62], 0)]
 //  with Lang.mapLegend.FromType(Main.recipe[Main.availableRecipe[num60]].requiredTile[num62])
 //in Terraria.Main.DrawInfoAccs replace Lang.mapLegend[MapHelper.TileToLookup(Main.player[Main.myPlayer].bestOre, 0)]
 //  with Lang.mapLegend.FromType(Main.player[Main.myPlayer].bestOre)
 public string FromType(int type)
 {
     if (type >= TileID.Count)
     {
         return(TileLoader.GetTile(type).MapName(0, 0));
     }
     return(this[MapHelper.TileToLookup(type, 0)]);
 }
예제 #4
0
        protected sealed override void Register()
        {
            ModTypeLookup <ModTile> .Register(this);

            Type = (ushort)TileLoader.ReserveTileID();

            TileLoader.tiles.Add(this);
        }
예제 #5
0
        internal static void Unload()
        {
            while (loadOrder.Count > 0)
            {
                GetMod(loadOrder.Pop()).UnloadContent();
            }

            loadOrder.Clear();
            loadedMods = new Mod[0];

            ItemLoader.Unload();
            EquipLoader.Unload();
            ModPrefix.Unload();
            ModDust.Unload();
            TileLoader.Unload();
            ModTileEntity.Unload();
            WallLoader.Unload();
            ProjectileLoader.Unload();
            NPCLoader.Unload();
            NPCHeadLoader.Unload();
            PlayerHooks.Unload();
            BuffLoader.Unload();
            MountLoader.Unload();
            ModGore.Unload();
            SoundLoader.Unload();
            DisposeMusic();
            BackgroundTextureLoader.Unload();
            UgBgStyleLoader.Unload();
            SurfaceBgStyleLoader.Unload();
            GlobalBgStyleLoader.Unload();
            WaterStyleLoader.Unload();
            WaterfallStyleLoader.Unload();
            mods.Clear();
            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();
            modHotKeys.Clear();
            RecipeHooks.Unload();
            CommandManager.Unload();
            TagSerializer.Reload();
            ModNet.Unload();
            GameContent.UI.CustomCurrencyManager.Initialize();
            CleanupModReferences();

            if (!Main.dedServ && Main.netMode != 1)             //disable vanilla client compatiblity restrictions when reloading on a client
            {
                ModNet.AllowVanillaClients = false;
            }
        }
예제 #6
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);
        }
예제 #7
0
 public void AddMusicBox(int musicSlot, int itemType, int tileType, int tileFrameY = 0)
 {
     if (Main.dedServ)
     {
         return;
     }
     if (musicSlot < Main.maxMusic)
     {
         throw new ArgumentOutOfRangeException("Cannot assign music box to vanilla music ID " + musicSlot);
     }
     if (musicSlot >= SoundLoader.SoundCount(SoundType.Music))
     {
         throw new ArgumentOutOfRangeException("Music ID " + musicSlot + " does not exist");
     }
     if (itemType < ItemID.Count)
     {
         throw new ArgumentOutOfRangeException("Cannot assign music box to vanilla item ID " + itemType);
     }
     if (ItemLoader.GetItem(itemType) == null)
     {
         throw new ArgumentOutOfRangeException("Item ID " + itemType + " does not exist");
     }
     if (tileType < TileID.Count)
     {
         throw new ArgumentOutOfRangeException("Cannot assign music box to vanilla tile ID " + tileType);
     }
     if (TileLoader.GetTile(tileType) == null)
     {
         throw new ArgumentOutOfRangeException("Tile ID " + tileType + " does not exist");
     }
     if (SoundLoader.musicToItem.ContainsKey(musicSlot))
     {
         throw new ArgumentException("Music ID " + musicSlot + " has already been assigned a music box");
     }
     if (SoundLoader.itemToMusic.ContainsKey(itemType))
     {
         throw new ArgumentException("Item ID " + itemType + " has already been assigned a music");
     }
     if (!SoundLoader.tileToMusic.ContainsKey(tileType))
     {
         SoundLoader.tileToMusic[tileType] = new Dictionary <int, int>();
     }
     if (SoundLoader.tileToMusic[tileType].ContainsKey(tileFrameY))
     {
         string message = "Y-frame " + tileFrameY + " of tile type " + tileType + " has already been assigned a music";
         throw new ArgumentException(message);
     }
     if (tileFrameY % 36 != 0)
     {
         throw new ArgumentException("Y-frame must be divisible by 36");
     }
     SoundLoader.musicToItem[musicSlot]            = itemType;
     SoundLoader.itemToMusic[itemType]             = musicSlot;
     SoundLoader.tileToMusic[tileType][tileFrameY] = musicSlot;
 }
예제 #8
0
        public void AddTile(string name, ModTile tile, string texture)
        {
            int id = TileLoader.ReserveTileID();

            tile.Name            = name;
            tile.Type            = (ushort)id;
            tiles[name]          = tile;
            TileLoader.tiles[id] = tile;
            tile.texture         = texture;
            tile.mod             = this;
        }
예제 #9
0
 private static void ResizeArrays(bool unloading = false)
 {
     ItemLoader.ResizeArrays();
     EquipLoader.ResizeAndFillArrays();
     Main.InitializeItemAnimations();
     TileLoader.ResizeArrays(unloading);
     WallLoader.ResizeArrays(unloading);
     ProjectileLoader.ResizeArrays();
     NPCLoader.ResizeArrays();
     ModGore.ResizeArrays();
     NPCHeadLoader.ResizeAndFillArrays();
     ModSound.ResizeArrays();
 }
예제 #10
0
        internal static void Unload()
        {
            ItemLoader.Unload();
            EquipLoader.Unload();
            ModPrefix.Unload();
            ModDust.Unload();
            TileLoader.Unload();
            ModTileEntity.Unload();
            WallLoader.Unload();
            ProjectileLoader.Unload();
            NPCLoader.Unload();
            NPCHeadLoader.Unload();
            PlayerHooks.Unload();
            BuffLoader.Unload();
            MountLoader.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();
            modHotKeys.Clear();
            RecipeHooks.Unload();
            CommandManager.Unload();
            TagSerializer.Reload();
            ModNet.Unload();
            Config.ConfigManager.Unload();
            CustomCurrencyManager.Initialize();
            EffectsTracker.RemoveModEffects();

            CleanupModReferences();
        }
예제 #11
0
        //make Terraria.Map.MapHelper.colorLookup internal
        //add internal modPosition field to Terraria.Map.MapHelper
        //near end of Terraria.Map.MapHelper.Initialize set modPosition to num11 + 1
        //in Terraria.Map.MapHelper.SaveMap add mod-type-check to darkness check
        internal static void SetupModMap()
        {
            if (Main.dedServ)
            {
                return;
            }
            Array.Resize(ref MapHelper.tileLookup, TileLoader.TileCount());
            Array.Resize(ref MapHelper.wallLookup, WallLoader.WallCount());
            IList <Color>  colors = new List <Color>();
            IList <string> names  = new List <string>();

            foreach (ushort type in tileEntries.Keys)
            {
                MapHelper.tileLookup[type] = (ushort)(MapHelper.modPosition + colors.Count);
                foreach (MapEntry entry in tileEntries[type])
                {
                    ushort mapType = (ushort)(MapHelper.modPosition + colors.Count);
                    entryToTile[mapType] = type;
                    nameFuncs[mapType]   = entry.getName;
                    colors.Add(entry.color);
                    names.Add(entry.name);
                }
            }
            foreach (ushort type in wallEntries.Keys)
            {
                MapHelper.wallLookup[type] = (ushort)(MapHelper.modPosition + colors.Count);
                foreach (MapEntry entry in wallEntries[type])
                {
                    ushort mapType = (ushort)(MapHelper.modPosition + colors.Count);
                    entryToWall[mapType] = type;
                    nameFuncs[mapType]   = entry.getName;
                    colors.Add(entry.color);
                    names.Add(entry.name);
                }
            }
            Array.Resize(ref MapHelper.colorLookup, MapHelper.modPosition + colors.Count);
            Lang.mapLegend.Resize(MapHelper.modPosition + names.Count);
            for (int k = 0; k < colors.Count; k++)
            {
                MapHelper.colorLookup[MapHelper.modPosition + k] = colors[k];
                Lang.mapLegend[MapHelper.modPosition + k]        = names[k];
            }
            initialized = true;
        }
예제 #12
0
 //in Terraria.Main.DrawMap replace text = Lang.mapLegend[type]; with
 //  text = Lang.mapLegend[Main.Map[num91, num92]];
 public string this[MapTile mapTile]
 {
     get
     {
         Tile tile = Main.tile[mapTile.x, mapTile.y];
         if (tile.active())
         {
             if (tile.type >= TileID.Count)
             {
                 return(TileLoader.GetTile(tile.type).MapName(tile.frameX, tile.frameY));
             }
         }
         else if (tile.wall >= WallID.Count)
         {
             return(WallLoader.GetWall(tile.wall).mapName);
         }
         return(legend[mapTile.Type]);
     }
 }
예제 #13
0
        internal static void Unload()
        {
            while (loadOrder.Count > 0)
            {
                GetMod(loadOrder.Pop()).UnloadContent();
            }

            loadOrder.Clear();
            loadedMods = new Mod[0];

            ItemLoader.Unload();
            EquipLoader.Unload();
            ModDust.Unload();
            TileLoader.Unload();
            WallLoader.Unload();
            ProjectileLoader.Unload();
            NPCLoader.Unload();
            NPCHeadLoader.Unload();
            PlayerHooks.Unload();
            BuffLoader.Unload();
            MountLoader.Unload();
            ModGore.Unload();
            SoundLoader.Unload();
            BackgroundTextureLoader.Unload();
            UgBgStyleLoader.Unload();
            SurfaceBgStyleLoader.Unload();
            GlobalBgStyleLoader.Unload();
            WaterStyleLoader.Unload();
            WaterfallStyleLoader.Unload();
            mods.Clear();
            ResizeArrays(true);
            MapLoader.UnloadModMap();
            ItemSorting.SetupWhiteLists();
            modHotKeys.Clear();
            WorldHooks.Unload();
            RecipeHooks.Unload();

            if (!Main.dedServ && Main.netMode != 1)             //disable vanilla client compatiblity restrictions when reloading on a client
            {
                ModNet.AllowVanillaClients = false;
            }
        }
예제 #14
0
 internal static void Unload()
 {
     foreach (Mod mod in mods.Values)
     {
         mod.Unload();
     }
     loadedMods.Clear();
     ItemLoader.Unload();
     EquipLoader.Unload();
     TileLoader.Unload();
     WallLoader.Unload();
     ProjectileLoader.Unload();
     NPCLoader.Unload();
     ModGore.Unload();
     NPCHeadLoader.Unload();
     ModSound.Unload();
     textures.Clear();
     sounds.Clear();
     mods.Clear();
     ResizeArrays(true);
 }
예제 #15
0
 private static void ResizeArrays(bool unloading = false)
 {
     ItemLoader.ResizeArrays();
     EquipLoader.ResizeAndFillArrays();
     Main.InitializeItemAnimations();
     ModDust.ResizeArrays();
     TileLoader.ResizeArrays(unloading);
     WallLoader.ResizeArrays(unloading);
     ProjectileLoader.ResizeArrays();
     NPCLoader.ResizeArrays();
     NPCHeadLoader.ResizeAndFillArrays();
     ModGore.ResizeAndFillArrays();
     SoundLoader.ResizeAndFillArrays();
     MountLoader.ResizeArrays();
     BuffLoader.ResizeArrays();
     BackgroundTextureLoader.ResizeAndFillArrays();
     UgBgStyleLoader.ResizeAndFillArrays();
     SurfaceBgStyleLoader.ResizeAndFillArrays();
     GlobalBgStyleLoader.ResizeAndFillArrays(unloading);
     WaterStyleLoader.ResizeArrays();
     WaterfallStyleLoader.ResizeArrays();
 }
예제 #16
0
 //at end of Terraria.Map.MapHelper.CreateMapTile before returning call
 //  MapLoader.ModMapOption(ref num16, i, j);
 internal static void ModMapOption(ref ushort mapType, int i, int j)
 {
     if (entryToTile.ContainsKey(mapType))
     {
         ModTile tile   = TileLoader.GetTile(entryToTile[mapType]);
         ushort  option = tile.GetMapOption(i, j);
         if (option < 0 || option >= modTileOptions(tile.Type))
         {
             throw new ArgumentOutOfRangeException("Bad map option for tile " + tile.Name + " from mod " + tile.mod.Name);
         }
         mapType += option;
     }
     else if (entryToWall.ContainsKey(mapType))
     {
         ModWall wall   = WallLoader.GetWall(entryToWall[mapType]);
         ushort  option = wall.GetMapOption(i, j);
         if (option < 0 || option >= modWallOptions(wall.Type))
         {
             throw new ArgumentOutOfRangeException("Bad map option for wall " + wall.Name + " from mod " + wall.mod.Name);
         }
         mapType += option;
     }
 }
예제 #17
0
        //TODO: Unhardcode ALL of this.
        private static void ResizeArrays(bool unloading = false)
        {
            DamageClassLoader.ResizeArrays();
            ItemLoader.ResizeArrays(unloading);
            EquipLoader.ResizeAndFillArrays();
            PrefixLoader.ResizeArrays();
            DustLoader.ResizeArrays();
            TileLoader.ResizeArrays(unloading);
            WallLoader.ResizeArrays(unloading);
            TileIO.ResizeArrays();
            ProjectileLoader.ResizeArrays();
            NPCLoader.ResizeArrays(unloading);
            NPCHeadLoader.ResizeAndFillArrays();
            MountLoader.ResizeArrays();
            BuffLoader.ResizeArrays();
            PlayerHooks.RebuildHooks();
            PlayerDrawLayerLoader.ResizeArrays();
            SystemHooks.ResizeArrays();

            if (!Main.dedServ)
            {
                SoundLoader.ResizeAndFillArrays();
                BackgroundTextureLoader.ResizeAndFillArrays();
                UgBgStyleLoader.ResizeAndFillArrays();
                SurfaceBgStyleLoader.ResizeAndFillArrays();
                GlobalBgStyleLoader.ResizeAndFillArrays(unloading);
                GoreLoader.ResizeAndFillArrays();
                WaterStyleLoader.ResizeArrays();
                WaterfallStyleLoader.ResizeArrays();
            }

            foreach (LocalizedText text in LanguageManager.Instance._localizedTexts.Values)
            {
                text.Override = null;
            }
        }
예제 #18
0
 internal void SetupContent()
 {
     foreach (ModItem item in items.Values)
     {
         ItemLoader.SetDefaults(item.item, false);
         item.AutoStaticDefaults();
         item.SetStaticDefaults();
     }
     foreach (ModPrefix prefix in prefixes.Values)
     {
         prefix.AutoDefaults();
         prefix.SetDefaults();
     }
     foreach (ModDust dust in dusts.Values)
     {
         dust.SetDefaults();
     }
     foreach (ModTile tile in tiles.Values)
     {
         Main.tileTexture[tile.Type] = ModContent.GetTexture(tile.texture);
         TileLoader.SetDefaults(tile);
         if (TileID.Sets.HasOutlines[tile.Type])
         {
             Main.highlightMaskTexture[tile.Type] = ModContent.GetTexture(tile.HighlightTexture);
         }
         if (!string.IsNullOrEmpty(tile.chest))
         {
             TileID.Sets.BasicChest[tile.Type] = true;
         }
     }
     foreach (GlobalTile globalTile in globalTiles.Values)
     {
         globalTile.SetDefaults();
     }
     foreach (ModWall wall in walls.Values)
     {
         Main.wallTexture[wall.Type] = ModContent.GetTexture(wall.texture);
         wall.SetDefaults();
     }
     foreach (GlobalWall globalWall in globalWalls.Values)
     {
         globalWall.SetDefaults();
     }
     foreach (ModProjectile projectile in projectiles.Values)
     {
         ProjectileLoader.SetDefaults(projectile.projectile, false);
         projectile.AutoStaticDefaults();
         projectile.SetStaticDefaults();
     }
     foreach (ModNPC npc in npcs.Values)
     {
         NPCLoader.SetDefaults(npc.npc, false);
         npc.AutoStaticDefaults();
         npc.SetStaticDefaults();
     }
     foreach (ModMountData modMountData in mountDatas.Values)
     {
         var mountData = modMountData.mountData;
         mountData.modMountData = modMountData;
         MountLoader.SetupMount(mountData);
         Mount.mounts[modMountData.Type] = mountData;
     }
     foreach (ModBuff buff in buffs.Values)
     {
         Main.buffTexture[buff.Type] = ModContent.GetTexture(buff.texture);
         buff.SetDefaults();
     }
     foreach (ModWaterStyle waterStyle in waterStyles.Values)
     {
         LiquidRenderer.Instance._liquidTextures[waterStyle.Type] = ModContent.GetTexture(waterStyle.texture);
         Main.liquidTexture[waterStyle.Type] = ModContent.GetTexture(waterStyle.blockTexture);
     }
     foreach (ModWaterfallStyle waterfallStyle in waterfallStyles.Values)
     {
         Main.instance.waterfallManager.waterfallTexture[waterfallStyle.Type]
             = ModContent.GetTexture(waterfallStyle.texture);
     }
 }
예제 #19
0
        internal void SetupContent()
        {
            foreach (ModItem item in items.Values)
            {
                Main.itemTexture[item.item.type] = ModLoader.GetTexture(item.texture);
                Main.itemName[item.item.type]    = item.item.name;
                EquipLoader.SetSlot(item.item);
                item.SetDefaults();
                DrawAnimation animation = item.GetAnimation();
                if (animation != null)
                {
                    Main.RegisterItemAnimation(item.item.type, animation);
                    ItemLoader.animations.Add(item.item.type);
                }
            }
            foreach (ModTile tile in tiles.Values)
            {
                Main.tileTexture[tile.Type] = ModLoader.GetTexture(tile.texture);
                TileLoader.SetDefaults(tile);
            }
            foreach (GlobalTile globalTile in globalTiles.Values)
            {
                globalTile.SetDefaults();
            }
            foreach (ModWall wall in walls.Values)
            {
                Main.wallTexture[wall.Type] = ModLoader.GetTexture(wall.texture);
                wall.SetDefaults();
            }
            foreach (GlobalWall globalWall in globalWalls.Values)
            {
                globalWall.SetDefaults();
            }
            foreach (ModProjectile projectile in projectiles.Values)
            {
                Main.projectileTexture[projectile.projectile.type] = ModLoader.GetTexture(projectile.texture);
                Main.projFrames[projectile.projectile.type]        = 1;
                projectile.SetDefaults();
                if (projectile.projectile.hostile)
                {
                    Main.projHostile[projectile.projectile.type] = true;
                }
                if (projectile.projectile.aiStyle == 7)
                {
                    Main.projHook[projectile.projectile.type] = true;
                }
            }
            foreach (ModNPC npc in npcs.Values)
            {
                Main.npcTexture[npc.npc.type] = ModLoader.GetTexture(npc.texture);
                Main.npcName[npc.npc.type]    = npc.npc.name;
                npc.SetDefaults();
                if (npc.npc.lifeMax > 32767 || npc.npc.boss)
                {
                    Main.npcLifeBytes[npc.npc.type] = 4;
                }
                else if (npc.npc.lifeMax > 127)
                {
                    Main.npcLifeBytes[npc.npc.type] = 2;
                }
                else
                {
                    Main.npcLifeBytes[npc.npc.type] = 1;
                }
            }
            foreach (ModGore gore in gores.Values)
            {
                Main.goreTexture[gore.Type] = ModLoader.GetTexture(gore.texture);
            }


            foreach (ModSound sound in sounds.Values)
            {
                Main.soundItem[sound.Type]         = ModLoader.GetSound(sound.audioFilename);
                Main.soundInstanceItem[sound.Type] = Main.soundItem[sound.Type].CreateInstance();
            }
            foreach (ModMount mount in mounts.Values)
            {
                mount.SetDefaults();
            }
        }
예제 #20
0
 /// <summary>
 /// Gets the ModTile instance with the given type. If no ModTile with the given type exists, returns null.
 /// </summary>
 /// <param name="type">The type of the ModTile</param>
 /// <returns>The ModTile instance in the tiles array, null if not found.</returns>
 public static ModTile GetModTile(int type) => TileLoader.GetTile(type);
예제 #21
0
 internal void SetupContent()
 {
     foreach (ModItem item in items.Values)
     {
         Main.itemTexture[item.item.type] = ModLoader.GetTexture(item.texture);
         Main.itemName[item.item.type]    = item.item.name;
         EquipLoader.SetSlot(item.item);
         item.SetDefaults();
         DrawAnimation animation = item.GetAnimation();
         if (animation != null)
         {
             Main.RegisterItemAnimation(item.item.type, animation);
             ItemLoader.animations.Add(item.item.type);
         }
         if (item.flameTexture.Length > 0)
         {
             Main.itemFlameTexture[item.item.type] = ModLoader.GetTexture(item.flameTexture);
         }
     }
     foreach (ModDust dust in dusts.Values)
     {
         dust.SetDefaults();
     }
     foreach (ModTile tile in tiles.Values)
     {
         Main.tileTexture[tile.Type] = ModLoader.GetTexture(tile.texture);
         TileLoader.SetDefaults(tile);
     }
     foreach (GlobalTile globalTile in globalTiles.Values)
     {
         globalTile.SetDefaults();
     }
     foreach (ModWall wall in walls.Values)
     {
         Main.wallTexture[wall.Type] = ModLoader.GetTexture(wall.texture);
         wall.SetDefaults();
     }
     foreach (GlobalWall globalWall in globalWalls.Values)
     {
         globalWall.SetDefaults();
     }
     foreach (ModProjectile projectile in projectiles.Values)
     {
         Main.projectileTexture[projectile.projectile.type] = ModLoader.GetTexture(projectile.texture);
         Main.projFrames[projectile.projectile.type]        = 1;
         projectile.SetDefaults();
         if (projectile.projectile.hostile)
         {
             Main.projHostile[projectile.projectile.type] = true;
         }
         if (projectile.projectile.aiStyle == 7)
         {
             Main.projHook[projectile.projectile.type] = true;
         }
     }
     foreach (ModNPC npc in npcs.Values)
     {
         Main.npcTexture[npc.npc.type] = ModLoader.GetTexture(npc.texture);
         Main.npcName[npc.npc.type]    = npc.npc.name;
         npc.SetDefaults();
         if (npc.npc.lifeMax > 32767 || npc.npc.boss)
         {
             Main.npcLifeBytes[npc.npc.type] = 4;
         }
         else if (npc.npc.lifeMax > 127)
         {
             Main.npcLifeBytes[npc.npc.type] = 2;
         }
         else
         {
             Main.npcLifeBytes[npc.npc.type] = 1;
         }
     }
     foreach (ModMountData modMountData in mountDatas.Values)
     {
         Mount.MountData temp = modMountData.mountData;
         temp.modMountData = modMountData;
         MountLoader.SetupMount(modMountData.mountData);
         Mount.mounts[modMountData.Type] = temp;
     }
     foreach (ModBuff buff in buffs.Values)
     {
         Main.buffTexture[buff.Type] = ModLoader.GetTexture(buff.texture);
         Main.buffName[buff.Type]    = buff.Name;
         buff.SetDefaults();
     }
 }