internal static void LoadMessages(Level level, string map) { List <Vec3U16> coords = MessageBlock.GetAllCoords(map); level.hasMessageBlocks = coords.Count > 0; if (!level.hasMessageBlocks) { return; } int deleted = 0; foreach (Vec3U16 p in coords) { BlockID block = level.GetBlock(p.X, p.Y, p.Z); if (level.Props[block].IsMessageBlock) { continue; } MessageBlock.Delete(map, p.X, p.Y, p.Z); deleted++; } if (deleted == 0) { return; } Logger.Log(LogType.BackgroundActivity, "Autodeleted {0} non-existent message blocks in {1}", deleted, level.name); }
internal static void LoadMessages(Level level, string map) { level.hasMessageBlocks = Database.TableExists("Messages" + map); if (!level.hasMessageBlocks) { return; } List <Vec3U16> coords = MessageBlock.GetAllCoords(map); foreach (Vec3U16 p in coords) { BlockID block = level.GetBlock(p.X, p.Y, p.Z); if (level.Props[block].IsMessageBlock) { continue; } MessageBlock.Delete(map, p.X, p.Y, p.Z); } }
internal static void LoadMessages(Level level, string map) { List <Vec3U16> coords = MessageBlock.GetAllCoords(map); level.hasMessageBlocks = coords.Count > 0; if (!level.hasMessageBlocks) { return; } foreach (Vec3U16 p in coords) { BlockID block = level.GetBlock(p.X, p.Y, p.Z); if (level.Props[block].IsMessageBlock) { continue; } MessageBlock.Delete(map, p.X, p.Y, p.Z); } }
void MoveMessageBlocks(Player p, int x, int y, int z) { List <Vec3U16> coords = MessageBlock.GetAllCoords(p.level.MapName); int count = 0; foreach (Vec3U16 pos in coords) { string message = MessageBlock.Get(p.level.MapName, pos.X, pos.Y, pos.Z); if (message == null) { continue; } BlockID block = p.level.FastGetBlock(pos.X, pos.Y, pos.Z); int x2 = pos.X + x; int y2 = pos.Y + y; int z2 = pos.Z + z; if (!p.level.IsValidPos(x2, y2, z2)) { p.Message("%cMB at %b" + pos.X + " " + pos.Y + " " + pos.Z + " %cwas outside of the map bounds, deleting."); MessageBlock.Delete(p.level.name, pos.X, pos.Y, pos.Z); p.level.UpdateBlock(p, pos.X, pos.Y, pos.Z, Block.Air); continue; } // Create new MBs MessageBlock.Set(p.level.name, (ushort)x2, (ushort)y2, (ushort)z2, message); p.level.UpdateBlock(p, (ushort)x2, (ushort)y2, (ushort)z2, block); // Delete old MBs MessageBlock.Delete(p.level.name, pos.X, pos.Y, pos.Z); p.level.UpdateBlock(p, pos.X, pos.Y, pos.Z, Block.Air); count++; } p.Message("%SSuccessfully moved %b" + count + " %SMBs."); }