Esempio n. 1
0
        //in Terraria.WorldGen.KillTile before if statements checking num49 and num50
        //  add bool vanillaDrop = TileLoader.Drop(i, j, tile.type);
        //  add "vanillaDrop && " to beginning of these if statements
        public static bool Drop(int i, int j, int type)
        {
            foreach (var hook in HookDrop)
            {
                if (!hook(i, j, type))
                {
                    return(false);
                }
            }
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                if (!modTile.Drop(i, j))
                {
                    return(false);
                }
                if (modTile.drop > 0)
                {
                    Item.NewItem(i * 16, j * 16, 16, 16, modTile.drop, 1, false, -1);
                }
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        //in Terraria.Map.MapHelper.GetMapTileXnaColor after result is initialized call
        //  TileLoader.MapColor(tile, ref result);
        internal static void MapColor(MapTile mapTile, ref Color color)
        {
            Tile tile = Main.tile[mapTile.x, mapTile.y];

            if (tile.active())
            {
                ModTile modTile = GetTile(tile.type);
                if (modTile != null)
                {
                    Color?modColor = modTile.MapColor(mapTile.x, mapTile.y);
                    if (modColor.HasValue)
                    {
                        color = modColor.Value;
                    }
                }
            }
            else
            {
                ModWall modWall = WallLoader.GetWall(tile.wall);
                if (modWall != null)
                {
                    Color?modColor = modWall.MapColor(mapTile.x, mapTile.y);
                    if (modColor.HasValue)
                    {
                        color = modColor.Value;
                    }
                }
            }
        }
Esempio n. 3
0
        //in Terraria.WorldGen.KillTile before if statements checking num49 and num50
        //  add bool vanillaDrop = TileLoader.Drop(i, j, tile.type);
        //  add "vanillaDrop && " to beginning of these if statements
        public static bool Drop(int i, int j, int type)
        {
            foreach (GlobalTile globalTile in globalTiles)
            {
                if (!globalTile.Drop(i, j, type))
                {
                    return(false);
                }
            }
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                if (!modTile.Drop(i, j))
                {
                    return(false);
                }
                if (modTile.drop > 0)
                {
                    Item.NewItem(i * 16, j * 16, 16, 16, modTile.drop, 1, false, -1, false, false);
                }
                return(false);
            }
            return(true);
        }
Esempio n. 4
0
        //in Terraria.Player.ItemCheck in if statements for mining
        //  replace num222 += item.hammer; with TileLoader.MineDamage(item.hammer, ref num222);
        //  replace num222 += item.axe; with TileLoader.MineDamage(item.axe, ref num222);
        //in Terraria.Player.PickTile replace num += pickPower; with TileLoader.MineDamage(pickPower, ref num);
        public static void MineDamage(int minePower, ref int damage)
        {
            Tile    target  = Main.tile[Player.tileTargetX, Player.tileTargetY];
            ModTile modTile = GetTile(target.type);

            damage += modTile != null ? (int)(minePower / modTile.mineResist) : minePower;
        }
Esempio n. 5
0
        public static int AutoSelect(int i, int j, Player player)
        {
            if (!Main.tile[i, j].active())
            {
                return(-1);
            }
            int     type    = Main.tile[i, j].type;
            ModTile modTile = GetTile(type);

            for (int k = 0; k < 50; k++)
            {
                Item item = player.inventory[k];
                if (item.type == 0 || item.stack == 0)
                {
                    continue;
                }
                if (modTile != null && modTile.AutoSelect(i, j, item))
                {
                    return(k);
                }
                foreach (var hook in HookAutoSelect)
                {
                    if (hook(i, j, type, item))
                    {
                        return(k);
                    }
                }
            }
            return(-1);
        }
Esempio n. 6
0
        public static void WalkDust(int type, ref int dustType, ref bool makeDust, ref Color color)
        {
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                modTile.WalkDust(ref dustType, ref makeDust, ref color);
            }
        }
Esempio n. 7
0
        //in Terraria.Main.Draw after small if statements setting num15 call
        //  TileLoader.SetAnimationFrame(type, ref num15);
        public static void SetAnimationFrame(int type, ref int frameY)
        {
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                frameY = modTile.animationFrameHeight * Main.tileFrame[type];
            }
        }
Esempio n. 8
0
        public static void KillMultiTile(int i, int j, int frameX, int frameY, int type)
        {
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                modTile.KillMultiTile(i, j, frameX, frameY);
            }
        }
