コード例 #1
0
        /*
         *      Abaixo uma função do tipo void que significa que nao precisa de retorno
         *      O código referece ao sistema de wireless
         *      Nota: não alterei esse código do mod de exemplo, porém não achei necessário
         */
        public override void HitWire(int i, int j)
        {
            int y = j - (Main.tile[i, j].frameY / 18);
            int x = i - (Main.tile[i, j].frameX / 18);

            Wiring.SkipWire(x, y);
            Wiring.SkipWire(x, y + 1);
            Wiring.SkipWire(x, y + 2);
            Wiring.SkipWire(x + 1, y);
            Wiring.SkipWire(x + 1, y + 1);
            Wiring.SkipWire(x + 1, y + 2);

            int spawnX   = x * 16 + 16;
            int spawnY   = (y + 3) * 16;
            int npcIndex = -1;

            if (Wiring.CheckMech(x, y, 30) && NPC.MechSpawn((float)spawnX, (float)spawnY, mod.NPCType("gosma")))
            {
                npcIndex = NPC.NewNPC(spawnX, spawnY - 12, mod.NPCType("gosma"));                //Pd- é um npc/monstro no qual eu criei, peço desculpas pela falta de criatividade
            }
            if (npcIndex >= 0)
            {
                Main.npc[npcIndex].value    = 0f;
                Main.npc[npcIndex].npcSlots = 0f;
            }
        }
コード例 #2
0
        public override void HitWire(int i, int j)
        {
            int left = i - (Main.tile[i, j].frameX / 18) % 1;
            int top  = j - (Main.tile[i, j].frameY / 18) % 3;

            for (int x = left; x < left + 1; x++)
            {
                for (int y = top; y < top + 3; y++)
                {
                    if (Main.tile[x, y].frameX >= 18)
                    {
                        Main.tile[x, y].frameX -= 18;
                    }
                    else
                    {
                        Main.tile[x, y].frameX += 18;
                    }
                }
            }
            if (Wiring.running)
            {
                Wiring.SkipWire(left, top);
                Wiring.SkipWire(left, top + 1);
                Wiring.SkipWire(left, top + 2);
            }
            NetMessage.SendTileSquare(-1, left, top + 1, 2);
        }
コード例 #3
0
        public override void HitWire(int i, int j)
        {
            int y = j;
            int x = i;

            Wiring.SkipWire(x, y);
            int    spawnX = x * 16;
            int    spawnY = y * 16;
            int    style  = Main.tile[i, j].frameX / 18;
            string type;

            switch (style)
            {
            case 0:
                if (Wiring.CheckMech(x, y, 90) && NPC.MechSpawn((float)spawnX, (float)spawnY, mod.ProjectileType("ElectricBallTrap")))
                {
                    Projectile.NewProjectile((float)spawnX + 8, (float)spawnY + 8, 0f, -3f, mod.ProjectileType("ElectricBallTrap"), 130, 0);
                }
                break;

            case 1:
                if (Wiring.CheckMech(x, y, 90) && NPC.MechSpawn((float)spawnX, (float)spawnY, mod.ProjectileType("ElectricBrainTrap")))
                {
                    Projectile.NewProjectile((float)spawnX + 8, (float)spawnY + 8, 0f, -4f, mod.ProjectileType("ElectricBrainTrap"), 5, 0);
                }
                break;

            default:
                return;
            }
        }
