MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / LoadBiomeDataFiles

Function LoadBiomeDataFiles

internal/rooms/biomes.go:91–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

89)
90
91func 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
128func GetBiome(name string) (*BiomeInfo, bool) {
129 if name == `` {

Callers 2

loadAllDataFilesFunction · 0.92
ReloadFunction · 0.92

Calls 4

GetFilePathsConfigFunction · 0.92
WarnFunction · 0.92
InfoFunction · 0.92
StringMethod · 0.65

Tested by

no test coverage detected