Esempio n. 9
0
        //in Terraria.Player.ItemCheck at end of else if chain setting num to 0 add
        //  else { TileLoader.PickPowerCheck(tile, pickPower, ref num); }
        public static void PickPowerCheck(Tile target, int pickPower, ref int damage)
        {
            ModTile modTile = GetTile(target.type);

            if (modTile != null && pickPower < modTile.minPick)
            {
                damage = 0;
            }
        }
Esempio n. 10
0
        public static string ModDresserName(int type)
        {
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                return(modTile.dresser);
            }
            return("");
        }
Esempio n. 11
0
        //in Terraria.Main.Draw after small if statements setting num15 call
        //  TileLoader.SetAnimationFrame(type, ref num15);
        /// <summary>
        /// Sets the animation frame. Sets frameYOffset = modTile.animationFrameHeight * Main.tileFrame[type]; and then calls ModTile.AnimateIndividualTile
        /// </summary>
        /// <param name="type">The tile type.</param>
        /// <param name="i">The x position in tile coordinates.</param>
        /// <param name="j">The y position in tile coordinates.</param>
        /// <param name="frameXOffset">The offset to frameX.</param>
        /// <param name="frameYOffset">The offset to frameY.</param>
        public static void SetAnimationFrame(int type, int i, int j, ref int frameXOffset, ref int frameYOffset)
        {
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                frameYOffset = modTile.AnimationFrameHeight * Main.tileFrame[type];
                modTile.AnimateIndividualTile(type, i, j, ref frameXOffset, ref frameYOffset);
            }
        }
Esempio n. 12
0
        //in Terraria.Player.CheckSpawn add this to bed type check
        public static bool IsModBed(int type)
        {
            ModTile modTile = GetTile(type);

            if (modTile == null)
            {
                return(false);
            }
            return(modTile.bed);
        }
Esempio n. 13
0
        public static bool HasWalkDust(int type)
        {
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                return(modTile.HasWalkDust());
            }
            return(false);
        }
Esempio n. 14
0
        public static bool IsTorch(int type)
        {
            ModTile modTile = GetTile(type);

            if (modTile == null)
            {
                return(type == TileID.Torches);
            }
            return(modTile.torch);
        }
Esempio n. 15
0
        public static bool IsSapling(int type)
        {
            ModTile modTile = GetTile(type);

            if (modTile == null)
            {
                return(type == TileID.Saplings);
            }
            return(modTile.sapling);
        }
Esempio n. 16
0
        //replace tile type checks for 19 in Terraria.Player, some places in Terraria.WorldGen,
        //  Terraria.Main.DrawTiles, and Terraria.Collision
        public static bool IsPlatform(int type)
        {
            ModTile modTile = GetTile(type);

            if (modTile == null)
            {
                return(type == TileID.Platforms);
            }
            return(modTile.platform);
        }
Esempio n. 17
0
        //in Terraria.UI.ChestUI add this to Lang lookups
        public static string ModChestName(int type)
        {
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                return(modTile.chest);
            }
            return("");
        }
Esempio n. 18
0
        public int TileType(string name)
        {
            ModTile tile = GetTile(name);

            if (tile == null)
            {
                return(0);
            }
            return((int)tile.Type);
        }
Esempio n. 19
0
 public static void DisableSmartCursor(Tile tile, ref bool disable)
 {
     if (tile.active())
     {
         ModTile modTile = GetTile(tile.type);
         if (modTile != null)
         {
             disable = modTile.disableSmartCursor;
         }
     }
 }
Esempio n. 20
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;
        }
Esempio n. 21
0
        public static bool IsClosedDoor(Tile tile)
        {
            ModTile modTile = GetTile(tile.type);

            if (modTile != null)
            {
                return(modTile.OpenDoorID > -1);
            }

            return(tile.type == TileID.ClosedDoor);
        }
Esempio n. 22
0
 //in Terraria.ObjectData.TileObject data make the following public:
 //  newTile, newSubTile, newAlternate, addTile, addSubTile, addAlternate
 internal static void SetDefaults(ModTile tile)
 {
     tile.SetDefaults();
     if (Main.tileLavaDeath[tile.Type])
     {
         Main.tileObsidianKill[tile.Type] = true;
     }
     if (Main.tileSolid[tile.Type])
     {
         Main.tileNoSunLight[tile.Type] = true;
     }
 }