コード例 #4
0
        public override void HitWire(int i, int j)        //may change this to hitwire shifts the X position so it keeps the current channel
        {
            Tile  tile            = Main.tile[i, j];
            int   topX            = i - tile.frameX / FrameWidth % TileWidth;
            int   topY            = j - tile.frameY / FrameHeight % TileHeight;
            short frameAdjustment = (short)(tile.frameY > (((PlanetMod.animArraySize - 1) * Height) + Height - FrameHeight) ? -(((PlanetMod.animArraySize - 1) * Height) + Height) : Height);            // ? (this goes off the size of the array, but could be changed to be more stable and always go to default without the fixed array size, to correct for being outside channel range) :

            for (int l = topX; l < topX + TileWidth; l++)
            {
                for (int m = topY; m < topY + TileHeight; m++)
                {
                    if (Main.tile[l, m] == null)
                    {
                        Main.tile[l, m] = new Tile();
                    }
                    if (Main.tile[l, m].active() && Main.tile[l, m].type == Type)
                    {
                        Main.tile[l, m].frameY += frameAdjustment;
                    }
                }
            }
            if (Wiring.running)            //TODO
            {
                for (int f = 0; f < TileWidth; f++)
                {
                    for (int g = 0; g < TileHeight; g++)                    //TODO : these may run for one less iteration than they should.
                    {
                        Wiring.SkipWire(topX + f, topY + g);
                    }
                }
            }
            NetMessage.SendTileSquare(-1, i, topY + 1, 3, TileChangeType.None);
        }
コード例 #5
0
        public override void HitWire(int i, int j)
        {
            int x = i - (Main.tile[i, j].frameX / 18) % 3;
            int y = j - (Main.tile[i, j].frameY / 18) % 3;

            Wiring.SkipWire(x, y);
            Wiring.SkipWire(x, y + 1);
            Wiring.SkipWire(x, y + 2);
            Wiring.SkipWire(x + 1, y);
            Wiring.SkipWire(x + 1, y + 1);
            Wiring.SkipWire(x + 1, y + 2);
            Wiring.SkipWire(x + 2, y);
            Wiring.SkipWire(x + 2, y + 1);
            Wiring.SkipWire(x + 2, y + 2);
            for (int l = x; l < x + 3; l++)
            {
                for (int m = y; m < y + 3; m++)
                {
                    if (Main.tile[l, m].liquid == 0 || Main.tile[l, m].liquidType() == 0)
                    {
                        Main.PlaySound(19, x * 16, y * 16, 1);
                        Main.tile[l, m].liquidType(0);
                        Main.tile[l, m].liquid = 255;
                        WorldGen.SquareTileFrame(l, m, true);
                        if (Main.netMode == 1)
                        {
                            NetMessage.sendWater(l, m);
                        }
                    }
                }
            }
        }
コード例 #6
0
        public override void HitWire(int i, int j)
        {
            Point16 Pos = new Point16(i - ((Main.tile[i, j].frameX % 36) / 18), j - (Main.tile[i, j].frameY / 18));

            Wiring.SkipWire(Pos);
            Wiring.SkipWire(Pos.X, Pos.Y + 1);
            Wiring.SkipWire(Pos.X + 1, Pos.Y);
            Wiring.SkipWire(Pos.X + 1, Pos.Y + 1);

            if (Wiring.CheckMech(Pos.X, Pos.Y, 500))
            {
                int     cframe   = Main.tile[Pos.X, Pos.Y].frameX / 36;
                Vector2 spawn    = Pos.ToWorldCoordinates(16f, 16f);
                Vector2 velocity = Vector2.UnitY;
                switch (cframe)
                {
                case 1:
                    velocity = -Vector2.UnitX;
                    break;

                case 2:
                    velocity = Vector2.UnitX;
                    break;

                case 3:
                    velocity = -velocity;
                    break;
                }
                Projectile.NewProjectile(spawn, velocity * 3.5f, ProjectileType <Projectiles.TempleBoulder>(), 70, 3f, Main.myPlayer, Main.rand.Next(2));
            }
        }
コード例 #7
0
ファイル: RedChimney.cs プロジェクト: imkSushi/Miscellania
        public override void HitWire(int i, int j)
        {
            //Top left tile
            int x = i - Main.tile[i, j].frameX / 18;
            int y = j - Main.tile[i, j].frameY % animationFrameHeight / 18;

            Wiring.SkipWire(x, y);
            Wiring.SkipWire(x, y + 1);
            Wiring.SkipWire(x, y + 2);
            Wiring.SkipWire(x + 1, y);
            Wiring.SkipWire(x + 1, y + 1);
            Wiring.SkipWire(x + 1, y + 2);
            Wiring.SkipWire(x + 2, y);
            Wiring.SkipWire(x + 2, y + 1);
            Wiring.SkipWire(x + 2, y + 2);

            try
            {
                var tileEntity = (RedChimneyTE)TileEntity.ByPosition[new Point16(x, y)];
                tileEntity.CurrentState = tileEntity.CurrentState.NextEnum();
                NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, tileEntity.ID, x, y);
            }
            catch (Exception e)
            {
                ErrorLogger.Log("Chimney TileEntity not found! Error! " + e);
            }
        }
