public static bool LoadFiles(List <YamlIO.Error> errors) { if (worlds.worldCache.Count > 0) { return(false); } worlds.LoadFiles(GetPath(), errors); List <FileHandle> list = new List <FileHandle>(); FileSystem.GetFiles(FileSystem.Normalize(System.IO.Path.Combine(path, "traits")), "*.yaml", list); foreach (FileHandle item in list) { FileHandle trait_file = item; WorldTrait worldTrait = YamlIO.LoadFile <WorldTrait>(trait_file.full_path, delegate(YamlIO.Error error, bool force_log_as_warning) { error.file = trait_file; errors.Add(error); }, null); int num = FirstUncommonCharacter(path, trait_file.full_path); string text = (num <= -1) ? trait_file.full_path : trait_file.full_path.Substring(num); text = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(text), System.IO.Path.GetFileNameWithoutExtension(text)); if (worldTrait == null) { DebugUtil.LogWarningArgs("Failed to load trait: ", text); } else { traits[text] = worldTrait; } } foreach (KeyValuePair <string, World> item2 in worlds.worldCache) { LoadFeatures(item2.Value.globalFeatures, errors); LoadSubworlds(item2.Value.subworldFiles, errors); } foreach (KeyValuePair <string, WorldTrait> trait in traits) { LoadFeatures(trait.Value.globalFeatureMods, errors); LoadSubworlds(trait.Value.additionalSubworldFiles, errors); } layers = MergeLoad <LevelLayerSettings>(GetPath() + "layers.yaml", errors); layers.LevelLayers.ConvertBandSizeToMaxSize(); rivers = MergeLoad <ComposableDictionary <string, River> >(GetPath() + "rivers.yaml", errors); rooms = MergeLoad <ComposableDictionary <string, Room> >(path + "rooms.yaml", errors); foreach (KeyValuePair <string, Room> room in rooms) { room.Value.name = room.Key; } temperatures = MergeLoad <ComposableDictionary <Temperature.Range, Temperature> >(GetPath() + "temperatures.yaml", errors); borders = MergeLoad <ComposableDictionary <string, List <WeightedSimHash> > >(GetPath() + "borders.yaml", errors); defaults = YamlIO.LoadFile <DefaultSettings>(GetPath() + "defaults.yaml", null, null); mobs = MergeLoad <MobSettings>(GetPath() + "mobs.yaml", errors); foreach (KeyValuePair <string, Mob> item3 in mobs.MobLookupTable) { item3.Value.name = item3.Key; } DebugUtil.LogArgs("World settings reload complete!"); return(true); }
public static void Clear() { worlds.worldCache.Clear(); layers = null; biomes.BiomeBackgroundElementBandConfigurations.Clear(); biomeSettingsCache.Clear(); rivers = null; rooms = null; temperatures = null; borders = null; noise.Clear(); defaults = null; mobs = null; featuresettings.Clear(); traits.Clear(); subworlds.Clear(); DebugUtil.LogArgs("World Settings cleared!"); }