public void UnregisterObjects(Files.Formats.IFF.IffFile file) { var objRegistry = Content.Get().WorldObjects; var defs = file.List <OBJD>(); if (defs != null) { foreach (var def in defs) { objRegistry.RemoveObject(def.GUID); } } }
/// <summary> /// Intializes a specific neighbourhood. Also counts as a save discard, since it unloads the current neighbourhood. /// </summary> /// <param name="id"></param> public void InitSpecific(int id) { DirtyAvatars.Clear(); ZoningDictionary.Clear(); FamilyForHouse.Clear(); var udName = "UserData" + ((id == 0) ? "" : (id + 1).ToString()); //simitone shouldn't modify existing ts1 data, since our house saves are incompatible. //therefore we should copy to the simitone user data. var userPath = FSOEnvironment.ContentDir; UserPath = userPath; MainResource = new Files.Formats.IFF.IffFile(Path.Combine(UserPath, "Neighborhood.iff")); Neighbors = MainResource.List <NBRS>().FirstOrDefault(); Neighborhood = MainResource.List <NGBH>().FirstOrDefault(); //todo: manage avatar iffs here }
public GameObjectResource(Files.Formats.IFF.IffFile iff, Files.Formats.IFF.IffFile sprites, OTFFile tuning, string iname) { this.Iff = iff; this.Sprites = sprites; this.Tuning = tuning; this.Name = iname; if (iff == null) { return; } var GLOBChunks = iff.List <GLOB>(); if (GLOBChunks != null && GLOBChunks[0].Name != "") { var sg = FSO.Content.Content.Get().WorldObjectGlobals.Get(GLOBChunks[0].Name); if (sg != null) { SemiGlobal = sg.Resource; //used for tuning constant fetching. } } TreeByName = new Dictionary <string, VMTreeByNameTableEntry>(); var bhavs = List <BHAV>(); if (bhavs != null) { foreach (var bhav in bhavs) { string name = bhav.ChunkLabel; for (var i = 0; i < name.Length; i++) { if (name[i] == 0) { name = name.Substring(0, i); break; } } if (!TreeByName.ContainsKey(name)) { TreeByName.Add(name, new VMTreeByNameTableEntry(bhav)); } } } //also add semiglobals if (SemiGlobal != null) { bhavs = SemiGlobal.List <BHAV>(); if (bhavs != null) { foreach (var bhav in bhavs) { string name = bhav.ChunkLabel; for (var i = 0; i < name.Length; i++) { if (name[i] == 0) { name = name.Substring(0, i); break; } } if (!TreeByName.ContainsKey(name)) { TreeByName.Add(name, new VMTreeByNameTableEntry(bhav)); } } } } }