コード例 #8
0
        public override void HitWire(int i, int j)        //may wanna make the file frame stuff to rightclick since this may not want to receive wire pulses
        {
            const int tileWidth       = 2;
            const int tileHeight      = 2;
            Tile      tile            = Main.tile[i, j];
            int       topX            = i - tile.frameX / 18 % tileWidth;
            int       topY            = j - tile.frameY / 18 % tileHeight;
            short     frameAdjustment = (short)(tile.frameY > 18 ? -38 : 38);

            for (int l = topX; l < topX + tileWidth; l++)
            {
                for (int m = topY; m < topY + tileHeight; m++)
                {
                    if (Main.tile[l, m] == null)
                    {
                        Main.tile[l, m] = new Tile();
                    }
                    if (Main.tile[l, m].active() && Main.tile[l, m].type == Type)
                    {
                        Main.tile[l, m].frameY += frameAdjustment;
                    }
                }
            }
            if (Wiring.running)
            {
                Wiring.SkipWire(topX, topY);
                Wiring.SkipWire(topX, topY + 1);
                Wiring.SkipWire(topX + 1, topY);
                Wiring.SkipWire(topX + 1, topY + 1);
            }
            NetMessage.SendTileSquare(-1, i, topY + 1, 3, TileChangeType.None);
        }
コード例 #9
0
ファイル: ExampleStatue.cs プロジェクト: raydeejay/tModLoader
        public override void HitWire(int i, int j)
        {
            // Find the coordinates of top left tile square through math
            int y = j - (Main.tile[i, j].frameY / 18);
            int x = i - (Main.tile[i, j].frameX / 18);

            Wiring.SkipWire(x, y);
            Wiring.SkipWire(x, y + 1);
            Wiring.SkipWire(x, y + 2);
            Wiring.SkipWire(x + 1, y);
            Wiring.SkipWire(x + 1, y + 1);
            Wiring.SkipWire(x + 1, y + 2);

            int spawnX   = x * 16 + 16;
            int spawnY   = (y + 3) * 16;
            int npcIndex = -1;

            if (Wiring.CheckMech(x, y, 30) && NPC.MechSpawn((float)spawnX, (float)spawnY, mod.NPCType("PartyZombie")))
            {
                npcIndex = NPC.NewNPC(spawnX, spawnY - 12, mod.NPCType("PartyZombie"));
            }
            if (npcIndex >= 0)
            {
                Main.npc[npcIndex].value    = 0f;
                Main.npc[npcIndex].npcSlots = 0f;
            }
        }
コード例 #10
0
ファイル: AstJarPlaced.cs プロジェクト: Steviegt6/CalValEX
        public override void HitWire(int i, int j)
        {
            int x = i - Main.tile[i, j].frameX / 18 % 1;
            int y = j - Main.tile[i, j].frameY / 18 % 2;

            for (int l = x; l < x + 1; l++)
            {
                for (int m = y; m < y + 2; m++)
                {
                    if (Main.tile[l, m] == null)
                    {
                        Main.tile[l, m] = new Tile();
                    }
                    if (Main.tile[l, m].active() && Main.tile[l, m].type == Type)
                    {
                        if (Main.tile[l, m].frameY < 36)
                        {
                            Main.tile[l, m].frameY += 36;
                        }
                        else
                        {
                            Main.tile[l, m].frameY -= 36;
                        }
                    }
                }
            }
            if (Wiring.running)
            {
                Wiring.SkipWire(x, y);
                Wiring.SkipWire(x, y + 1);
                Wiring.SkipWire(x + 1, y);
                Wiring.SkipWire(x + 1, y + 1);
            }
            NetMessage.SendTileSquare(-1, x, y + 1, 3);
        }
