Commit 09d4607
authored
Move biome definitions to YAML configuration with hot reload support (#404)
* Biomes can now be defined in the world configuration and loaded dynamically
- Enabling biome definitions outsite of code
- Biomes reload in the same way as items
* Added hot reload to biomes
"reload biomes" will now hot reload changes, like on items.
* Fixed review comments and minor other improvements
1. YAML tags changed to lowercase
- Changed yaml:"darkArea" to yaml:"darkarea"
- Changed yaml:"litArea" to yaml:"litarea"
- Changed yaml:"requiredItemId" to yaml:"requireditemid"
- Changed yaml:"usesItem" to yaml:"usesitem"
- All YAML tags now follow the lowercase convention as requested
2. Implemented Loadable interface methods
- Added Id() method that returns the biome ID as a string
- Added Validate() method with proper validation logic
- Added Filepath() method that returns the individual file path
- BiomeInfo now satisfies the Loadable[string] interface
3. Refactored to use fileloader.LoadAllFlatFiles pattern
- Converted from single biomes.yaml file to individual biome files
(e.g., city.yaml, forest.yaml)
- Changed loading mechanism to use fileloader.LoadAllFlatFiles[string,
*BiomeInfo]()
- Created individual biome files in _datafiles/world/default/biomes/
directory
I looked at races/mobs/items and tried to follow the same pattern.
Additional fixes and changes:
- Updated all references to BiomeInfo fields to use the new exported
fields
- Fixed method calls from Symbol() to GetSymbol() and Name() to Name
field access
- Fixed the return type of GetBiome() to return *BiomeInfo instead of
BiomeInfo
Also had to fix an unreachable code issue in mutators.go (This was a
compiler error due to unreachable code after line 49 because of a
'return false') This may be intentional, but the compiler will not make
the binary without this change.
* Added two missing hard coded biomes
Added missing hard coded biomes as regular biome files:
- Land
- Dungeon
Also added them back as hard coded fallbacks in biomes.go
* Fixed a slight duplication issue with the Dungeon biome
* Simplified biome system and removed ValidateBiomes function
- Removed all hardcoded biomes from biomes.go
- Replaced with single default fallback biome when no files are loaded
- Removed ValidateBiomes() function and its call from main.go
- Changed GetAllBiomes() to return []BiomeInfo instead of []*BiomeInfo
to prevent accidental modifications
- Reverted mutators.go changes that were accidentally included in this
branch
* Cleaned up old single biomes.yaml in /default and added all the individual biomes to /empty
* Fixed biome-related nil pointer panics and improved error handling
- Added defensive nil checks in mapper.go before calling biome methods
- Ensured default biome always exists after LoadBiomeDataFiles() is
called
- Added warning log when a requested biome is not found, showing biome
name, room ID, and zone
- Improved biome fallback logic to prevent nil pointer dereferences
- Added mudlog import to rooms.go for biome warning messages
* Added startup biome validation and improved missing biome handling
- Added validateRoomBiomes() function in mapper that checks all rooms
during PreCacheMaps()
- Logs warnings at startup for rooms without biomes (when zone also
has no default)
- Logs warnings for rooms referencing non-existent biomes
- Provides summary count of missing and invalid biome references
* Removed empty line in main.go1 parent f60710d commit 09d4607
File tree
42 files changed
+475
-152
lines changed- _datafiles/world
- default/biomes
- empty/biomes
- internal
- mapper
- rooms
- usercommands
- web
- modules/gmcp
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
42 files changed
+475
-152
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments