/// <summary> /// Translates a level, including all tronics (and vectors in tronics) contained within it. /// </summary> /// <param name="SavePath">Path from which the level should be loaded</param> /// <param name="offset">The offset the level should be moved by</param> /// <returns></returns> public static N8Level GetTranslatedLevel(string SavePath, Vector3D offset) { N8Level Level = new N8Level(SavePath); foreach (N8Block b in Level.blocks.Blocks) { //Only blocks which are not attached to something need to be translated //(for the ones that are attached to something, the translation will be handled //by the block they're attached to) if (b.AttachedTo == null) { b.position += offset; } } //In tronics, we also need to translate the vectors in data blocks foreach (N8Tronic t in Level.blocks.Tronics) { if (t.AttachedTo == null) { t.position += offset; } if (t.type == "cdata") { if (t.IsVector()) { Vector3D contents = t.DataToVector(); contents += offset; t.data = contents.ToData(); } } } //And then make sure everything is in bounds { foreach (N8Tronic t in Level.blocks.Tronics) { EnforceBounds(t); } foreach (N8Block b in Level.blocks.Blocks) { EnforceBounds(b); } } Level = MinorModifiers.OrderLoading(Level, new Vector3D(0, 0, -1)); return Level; }