コード例 #11
0
        public override void HitWire(int i, int j)
        {
            Tile tile = Framing.GetTileSafely(i, j);

            int newX = i;
            int newY = j;

            if (tile.frameX % 36 == 18)
            {
                newX = i - 1;
            }
            if (tile.frameY % 36 == 18)
            {
                newY = j - 1;
            }

            for (int k = 0; k < 2; k++)
            {
                for (int l = 0; l < 2; ++l)
                {
                    Main.tile[newX + k, newY + l].frameX += (short)(tile.frameX >= 36 ? -36 : 36);
                    Wiring.SkipWire(newX + k, newY + l);
                }
            }
        }
コード例 #12
0
        public override void HitWire(int i, int j)
        {
            const int tileWidth       = 2;
            const int tileHeight      = 3;
            Tile      tile            = Main.tile[i, j];
            int       topX            = i - tile.frameX / 18 % tileWidth;  //2 = width
            int       topY            = j - tile.frameY / 18 % tileHeight; //3 = height
            short     frameAdjustment = (short)(tile.frameX > 18 ? -36 : 36);

            for (int l = topX; l < topX + tileWidth; l++)
            {
                for (int m = topY; m < topY + tileHeight; m++)
                {
                    if (Main.tile[l, m] == null)
                    {
                        Main.tile[l, m] = new Tile();
                    }
                    if (Main.tile[l, m].active() && Main.tile[l, m].type == Type)
                    {
                        Main.tile[l, m].frameX += frameAdjustment;
                    }
                }
            }
            if (Wiring.running)
            {
                Wiring.SkipWire(topX, topY);
                Wiring.SkipWire(topX, topY + 1);
                Wiring.SkipWire(topX, topY + 2);
                Wiring.SkipWire(topX + 1, topY);
                Wiring.SkipWire(topX + 1, topY + 1);
                Wiring.SkipWire(topX + 1, topY + 2);
            }
            NetMessage.SendTileSquare(-1, i, topY + 1, 3, TileChangeType.None);
        }
コード例 #13
0
        public override void HitWire(int i, int j)
        {
            Tile tile = Main.tile[i, j];
            int  topY;

            for (topY = tile.frameY / 18; topY >= 2; topY -= 2)
            {
            }
            topY = j - topY;
            int topX = tile.frameX / 18;

            if (topX > 1)
            {
                topX -= 2;
            }
            topX = i - topX;
            short frameAdjustment = 36;

            if (Main.tile[topX, topY].frameX > 0)
            {
                frameAdjustment = -36;
            }
            Main.tile[topX, topY].frameX         += frameAdjustment;
            Main.tile[topX, topY + 1].frameX     += frameAdjustment;
            Main.tile[topX + 1, topY].frameX     += frameAdjustment;
            Main.tile[topX + 1, topY + 1].frameX += frameAdjustment;
            Wiring.SkipWire(topX, topY);
            Wiring.SkipWire(topX + 1, topY);
            Wiring.SkipWire(topX, topY + 1);
            Wiring.SkipWire(topX + 1, topY + 1);
            NetMessage.SendTileSquare(-1, topX, topY, 3);
        }
コード例 #14
0
        public override void HitWire(int i, int j)
        {
            Tile tile = Main.tile[i, j];
            int  topY;

            for (topY = tile.frameY / 18; topY >= 3; topY -= 3)
            {
            }
            int num138 = j - topY;
            int num137 = tile.frameX % 108 / 18;

            if (num137 > 2)
            {
                num137 -= 3;
            }
            num137 = i - num137;
            short num135 = 54;

            if (Main.tile[num137, num138].frameX % 108 > 0)
            {
                num135 = -54;
            }
            for (int num134 = num137; num134 < num137 + 3; num134++)
            {
                for (int num133 = num138; num133 < num138 + 3; num133++)
                {
                    Main.tile[num134, num133].frameX += num135;
                    Wiring.SkipWire(num134, num133);
                }
            }
            NetMessage.SendTileSquare(-1, num137 + 1, num138 + 1, 3);
        }