Esempio n. 23
0
        //in Terraria.WorldGen.KillTile before if statement checking num43 call
        //  TileLoader.DropCritterChance(i, j, tile.type, ref num43, ref num44, ref num45);
        public static void DropCritterChance(int i, int j, int type, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance)
        {
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                modTile.DropCritterChance(i, j, ref wormChance, ref grassHopperChance, ref jungleGrubChance);
            }
            foreach (GlobalTile globalTile in globalTiles)
            {
                globalTile.DropCritterChance(i, j, type, ref wormChance, ref grassHopperChance, ref jungleGrubChance);
            }
        }
Esempio n. 24
0
        //in Terraria.WorldGen.KillTile before if (!effectOnly && !WorldGen.stopDrops) add
        //  TileLoader.KillTile(i, j, tile.type, ref fail, ref effectOnly, ref noItem);
        public static void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem)
        {
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                modTile.KillTile(i, j, ref fail, ref effectOnly, ref noItem);
            }
            foreach (GlobalTile globalTile in globalTiles)
            {
                globalTile.KillTile(i, j, type, ref fail, ref effectOnly, ref noItem);
            }
        }
Esempio n. 25
0
        //in Terraria.Lighting.PreRenderPhase add local closer variable and after setting music box
        //  call TileLoader.NearbyEffects(n, num17, type, closer);
        public static void NearbyEffects(int i, int j, int type, bool closer)
        {
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                modTile.NearbyEffects(i, j, closer);
            }
            foreach (GlobalTile globalTile in globalTiles)
            {
                globalTile.NearbyEffects(i, j, type, closer);
            }
        }
Esempio n. 26
0
        //in Terraria.Main.DrawTiles after if statement setting effects call
        //  TileLoader.SetSpriteEffects(j, i, type, ref effects);
        public static void SetSpriteEffects(int i, int j, int type, ref SpriteEffects spriteEffects)
        {
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                modTile.SetSpriteEffects(i, j, ref spriteEffects);
            }
            foreach (GlobalTile globalTile in globalTiles)
            {
                globalTile.SetSpriteEffects(i, j, type, ref spriteEffects);
            }
        }
Esempio n. 27
0
        //in Terraria.Main.Draw after if statement checking whether texture2D is null call
        //  TileLoader.PostDraw(j, i, type, Main.spriteBatch);
        public static void PostDraw(int i, int j, int type, SpriteBatch spriteBatch)
        {
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                modTile.PostDraw(i, j, spriteBatch);
            }
            foreach (GlobalTile globalTile in globalTiles)
            {
                globalTile.PostDraw(i, j, type, spriteBatch);
            }
        }
Esempio n. 28
0
        //in Terraria.Wiring make the following public:
        //  _wireList, _toProcess, _teleport, _inPumpX, _inPumpY, _numInPump, _outPumpX, _outPumpY, _numOutPump CheckMech, TripWire
        //at end of Terraria.Wiring.HitWireSingle inside if statement checking for tile active add
        //  TileLoader.HitWire(i, j, type);
        public static void HitWire(int i, int j, int type)
        {
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                modTile.HitWire(i, j);
            }
            foreach (GlobalTile globalTile in globalTiles)
            {
                globalTile.HitWire(i, j, type);
            }
        }
Esempio n. 29
0
        private void AutoloadTile(Type type)
        {
            ModTile tile = (ModTile)Activator.CreateInstance(type);

            tile.mod = this;
            string name    = type.Name;
            string texture = (type.Namespace + "." + type.Name).Replace('.', '/');

            if (tile.Autoload(ref name, ref texture))
            {
                AddTile(name, tile, texture);
            }
        }
Esempio n. 30
0
        //in Terraria.WorldGen.KillTile before num14 (num dust iteration) is declared, add
        //  TileLoader.NumDust(i, j, tile.type, ref num13);
        public static void NumDust(int i, int j, int type, bool fail, ref int numDust)
        {
            ModTile modTile = GetTile(type);

            if (modTile != null)
            {
                modTile.NumDust(i, j, fail, ref numDust);
            }
            foreach (GlobalTile globalTile in globalTiles)
            {
                globalTile.NumDust(i, j, type, fail, ref numDust);
            }
        }
Esempio n. 31
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;
 }
Esempio n. 32
0
		public void AddTile(ModTile tile)
		{
			this.AddTile(tile.Type);
		}