private static void DestroyChest(int x, int y) { if (!Chest.DestroyChest(x, y)) { int id = Chest.FindChest(x, y); Chest.DestroyChestDirect(x, y, id); } }
public override void Execute() { Tools.PrepareUndo(x, y, x2, y2, plr); int signs = 0; int frames = 0; int chests = 0; foreach (Sign sign in Main.sign) { if (sign == null) { continue; } ushort type1 = Main.tile[sign.x, sign.y].type; if ((type1 != TileID.Signs) && (type1 != TileID.Tombstones) && (type1 != TileID.AnnouncementBox)) { Sign.KillSign(sign.x, sign.y); signs++; } } for (int i = x; i <= x2; i++) { for (int j = y; j <= y2; j++) { int ID = TEItemFrame.Find(i, j); if (ID == -1) { continue; } if (Main.tile[i, j].type != TileID.ItemFrame) { TEItemFrame.Kill(i, j); frames++; } } } foreach (Chest chest in Main.chest) { if (chest == null) { continue; } ushort type = Main.tile[chest.x, chest.y].type; if ((type != TileID.Containers) && (type != TileID.Containers2) && (type != TileID.Dressers)) { Chest.DestroyChest(chest.x, chest.y); chests++; } } ResetSection(); plr.SendSuccessMessage("Fixed ghost signs ({0}), item frames ({1}) and chests ({2}).", signs, frames, chests); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType <SepulchreChest>()); Chest.DestroyChest(i, j); Main.PlaySound(SoundID.NPCKilled, (int)i * 16, (int)j * 16, 6); Player player = Main.LocalPlayer; int distance = (int)Vector2.Distance(new Vector2(i * 16, j * 16), player.Center); if (distance < 360) { Main.LocalPlayer.AddBuff(BuffID.Cursed, 300); Main.LocalPlayer.AddBuff(BuffID.Obstructed, 600); } }
public static int ClearChests(int x, int y, int x2, int y2, bool emptyOnly) { int chests = 0; Rectangle area = new Rectangle(x, y, x2 - x, y2 - y); foreach (Chest chest in Main.chest) { if (chest == null) { continue; } if (area.Contains(chest.x, chest.y) && (!emptyOnly || chest.item.All(i => (i?.netID == 0)))) { chests++; Chest.DestroyChest(chest.x, chest.y); } } return(chests); }
/// <summary> /// Kills a given container tile. Results are synced. /// </summary> /// <param name="tileX"></param> /// <param name="tileY"></param> /// <param name="effectOnly">Only a visual effect; tile is not actually killed (nothing to sync).</param> /// <param name="dropsItem"></param> /// <returns>`true` when no complications occurred during removal. Does not force tile to be removed, if /// complications occur.</returns> public static bool KillContainerTileSynced(int tileX, int tileY, bool effectOnly, bool dropsItem) { Tile tile = Framing.GetTileSafely(tileX, tileY); if (tile.type != TileID.Containers && tile.type != TileID.Containers2) { return(false); } int chestIdx = Chest.FindChest(tileX, tileY); int chestType = tile.type == TileID.Containers2 ? 5 : 1; if (chestIdx != -1 && Chest.DestroyChest(tileX, tileY)) { //if( Main.tile[x, y].type >= TileID.Count ) { // number2 = 101; //} if (Main.netMode != NetmodeID.SinglePlayer) { NetMessage.SendData( msgType: MessageID.ChestUpdates, remoteClient: -1, ignoreClient: -1, text: null, number: chestType, number2: (float)tileX, number3: (float)tileY, number4: 0f, number5: chestIdx, number6: tile.type, number7: 0 ); NetMessage.SendTileSquare(-1, tileX, tileY, 3, TileChangeType.None); } } WorldGen.KillTile(tileX, tileY, false, effectOnly, !dropsItem); return(effectOnly || !Main.tile[tileX, tileY].active()); }
public void Cut() { for (int i = x; i <= x2; i++) { for (int j = y; j <= y2; j++) { var tile = Main.tile[i, j]; switch (tile.type) { case Terraria.ID.TileID.Signs: case Terraria.ID.TileID.Tombstones: case Terraria.ID.TileID.AnnouncementBox: if (tile.frameX % 36 == 0 && tile.frameY == 0) { Sign.KillSign(i, j); } break; case Terraria.ID.TileID.Containers: case Terraria.ID.TileID.Dressers: if (tile.frameX % 36 == 0 && tile.frameY == 0) { Chest.DestroyChest(i, j); } break; case Terraria.ID.TileID.ItemFrame: if (tile.frameX % 36 == 0 && tile.frameY == 0) { Terraria.GameContent.Tile_Entities.TEItemFrame.Kill(i, j); } break; } Main.tile[i, j] = new Tile(); } } ResetSection(); plr.SendSuccessMessage("Cut selection. ({0})", (x2 - x + 1) * (y2 - y + 1)); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 32, 32, ItemType <Items.SunkenTreasure>()); Chest.DestroyChest(i, j); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Terraria.Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType <Items.Placeable.Furniture.SpiritChest>()); Chest.DestroyChest(i, j); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 32, 32, ItemType <Items.Placeable.PlantHarvesterPlaceable>()); Chest.DestroyChest(i, j); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Terraria.Item.NewItem(i * 16, j * 16, 32, 32, mod.ItemType("SpiritChest")); Chest.DestroyChest(i, j); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 32, 32, mod.ItemType("RuinChestItem")); Chest.DestroyChest(i, j); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("RazewoodPiano")); Chest.DestroyChest(i, j); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("KeepChandelier")); Chest.DestroyChest(i, j); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Main.PlaySound(new Terraria.Audio.LegacySoundStyle(3, 4)); Item.NewItem(i * 16, j * 16, 48, 32, dresserDrop); Chest.DestroyChest(i, j); }
internal void Apply(Player player = null) { foreach (var kv in changedTiles) { var k = kv.Key; var x = k >> 16; var y = k & 0xffff; var t = kv.Value; if (t >= 0) { Main.tile.data[x, y] = tiles[t]; } } foreach (var eff in sideEffects) { if (eff == null || eff.Cancel) { continue; } switch (eff.EffectType) { case SideEffectType.ADD_WATER: { Terraria_Server.Liquid.AddWater(null, null, eff.X, eff.Y); //Applying => Normal Tile References break; } case SideEffectType.SMASH_SHADOW_ORB: { WorldModify.shadowOrbSmashed = true; WorldModify.shadowOrbCount++; if (WorldModify.shadowOrbCount >= 3) { WorldModify.shadowOrbCount = 0; var ctx = new HookContext { Connection = player.Connection, Sender = player, Player = player, }; var args = new HookArgs.PlayerTriggeredEvent { X = (int)(player.Position.X / 16), Y = (int)(player.Position.Y / 16), Type = WorldEventType.BOSS, Name = "Eater of Worlds", }; HookPoints.PlayerTriggeredEvent.Invoke(ref ctx, ref args); if (!ctx.CheckForKick() && ctx.Result != HookResult.IGNORE) { //ProgramLog.Users.Log ("{0} @ {1}: Eater of Worlds summoned by {2}.", player.IPAddress, player.whoAmi, player.Name); //NetMessage.SendData (Packet.PLAYER_CHAT, -1, -1, string.Concat (player.Name, " has summoned the Eater of Worlds!"), 255, 255, 128, 150); NPC.SpawnOnPlayer(player.whoAmi, (int)NPCType.N13_EATER_OF_WORLDS_HEAD); } } else { string text = "A horrible chill goes down your spine..."; if (WorldModify.shadowOrbCount == 2) { text = "Screams echo around you..."; } NetMessage.SendData(25, -1, -1, text, 255, 50f, 255f, 130f, 0); } break; } case SideEffectType.NEW_ITEM: { Item.NewItem(eff.X, eff.Y, eff.Width, eff.Height, eff.Type, eff.Stack, eff.NoBroadcast); break; } case SideEffectType.KILL_SIGN: { Sign.KillSign(eff.X, eff.Y); break; } case SideEffectType.DESTROY_CHEST: { Chest.DestroyChest(eff.X, eff.Y); break; } case SideEffectType.FALLING_BLOCK_PROJECTILE: { int p = Projectile.NewProjectile((float)(eff.X * 16 + 8), (float)(eff.Y * 16 + 8), 0f, 0.41f, eff.Type, 10, 0f, 255); var proj = Main.projectile[p]; proj.Creator = player; proj.Velocity.Y = 0.5f; proj.Position.Y += 2f; proj.ai[0] = 1f; NetMessage.SendTileSquare(-1, eff.X, eff.Y, 1); break; } } } }
// NPC.cs @ 56835 public static bool JungleMimicSummonCheck(int x, int y) { if (Main.netMode == NetmodeID.MultiplayerClient || !Main.hardMode) { return(false); } int num13 = Chest.FindChest(x, y); if (num13 < 0) { return(false); } int num11 = 0; int num10 = 0; for (int l = 0; l < 40; l++) { ushort num7 = Main.tile[Main.chest[num13].x, Main.chest[num13].y].type; int num6 = Main.tile[Main.chest[num13].x, Main.chest[num13].y].frameX / 36; if (TileID.Sets.BasicChest[num7] && (num7 != 21 || num6 < 5 || num6 > 6) && Main.chest[num13].item[l] != null && Main.chest[num13].item[l].type > ItemID.None) { if (Main.chest[num13].item[l].type == ItemType <KeyOfFright>()) { num11 += Main.chest[num13].item[l].stack; } else { num10++; } } } if (num10 == 0 && num11 == 1) { _ = 1; if (TileID.Sets.BasicChest[Main.tile[x, y].type]) { if (Main.tile[x, y].frameX % 36 != 0) { x--; } if (Main.tile[x, y].frameY % 36 != 0) { y--; } int number3 = Chest.FindChest(x, y); for (int k = x; k <= x + 1; k++) { for (int i = y; i <= y + 1; i++) { if (TileID.Sets.BasicChest[Main.tile[k, i].type]) { Main.tile[k, i].active(active: false); } } } for (int j = 0; j < 40; j++) { Main.chest[num13].item[j] = new Item(); } Chest.DestroyChest(x, y); int number2 = 1; if (Main.tile[x, y].type == 467) { number2 = 5; } if (Main.tile[x, y].type >= 470) { number2 = 101; } NetMessage.SendData(MessageID.ChestUpdates, -1, -1, null, number2, x, y, 0f, number3, Main.tile[x, y].type); NetMessage.SendTileSquare(-1, x, y, 3); } int num8 = NPC.NewNPC(x * 16 + 16, y * 16 + 32, NPCID.BigMimicJungle); Main.npc[num8].whoAmI = num8; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num8); Main.npc[num8].BigMimicSpawnSmoke(); } return(false); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 32, 32, mod.ItemType("ChestTestItem")); //here put your Chest Item name Chest.DestroyChest(i, j); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("OroborosBookshelf")); Chest.DestroyChest(i, j); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 32, 32, mod.ItemType <Items.Placeable.CrystalChest>()); Chest.DestroyChest(i, j); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 48, 32, ModContent.ItemType <Items.Placeable.Furniture.GloomWood2.GloomWoodTableBlock>()); Chest.DestroyChest(i, j); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("DoomBookcase")); Chest.DestroyChest(i, j); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType <SepulchreChest>()); Chest.DestroyChest(i, j); }
public static bool ChestItemSummonCheck(int x, int y, Mod mod) { if (Main.netMode == NetmodeID.MultiplayerClient || !Main.hardMode) { return(false); } int num = Chest.FindChest(x, y); if (num < 0) { return(false); } int numberKeys = 0; int numberOtherItems = 0; ushort tileType = Main.tile[Main.chest[num].x, Main.chest[num].y].type; int tileStyle = (int)(Main.tile[Main.chest[num].x, Main.chest[num].y].frameX / 36); if (TileID.Sets.BasicChest[tileType] && (tileStyle < 5 || tileStyle > 6)) { for (int i = 0; i < 40; i++) { if (Main.chest[num].item[i] != null && Main.chest[num].item[i].type > ItemID.None) { if (Main.chest[num].item[i].type == ModContent.ItemType <MythrilKey>() || Main.chest[num].item[i].type == ModContent.ItemType <OrichalcumKey>()) { numberKeys += Main.chest[num].item[i].stack; } else { numberOtherItems++; } } } } if (numberOtherItems == 0 && numberKeys == 1) { if (TileID.Sets.BasicChest[Main.tile[x, y].type]) { if (Main.tile[x, y].frameX % 36 != 0) { x--; } if (Main.tile[x, y].frameY % 36 != 0) { y--; } int number = Chest.FindChest(x, y); for (int j = x; j <= x + 1; j++) { for (int k = y; k <= y + 1; k++) { if (TileID.Sets.BasicChest[Main.tile[j, k].type]) { Main.tile[j, k].active(false); } } } for (int l = 0; l < 40; l++) { Main.chest[num].item[l] = new Item(); } Chest.DestroyChest(x, y); NetMessage.SendData(MessageID.ChestUpdates, -1, -1, null, 1, (float)x, (float)y, 0f, number, 0, 0); NetMessage.SendTileSquare(-1, x, y, 3); } int npcToSpawn = NPCID.Mimic; int npcIndex = NPC.NewNPC(x * 16 + 16, y * 16 + 32, npcToSpawn, 0, 0f, 0f, 0f, 0f, 255); Main.npc[npcIndex].whoAmI = npcIndex; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npcIndex, 0f, 0f, 0f, 0, 0, 0); Main.npc[npcIndex].BigMimicSpawnSmoke(); } return(false); }
public override void Execute() { if (!CanUseCommand()) { return; } Tools.PrepareUndo(x, y, x2, y2, plr); int signs = 0, frames = 0, chests = 0, sensors = 0, dummies = 0; foreach (Sign sign in Main.sign) { if (sign == null) { continue; } ushort type = Main.tile[sign.x, sign.y].type; if (!Main.tile[sign.x, sign.y].active() || ((type != TileID.Signs) && (type != TileID.Tombstones) && (type != TileID.AnnouncementBox))) { Sign.KillSign(sign.x, sign.y); signs++; } } for (int i = x; i <= x2; i++) { for (int j = y; j <= y2; j++) { int ID = TEItemFrame.Find(i, j); if (ID == -1) { continue; } if (!Main.tile[i, j].active() || (Main.tile[i, j].type != TileID.ItemFrame)) { TEItemFrame.Kill(i, j); frames++; } } } foreach (Chest chest in Main.chest) { if (chest == null) { continue; } ushort type = Main.tile[chest.x, chest.y].type; if (!Main.tile[chest.x, chest.y].active() || ((type != TileID.Containers) && (type != TileID.Containers2) && (type != TileID.Dressers))) { Chest.DestroyChest(chest.x, chest.y); chests++; } } for (int i = x; i <= x2; i++) { for (int j = y; j <= y2; j++) { int ID = TELogicSensor.Find(i, j); if (ID == -1) { continue; } if (!Main.tile[i, j].active() || (Main.tile[i, j].type != TileID.LogicSensor)) { TELogicSensor.Kill(i, j); sensors++; } } } for (int i = x; i <= x2; i++) { for (int j = y; j <= y2; j++) { int ID = TETrainingDummy.Find(i, j); if (ID == -1) { continue; } if (!Main.tile[i, j].active() || (Main.tile[i, j].type != TileID.TargetDummy)) { TETrainingDummy.Kill(i, j); dummies++; } } } ResetSection(); List <string> ghosts = new List <string>(); if (signs > 0) { ghosts.Add($"signs ({signs})"); } if (frames > 0) { ghosts.Add($"item frames ({frames})"); } if (chests > 0) { ghosts.Add($"chests ({chests})"); } if (sensors > 0) { ghosts.Add($"logic sensors ({sensors})"); } if (dummies > 0) { ghosts.Add($"target dummies ({dummies})"); } if (ghosts.Count > 0) { plr.SendSuccessMessage($"Fixed ghost {string.Join(", ", ghosts)}."); } else { plr.SendSuccessMessage("There are no ghost objects in this area."); } }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("FortressLamp")); Chest.DestroyChest(i, j); }
// The actuall code for summoning/spawning a npc when an item is left in a chest public static bool ChestItemSummonCheck(int x, int y, Mod mod) { if (Main.netMode == NetmodeID.MultiplayerClient || !Main.hardMode) // if its not hardmode the code will return false and wont spawn the mimic { return(false); // stops the code if the world is not in the hardmode state } int num = Chest.FindChest(x, y); if (num < 0) // checks the number of keys in the chest { return(false); // stops the code if there are no temple keys in the chest } int numberofKeys = 0; // integer value for checking amount of keys int numberOtherItems = 0; // integer value for checking if there are any other items in the chest ushort tileType = Main.tile[Main.chest[num].x, Main.chest[num].y].type; int tileStyle = (int)(Main.tile[Main.chest[num].x, Main.chest[num].y].frameX / 36); if (TileID.Sets.BasicChest[tileType] && (tileStyle < 5 || tileStyle > 6)) { for (int i = 0; i < 40; i++) { if (Main.chest[num].item[i] != null && Main.chest[num].item[i].type > ItemID.None) // if the chest don't have any items in it, there are no temple keys in it { if (Main.chest[num].item[i].type == ItemID.TempleKey) // What item that should be used for this npc spawning/summoning { numberofKeys += Main.chest[num].item[i].stack; } else { numberOtherItems++; // increases the numberOtherItems value } } } } if (numberOtherItems == 0 && numberofKeys == 1) // If there are no other items the chest & and there is 1 temple key in it { if (TileID.Sets.BasicChest[Main.tile[x, y].type]) // checks if the tile is a chest { if (Main.tile[x, y].frameX % 36 != 0) { x--; } if (Main.tile[x, y].frameY % 36 != 0) { y--; } int number = Chest.FindChest(x, y); for (int j = x; j <= x + 1; j++) { for (int k = y; k <= y + 1; k++) { if (TileID.Sets.BasicChest[Main.tile[j, k].type]) // Checks if the tile exist ???? { Main.tile[j, k].active(false); } } } for (int l = 0; l < 40; l++) { Main.chest[num].item[l] = new Item(); } Chest.DestroyChest(x, y); // removes the chest tile without dropping a chest item NetMessage.SendData(MessageID.ChestUpdates, -1, -1, null, 1, (float)x, (float)y, 0f, number, 0, 0); NetMessage.SendTileSquare(-1, x, y, 3); } int npcToSpawn = NPCID.BigMimicJungle; // What npc to spawn, in this case a Jungle Mimic int npcIndex = NPC.NewNPC(x * 16 + 16, y * 16 + 32, npcToSpawn, 0, 0f, 0f, 0f, 0f, 255); // Determine where the npc will spawn Main.npc[npcIndex].whoAmI = npcIndex; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npcIndex, 0f, 0f, 0f, 0, 0, 0); Main.npc[npcIndex].BigMimicSpawnSmoke(); // Does the mimic smoke summoning animation } return(false); // stops the code }
public static bool ChestItemSummonCheck(int x, int y, Mod mod) { if (Main.netMode == 1) { return(false); } int num = Chest.FindChest(x, y); if (num < 0) { return(false); } int numberDesertKey = 0; int numberOtherItems = 0; ushort tileType = Main.tile[Main.chest[num].x, Main.chest[num].y].type; int tileStyle = (int)(Main.tile[Main.chest[num].x, Main.chest[num].y].frameX / 36); if (TileID.Sets.BasicChest[tileType] && (tileStyle < 5 || tileStyle > 6)) { for (int i = 0; i < 40; i++) { if (Main.chest[num].item[i] != null && Main.chest[num].item[i].type > 0) { if (Main.chest[num].item[i].type == mod.ItemType("KeyofSands")) { numberDesertKey += Main.chest[num].item[i].stack; } else { numberOtherItems++; } } } } if (numberOtherItems == 0 && numberDesertKey == 1) { if (TileID.Sets.BasicChest[Main.tile[x, y].type]) { if (Main.tile[x, y].frameX % 36 != 0) { x--; } if (Main.tile[x, y].frameY % 36 != 0) { y--; } int number = Chest.FindChest(x, y); for (int j = x; j <= x + 1; j++) { for (int k = y; k <= y + 1; k++) { if (Main.tile[j, k].type == 21) { Main.tile[j, k].active(false); } } } for (int l = 0; l < 40; l++) { Main.chest[num].item[l] = new Item(); } Chest.DestroyChest(x, y); NetMessage.SendData(34, -1, -1, null, 1, (float)x, (float)y, 0f, number, 0, 0); NetMessage.SendTileSquare(-1, x, y, 3); } int npcToSpawn = mod.NPCType("DesertMimic"); int npcIndex = NPC.NewNPC(x * 16 + 16, y * 16 + 32, npcToSpawn, 0, 0f, 0f, 0f, 0f, 255); Main.npc[npcIndex].whoAmI = npcIndex; NetMessage.SendData(23, -1, -1, null, npcIndex, 0f, 0f, 0f, 0, 0, 0); Main.npc[npcIndex].BigMimicSpawnSmoke(); } return(false); }
public override void Execute() { foreach (string fileName in Directory.EnumerateFiles("worldedit", string.Format("redo-{0}-*.dat", plr.User.ID))) { File.Delete(fileName); } if (WorldEdit.Database.GetSqlType() == SqlType.Mysql) { WorldEdit.Database.Query("INSERT IGNORE INTO WorldEdit VALUES (@0, -1, -1)", plr.User.ID); } else { WorldEdit.Database.Query("INSERT OR IGNORE INTO WorldEdit VALUES (@0, 0, 0)", plr.User.ID); } WorldEdit.Database.Query("UPDATE WorldEdit SET RedoLevel = -1 WHERE Account = @0", plr.User.ID); WorldEdit.Database.Query("UPDATE WorldEdit SET UndoLevel = UndoLevel + 1 WHERE Account = @0", plr.User.ID); int undoLevel = 0; using (var reader = WorldEdit.Database.QueryReader("SELECT UndoLevel FROM WorldEdit WHERE Account = @0", plr.User.ID)) { if (reader.Read()) { undoLevel = reader.Get <int>("UndoLevel"); } } string clipboard = Tools.GetClipboardPath(plr.User.ID); string undoPath = Path.Combine("worldedit", string.Format("undo-{0}-{1}.dat", plr.User.ID, undoLevel)); Tools.SaveWorldSection(x, y, x2, y2, undoPath); for (int i = x; i <= x2; i++) { for (int j = y; j <= y2; j++) { var tile = Main.tile[i, j]; switch (tile.type) { case Terraria.ID.TileID.Signs: case Terraria.ID.TileID.Tombstones: case Terraria.ID.TileID.AnnouncementBox: if (tile.frameX % 36 == 0 && tile.frameY == 0) { Sign.KillSign(i, j); } break; case Terraria.ID.TileID.Containers: case Terraria.ID.TileID.Dressers: if (tile.frameX % 36 == 0 && tile.frameY == 0) { Chest.DestroyChest(i, j); } break; case Terraria.ID.TileID.ItemFrame: if (tile.frameX % 36 == 0 && tile.frameY == 0) { Terraria.GameContent.Tile_Entities.TEItemFrame.Kill(i, j); } break; } Main.tile[i, j] = new Tile(); } } if (File.Exists(clipboard)) { File.Delete(clipboard); } File.Copy(undoPath, clipboard); ResetSection(); plr.SendSuccessMessage("Cut selection. ({0})", (x2 - x + 1) * (y2 - y + 1)); }
public override void KillMultiTile(int i, int j, int frameX, int frameY) { Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); Chest.DestroyChest(i, j); }
public static void PlaceCaiburnShrine(Vector2 placementspot, int type) { Tile tstart = Framing.GetTileSafely(placementspot); List <Vector2> deways = new List <Vector2>(); List <Vector2> dewaysMainroom = new List <Vector2>(); int buffersizex = 12 + WorldGen.genRand.Next(7); int buffersizey = 8 + WorldGen.genRand.Next(3); int x = (int)placementspot.X; int y = (int)placementspot.Y; int xbuffer = -buffersizex; int ybuffer = -buffersizey; //ushort[] stoneTypes = new ushort[] { TileID.Stone, TileID.Dirt, TileID.Mud, TileID.ClayBlock }; for (xbuffer = -buffersizex; xbuffer < buffersizex; xbuffer++) { for (ybuffer = -buffersizey; ybuffer < buffersizey; ybuffer++) { Tile tile = Framing.GetTileSafely((int)placementspot.X + (int)xbuffer, (int)placementspot.Y + (int)ybuffer); IDGWorldGen.PlaceMulti(placementspot + new Vector2(xbuffer, ybuffer), SGAmod.Instance.TileType("MoistStone"), 4, SGAmod.Instance.WallType("SwampWall")); dewaysMainroom.Add(new Vector2((int)placementspot.X + (int)xbuffer, (int)placementspot.Y + (int)ybuffer)); } } int t1 = SGAmod.Instance.TileType("MoistStone"); int t2 = SGAmod.Instance.WallType("SwampWall"); PlaceCaiburnHallway(placementspot + new Vector2(buffersizex * 1, 0), 12, 6, 0, ref deways, 0, t1, t2); PlaceCaiburnHallway(placementspot + new Vector2(-buffersizex * 1, 0), 12, 6, 2, ref deways, 0, t1, t2); for (int aaa = 0; aaa < deways.Count; aaa++) { Tile tile = Framing.GetTileSafely((int)deways[aaa].X, (int)deways[aaa].Y); tile.active(false); } for (int aaa = 0; aaa < deways.Count; aaa++) { if (WorldGen.genRand.Next(0, 100) < 5) { Tile tile = Framing.GetTileSafely((int)deways[aaa].X, (int)deways[aaa].Y - 1); if (tile.active()) { WorldGen.PlaceObject((int)deways[aaa].X, (int)deways[aaa].Y, TileID.HangingLanterns, false, 16); } } if (WorldGen.genRand.Next(0, 100) < 5) { Tile tile = Framing.GetTileSafely((int)deways[aaa].X, (int)deways[aaa].Y + 1); if (tile.active()) { WorldGen.placeTrap((int)deways[aaa].X, (int)deways[aaa].Y, 0); } } if (WorldGen.genRand.Next(0, 100) < 2) { Tile tile1 = Framing.GetTileSafely((int)deways[aaa].X, (int)deways[aaa].Y + 1); Tile tile2 = Framing.GetTileSafely((int)deways[aaa].X + 1, (int)deways[aaa].Y + 1); Tile tile3 = Framing.GetTileSafely((int)deways[aaa].X + 1, (int)deways[aaa].Y); Tile tile4 = Framing.GetTileSafely((int)deways[aaa].X, (int)deways[aaa].Y); if (tile1.active() && tile2.active() && !tile3.active() && !tile4.active()) { int thechest = WorldGen.PlaceChest((int)deways[aaa].X, (int)deways[aaa].Y, 21, false, 12); if (thechest > 0) { List <int> loot = new List <int> { 2344, 2345, 2346, 2347, 2348, 2349, 2350, 2351, 2352, 2353, 2354, 2355, 2356, 2359, 301, 302, 303, 304, 305, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 226, 188, 189, 110, 28 }; List <int> lootmain = new List <int> { SGAmod.Instance.ItemType("UnmanedOre"), SGAmod.Instance.ItemType("DankWood"), SGAmod.Instance.ItemType("DankWood"), SGAmod.Instance.ItemType("Biomass"), SGAmod.Instance.ItemType("DankWood"), ItemID.SilverCoin, ItemID.LesserManaPotion }; List <int> lootrare = new List <int> { SGAmod.Instance.ItemType("DankCore"), SGAmod.Instance.ItemType("DankCore") }; int e = 0; for (int kk = 0; kk < 2 + (Main.expertMode ? 1 : 0); kk += 1) { //for (int i = 0; i < WorldGen.genRand.Next(15, Main.expertMode ? 25 : 30); i += 1) //{ int index = WorldGen.genRand.Next(0, loot.Count); Main.chest[thechest].item[e].SetDefaults(loot[index]); Main.chest[thechest].item[e].stack = WorldGen.genRand.Next(1, Main.expertMode ? 3 : 2); //} e += 1; } if (WorldGen.genRand.Next(0, 100) < 20) { int index = WorldGen.genRand.Next(0, lootrare.Count); Main.chest[thechest].item[e].SetDefaults(lootrare[index]); Main.chest[thechest].item[e].stack = WorldGen.genRand.Next(1, Main.expertMode ? 2 : 1); //} e += 1; } for (int kk = 0; kk < 3 + (Main.expertMode ? 1 : 0); kk += 1) { //for (int i = 0; i < WorldGen.genRand.Next(15, Main.expertMode ? 25 : 30); i += 1) //{ int index = WorldGen.genRand.Next(0, lootmain.Count); Main.chest[thechest].item[e].SetDefaults(lootmain[index]); Main.chest[thechest].item[e].stack = WorldGen.genRand.Next(15, Main.expertMode ? 25 : 45); //} e += 1; } } ///WorldGen.PlaceChestDirect((int)deways[aaa].X, (int)deways[aaa].Y, (ushort)SGAmod.Instance.TileType("OvergrownChest"), 0, 0); } } } for (int aaa = 0; aaa < dewaysMainroom.Count; aaa++) { Tile tile = Framing.GetTileSafely((int)dewaysMainroom[aaa].X, (int)dewaysMainroom[aaa].Y); Chest.DestroyChest((int)deways[aaa].X, (int)deways[aaa].Y); WorldGen.KillTile((int)deways[aaa].X, (int)deways[aaa].Y); tile.active(false); } for (int kk = 3; kk < 6; kk += 1) { Main.tile[(int)placementspot.X, (int)placementspot.Y + buffersizey - kk].active(false); for (int xx = 0; xx < 6; xx += 1) { Main.tile[(int)placementspot.X - xx, (int)placementspot.Y + buffersizey - kk].active(false); Main.tile[(int)placementspot.X + xx, (int)placementspot.Y + buffersizey - kk].active(false); } } Main.tile[(int)placementspot.X, (int)placementspot.Y + buffersizey - 1].active(true); for (int xx = 0; xx < 4; xx += 1) { Main.tile[(int)placementspot.X - xx, (int)placementspot.Y + buffersizey - 1].active(true); Main.tile[(int)placementspot.X + xx, (int)placementspot.Y + buffersizey - 1].active(true); } WorldGen.PlaceTile((int)placementspot.X - 2, (int)placementspot.Y + buffersizey - 2, SGAmod.Instance.TileType("MoistStone"), style: 10); Main.tile[(int)placementspot.X - 1, (int)placementspot.Y + buffersizey - 2].active(true); Main.tile[(int)placementspot.X, (int)placementspot.Y + buffersizey - 2].active(true); Main.tile[(int)placementspot.X + 1, (int)placementspot.Y + buffersizey - 2].active(true); Main.tile[(int)placementspot.X - 2, (int)placementspot.Y + buffersizey - 2].active(true); WorldGen.PlaceTile((int)placementspot.X + 2, (int)placementspot.Y + buffersizey - 2, SGAmod.Instance.TileType("MoistStone"), style: 41); WorldGen.PlaceObject((int)placementspot.X, (int)placementspot.Y + buffersizey - 3, type == 0 ? SGAmod.Instance.TileType("CaliburnAltar") : (type == 1 ? SGAmod.Instance.TileType("CaliburnAltarB") : SGAmod.Instance.TileType("CaliburnAltarC")), false, 0); SGAWorld.CaliburnAlterCoordsX[type] = (int)placementspot.X * 16; SGAWorld.CaliburnAlterCoordsY[type] = (int)placementspot.Y * 16; }