コード例 #15
0
        public override void HitWire(int i, int j)
        {
            // Find the coordinates of top left tile square through math
            int y = j - Main.tile[i, j].frameY / 18;
            int x = i - Main.tile[i, j].frameX / 18;

            Wiring.SkipWire(x, y);
            Wiring.SkipWire(x, y + 1);
            Wiring.SkipWire(x, y + 2);
            Wiring.SkipWire(x + 1, y);
            Wiring.SkipWire(x + 1, y + 1);
            Wiring.SkipWire(x + 1, y + 2);

            // We add 16 to x to spawn right between the 2 tiles. We also want to right on the ground in the y direction.
            int spawnX = x * 16 + 16;
            int spawnY = (y + 3) * 16;

            // This example shows both item spawning code and npc spawning code, you can use whichever code suits your mod
            if (Main.rand.NextFloat() < .95f)             // There is a 95% chance for item spawn and a 5% chance for npc spawn
            {
                // If you want to make a item spawning statue, see below.
                if (Wiring.CheckMech(x, y, 60) && Item.MechSpawn(spawnX, spawnY, ItemID.SilverCoin) && Item.MechSpawn(spawnX, spawnY, ItemID.GoldCoin) && Item.MechSpawn(spawnX, spawnY, ItemID.PlatinumCoin))
                {
                    int id = ItemID.SilverCoin;
                    if (Main.rand.NextBool(100))
                    {
                        id++;
                        if (Main.rand.NextBool(100))
                        {
                            id++;
                        }
                    }
                    Item.NewItem(spawnX, spawnY - 20, 0, 0, id, 1, false, 0, false);
                }
            }
            else
            {
                // If you want to make an NPC spawning statue, see below.
                int npcIndex = -1;
                // 30 is the time before it can be used again. NPC.MechSpawn checks nearby for other spawns to prevent too many spawns. 3 in immediate vicinity, 6 nearby, 10 in world.
                if (Wiring.CheckMech(x, y, 30) && NPC.MechSpawn((float)spawnX, (float)spawnY, NPCID.Goldfish))
                {
                    npcIndex = NPC.NewNPC(spawnX, spawnY - 12, NPCID.Goldfish);
                }
                if (npcIndex >= 0)
                {
                    Main.npc[npcIndex].value    = 0f;
                    Main.npc[npcIndex].npcSlots = 0f;
                    // Prevents Loot if NPCID.Sets.NoEarlymodeLootWhenSpawnedFromStatue and !Main.HardMode or NPCID.Sets.StatueSpawnedDropRarity != -1 and NextFloat() >= NPCID.Sets.StatueSpawnedDropRarity or killed by traps.
                    // Prevents CatchNPC
                    Main.npc[npcIndex].SpawnedFromStatue = true;
                }
            }
        }
コード例 #16
0
        public override void HitWire(int i, int j)
        {
            Tile  tile            = Main.tile[i, j];
            int   topY            = j - tile.frameY / 18 % 2;
            short frameAdjustment = (short)(tile.frameX > 0 ? -18 : 18);

            Main.tile[i, topY].frameX     += frameAdjustment;
            Main.tile[i, topY + 1].frameX += frameAdjustment;
            Wiring.SkipWire(i, topY);
            Wiring.SkipWire(i, topY + 1);
            NetMessage.SendTileSquare(-1, i, topY + 1, 2, TileChangeType.None);
        }
コード例 #17
0
        public void ToggleHatch(int i, int j, ushort type, bool isOpen = false)
        {
            int x = i - (Main.tile[i, j].frameX / 18) % 4;
            int y = j - (Main.tile[i, j].frameY / 18) % 4;

            if (isOpen)
            {
                for (int l = x; l < x + 4; l++)
                {
                    for (int m = y; m < y + 4; m++)
                    {
                        if (!Collision.EmptyTile(l, m, true))
                        {
                            return;
                        }
                    }
                }
            }
            for (int l = x; l < x + 4; l++)
            {
                for (int m = y; m < y + 4; m++)
                {
                    if (Main.tile[l, m] == null)
                    {
                        Main.tile[l, m] = new Tile();
                    }
                    Main.tile[l, m].active(true);
                    Main.tile[l, m].type = type;
                }
            }
            if (Main.netMode != 1 && Wiring.running)
            {
                for (int ix = x; ix < x + 4; ++ix)
                {
                    for (int iy = y; iy < y + 4; ++iy)
                    {
                        Wiring.SkipWire(ix, iy);
                    }
                }
            }

            NetMessage.SendTileSquare(-1, x + 1, y + 1, 4, TileChangeType.None);

            string sound = "Sounds/HatchOpenSound";

            if (isOpen)
            {
                sound = "Sounds/HatchCloseSound";
            }
            Main.PlaySound(SoundLoader.customSoundType, i * 16, j * 16, mod.GetSoundSlot(SoundType.Custom, sound));
        }
コード例 #18
0
        public override void HitWire(int i, int j)
        {
            Tile tile = Framing.GetTileSafely(i, j);

            int newY = j - tile.frameY % 54 / 18;

            tile = Framing.GetTileSafely(i, newY);

            for (int l = 0; l < 3; ++l)
            {
                Main.tile[i, newY + l].frameX += (short)(tile.frameX >= 18 ? -18 : 18);
                Wiring.SkipWire(i, newY + l);
            }
        }
コード例 #19
0
        public override void HitWire(int i, int j)
        {
            int y = j;
            int x = i;

            Wiring.SkipWire(x, y);
            int spawnX = x * 16;
            int spawnY = y * 16;

            if (Wiring.CheckMech(x, y, 90) && NPC.MechSpawn((float)spawnX, (float)spawnY, mod.ProjectileType("ElectricBrainTrap")))
            {
                Projectile.NewProjectile((float)spawnX + 8, (float)spawnY + 8, 0f, -4f, mod.ProjectileType("ElectricBrainTrap"), 5, 0);
            }
        }
コード例 #20
0
        public override void HitWire(int i, int j)
        {
            state = -state;
            int x = i - (Main.tile[i, j].frameX / 18) % 2;
            int y = j - (Main.tile[i, j].frameY / 18) % 3;

            Wiring.SkipWire(x, y);
            Wiring.SkipWire(x, y + 1);
            Wiring.SkipWire(x, y + 2);
            Wiring.SkipWire(x + 1, y);
            Wiring.SkipWire(x + 1, y + 1);
            Wiring.SkipWire(x + 1, y + 2);

            for (int l = x; l < x + 2; l++)
            {
                for (int m = y; m < y + 3; m++)
                {
                    if (Main.tile[l, m] == null)
                    {
                        Main.tile[l, m] = new Tile();
                    }
                    if (Main.tile[l, m].active() && Main.tile[l, m].type == Type)
                    {
                        if (Main.tile[l, m].frameY < 56)
                        {
                            Main.tile[l, m].frameY += 56;
                        }
                        else if (Main.tile[l, m].frameY < 112)
                        {
                            Main.tile[l, m].frameY -= 56;
                        }
                        if (Main.tile[l, m].frameY >= 112)
                        {
                            if (Main.tile[l, m].frameY < 168)
                            {
                                Main.tile[l, m].frameY += 56;
                            }
                            else
                            {
                                Main.tile[l, m].frameY -= 56;
                            }
                        }
                    }
                }
            }
        }
コード例 #21
0
        //From Wiring.cs
        public override void HitWire(int i, int j)
        {
            Tile  tile   = Main.tile[i, j];
            int   num145 = tile.frameY / 18;
            int   num144 = j - num145;
            short num143 = 18;

            if (tile.frameX > 0)
            {
                num143 = -18;
            }
            Main.tile[i, num144].frameX     += num143;
            Main.tile[i, num144 + 1].frameX += num143;
            Wiring.SkipWire(i, num144);
            Wiring.SkipWire(i, num144 + 1);
            NetMessage.SendTileSquare(-1, i, j, 2);
        }
