()
| 89 | ) |
| 90 | |
| 91 | func LoadBiomeDataFiles() { |
| 92 | |
| 93 | start := time.Now() |
| 94 | |
| 95 | tmpBiomes, err := fileloader.LoadAllFlatFiles[string, *BiomeInfo](configs.GetFilePathsConfig().DataFiles.String() + `/biomes`) |
| 96 | if err != nil { |
| 97 | panic(err) |
| 98 | } |
| 99 | |
| 100 | biomes = tmpBiomes |
| 101 | |
| 102 | if len(biomes) == 0 { |
| 103 | mudlog.Warn("No biomes loaded from files, using default fallback biome") |
| 104 | // Create a single default fallback biome |
| 105 | biomes[`default`] = &BiomeInfo{ |
| 106 | BiomeId: `default`, |
| 107 | Name: `Default`, |
| 108 | Symbol: `•`, |
| 109 | LitArea: true, |
| 110 | Description: `A default biome used when no other biome is specified.`, |
| 111 | } |
| 112 | } else { |
| 113 | // Always ensure a default biome exists as fallback |
| 114 | if _, ok := biomes[`default`]; !ok { |
| 115 | biomes[`default`] = &BiomeInfo{ |
| 116 | BiomeId: `default`, |
| 117 | Name: `Default`, |
| 118 | Symbol: `•`, |
| 119 | LitArea: true, |
| 120 | Description: `A default biome used when no other biome is specified.`, |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | mudlog.Info("biomes.LoadBiomeDataFiles()", "loadedCount", len(biomes), "Time Taken", time.Since(start)) |
| 126 | } |
| 127 | |
| 128 | func GetBiome(name string) (*BiomeInfo, bool) { |
| 129 | if name == `` { |
no test coverage detected