Closed Veyrdite closed 1 year ago
Commenting out the comparison got me out of the constant crashes, allowing me to continue playing:
df_caverns.register_biome_check(function(pos, heat, humidity)
if pos.y < df_caverns.config.level3_min or pos.y >= df_caverns.config.level2_min then
return nil
end
local biome = get_biome(heat, humidity)
--[[
if biome == "bloodnether" then
if subterrane.get_cavern_value("cavern layer 3", pos) < 0 then
return "nethercap"
end
return "bloodthorn"
end
]]--
return biome
end)
Odd. That should be impossible, get_cavern_value only returns nil when it's being called for a pos that's outside of the elevation range that the cavern is defined for and the initial pos.y check at the beginning of register_biome_check should be guarding against this.
It shouldn't have anything to do with other biomes, dfcaverns isn't actually using the built-in biome system.
The commenting-out that you did will cause nethercap and bloodthorn caverns to no longer spawn. A better approach would be to turn the line
if subterrane.get_cavern_value("cavern layer 3", pos) < 0 then
into
if (subterrane.get_cavern_value("cavern layer 3", pos) or 0) < 0 then
That'll make the comparison safe against nil returns.
I'll tinker around a bit on the weekend to see if I can figure out why this "impossible" result happened. Have you changed the boundary elevations of the various cavern layers to something other than the defaults, perhaps?
I figured it out. The ambient sound mod was checking for the biome that the player's current position was in, and it was sending raw un-rounded position vectors into the method - something that never happened before the ambient sound mod was added recently. So if the player happened to be in the one-node-wide boundary between layers 2 and 3 in a bloodthorn/nethercap biome this crash could occur. I've added two fixes, one of them a nil check in the layer 3 biome function and the other a vector.round operation to "sanitize" the position being checked.
I'll make a release later today. I'm going to take this opportunity to add some documentation to the next release, if you want the fix now you can grab it from the repository.
I know this is closed, and will update to the patched version here in a moment, but just verifying this report, as I've been seeing it too.
2022-11-05 16:25:40: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'df_ambience' in callback environment_Step(): ...mes/MeseCraft/mods/WORLD/dfcaverns/df_caverns/level3.lua:50: attempt to compare nil with number 2022-11-05 16:25:40: ERROR[Main]: stack traceback: 2022-11-05 16:25:40: ERROR[Main]: ...mes/MeseCraft/mods/WORLD/dfcaverns/df_caverns/level3.lua:50: in function 'val' 2022-11-05 16:25:40: ERROR[Main]: ...mes/MeseCraft/mods/WORLD/dfcaverns/df_caverns/shared.lua:34: in function 'get_biome' 2022-11-05 16:25:40: ERROR[Main]: ...ames/MeseCraft/mods/WORLD/dfcaverns/df_ambience/init.lua:57: in function 'get_player_data' 2022-11-05 16:25:40: ERROR[Main]: ...ames/MeseCraft/mods/WORLD/dfcaverns/df_ambience/init.lua:81: in function 'get_ambience' 2022-11-05 16:25:40: ERROR[Main]: ...ames/MeseCraft/mods/WORLD/dfcaverns/df_ambience/init.lua:105: in function <...ames/MeseCraft/mods/WORLD/dfcaverns/df_ambience/init.lua:91> 2022-11-05 16:25:40: ERROR[Main]: ...-server-stable/minetest/bin/../builtin/game/register.lua:429: in function <...-server-stable/minetest/bin/../builtin/game/register.lua:415>
dfcaverns release = 13917 (latest from contentdb) minetest 5.6.1-_1
I'm deep underground and the game is constantly crashing.
Maybe caused by invalid biomes as I uninstalled a biome related mod today?