コード例 #22
0
        public override void HitWire(int i, int j)
        {
            // Find the coordinates of top left tile square through math
            int y = j - Main.tile[i, j].frameY / 18;
            int x = i - Main.tile[i, j].frameX / 18;

            Wiring.SkipWire(x, y);
            Wiring.SkipWire(x, y + 1);
            Wiring.SkipWire(x, y + 2);
            Wiring.SkipWire(x + 1, y);
            Wiring.SkipWire(x + 1, y + 1);
            Wiring.SkipWire(x + 1, y + 2);

            // We add 16 to x to spawn right between the 2 tiles. We also want to right on the ground in the y direction.
            int spawnX = x * 16 + 16;
            int spawnY = (y + 3) * 16;

            // This example shows both item spawning code and npc spawning code, you can use whichever code suits your mod

            // If you want to make an NPC spawning statue, see below.
            int npcIndex = -1;
            // 30 is the time before it can be used again. NPC.MechSpawn checks nearby for other spawns to prevent too many spawns. 3 in immediate vicinity, 6 nearby, 10 in world.
            int critter;

            if (Main.LocalPlayer.GetModPlayer <CalValEXPlayer>().ZoneAstral)
            {
                critter = ModContent.NPCType <Blightolemur>();
            }
            else
            {
                critter = ModContent.NPCType <Violemur>();
            }
            if (Wiring.CheckMech(x, y, 30) && NPC.MechSpawn((float)spawnX, (float)spawnY, (critter)))
            {
                npcIndex = NPC.NewNPC(spawnX, spawnY - 12, (critter));
            }
            if (npcIndex >= 0)
            {
                Main.npc[npcIndex].value    = 0f;
                Main.npc[npcIndex].npcSlots = 0f;
                // Prevents Loot if NPCID.Sets.NoEarlymodeLootWhenSpawnedFromStatue and !Main.HardMode or NPCID.Sets.StatueSpawnedDropRarity != -1 and NextFloat() >= NPCID.Sets.StatueSpawnedDropRarity or killed by traps.
                // Prevents CatchNPC
                Main.npc[npcIndex].SpawnedFromStatue = true;
            }
        }
コード例 #23
0
        public override void HitWire(int i, int j)
        {
            Tile tile = Framing.GetTileSafely(i, j); //Initial tile

            int newX = i - tile.frameX % 54 / 18;    //Adjustments
            int newY = j - tile.frameY % 54 / 18;

            tile = Framing.GetTileSafely(newX, newY); //Top-left tile

            for (int k = 0; k < 3; k++)               //Changes frames properly
            {
                for (int l = 0; l < 3; ++l)
                {
                    Main.tile[newX + k, newY + l].frameX += (short)(tile.frameX >= 54 ? -54 : 54);
                    Wiring.SkipWire(newX + k, newY + l);
                }
            }
        }
コード例 #24
0
        public override void HitWire(int i, int j)
        {
            Tile tile = Framing.GetTileSafely(i, j);

            int newY = j - tile.frameY % 36 / 18;

            tile = Framing.GetTileSafely(i, newY);

            Main.NewText("G: " + tile.frameX);

            for (int l = 0; l < 2; --l)
            {
                Main.tile[i, newY + l].frameX += (short)(tile.frameX >= 18 ? -18 : 18);
                Wiring.SkipWire(i, newY + l);
            }

            Main.NewText("G: " + tile.frameX);
        }
コード例 #25
0
        public override void HitWire(int i, int j)
        {
            // Find the coordinates of top left tile square through math
            int y = j - (Main.tile[i, j].frameY / 18);
            int x = i - (Main.tile[i, j].frameX / 18);

            Wiring.SkipWire(x, y);
            Wiring.SkipWire(x, y + 1);
            Wiring.SkipWire(x, y + 2);
            Wiring.SkipWire(x + 1, y);
            Wiring.SkipWire(x + 1, y + 1);
            Wiring.SkipWire(x + 1, y + 2);

            if (Wiring.CheckMech(x, y, 30))
            {
                Main.time = 32400.1;
            }
        }
コード例 #26
0
        public override void HitWire(int i, int j)
        {
            TEWirelessTeleporter TE;

            if (!TryGetTE(i, j, out TE))
            {
                return;
            }

            Wiring.SkipWire(TE.Position.X - 1, TE.Position.Y);
            Wiring.SkipWire(TE.Position.X, TE.Position.Y);
            Wiring.SkipWire(TE.Position.X + 1, TE.Position.Y);

            if (TE.isLocked)
            {
                TE.Teleport();
            }
        }
コード例 #27
0
ファイル: ExampleLamp.cs プロジェクト: vSLG/tModLoader
        public override void HitWire(int i, int j)
        {
            Tile  tile            = Main.tile[i, j];
            int   topY            = j - tile.frameY / 18 % 3;
            short frameAdjustment = (short)(tile.frameX > 0 ? -18 : 18);

            Main.tile[i, topY].frameX     += frameAdjustment;
            Main.tile[i, topY + 1].frameX += frameAdjustment;
            Main.tile[i, topY + 2].frameX += frameAdjustment;

            Wiring.SkipWire(i, topY);
            Wiring.SkipWire(i, topY + 1);
            Wiring.SkipWire(i, topY + 2);

            // Avoid trying to send packets in singleplayer.
            if (Main.netMode != NetmodeID.SinglePlayer)
            {
                NetMessage.SendTileSquare(-1, i, topY + 1, 3, TileChangeType.None);
            }
        }
コード例 #28
0
        public override void HitWire(int i, int j)
        {
            //Top left tile
            int x = i - Main.tile[i, j].frameX % animationFrameWidth / 18;
            int y = j - Main.tile[i, j].frameY % animationFrameHeight / 18;

            Wiring.SkipWire(x, y);
            Wiring.SkipWire(x, y + 1);
            Wiring.SkipWire(x + 1, y);
            Wiring.SkipWire(x + 1, y + 1);
            Wiring.SkipWire(x + 2, y);
            Wiring.SkipWire(x + 2, y + 1);

            bool activate = Main.tile[x, y].frameX != 0;

            for (int l = x; l < x + 3; l++)
            {
                for (int m = y; m < y + 2; m++)
                {
                    if (Main.tile[l, m] == null)
                    {
                        Main.tile[l, m] = new Tile();
                    }
                    if (Main.tile[l, m].active() && Main.tile[l, m].type == Type)
                    {
                        if (activate)
                        {
                            Main.tile[l, m].frameX -= animationFrameWidth;
                        }
                        else
                        {
                            Main.tile[l, m].frameX += animationFrameWidth;
                        }
                    }
                }
            }
            NetMessage.SendTileSquare(-1, x + 1, y + 1, 3);
        }
コード例 #29
0
ファイル: SpongeStation.cs プロジェクト: Joost8910/Joostmod
        public override void HitWire(int i, int j)
        {
            int x = i - (Main.tile[i, j].frameX / 18) % 3;
            int y = j - (Main.tile[i, j].frameY / 18) % 3;

            Wiring.SkipWire(x, y);
            Wiring.SkipWire(x, y + 1);
            Wiring.SkipWire(x, y + 2);
            Wiring.SkipWire(x + 1, y);
            Wiring.SkipWire(x + 1, y + 1);
            Wiring.SkipWire(x + 1, y + 2);
            Wiring.SkipWire(x + 2, y);
            Wiring.SkipWire(x + 2, y + 1);
            Wiring.SkipWire(x + 2, y + 2);
            for (int l = x; l < x + 3; l++)
            {
                for (int m = y; m < y + 3; m++)
                {
                    if (Main.tile[l, m].liquid > 0)
                    {
                        Main.PlaySound(19, x * 16, y * 16, 1);
                        Main.tile[l, m].liquid = 0;
                        Main.tile[l, m].lava(false);
                        Main.tile[l, m].honey(false);
                        WorldGen.SquareTileFrame(l, m, false);
                        if (Main.netMode == 1)
                        {
                            NetMessage.sendWater(l, m);
                        }
                        else
                        {
                            Liquid.AddWater(l, m);
                        }
                    }
                }
            }
        }
コード例 #30
0
 public override void HitWire(int i, int j)
 {
     this.LaunchRocket(i, j);
     Wiring.SkipWire(i, j);
 }