mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-22 17:18:39 +00:00
Add core.get_mapgen_chunksize() (#16289)
This commit is contained in:
parent
fcbf05fc30
commit
fd0ca20ce9
4 changed files with 30 additions and 3 deletions
|
@ -865,7 +865,7 @@ int ModApiMapgen::l_get_mapgen_edges(lua_State *L)
|
|||
} else {
|
||||
std::string chunksize_str;
|
||||
settingsmgr->getMapSetting("chunksize", &chunksize_str);
|
||||
chunksize = stoi(chunksize_str, -32768, 32767);
|
||||
chunksize = stoi(chunksize_str, 1, 10);
|
||||
}
|
||||
|
||||
std::pair<s16, s16> edges = get_mapgen_edges(mapgen_limit, chunksize);
|
||||
|
@ -874,6 +874,25 @@ int ModApiMapgen::l_get_mapgen_edges(lua_State *L)
|
|||
return 2;
|
||||
}
|
||||
|
||||
// get_mapgen_chunksize()
|
||||
int ModApiMapgen::l_get_mapgen_chunksize(lua_State *L)
|
||||
{
|
||||
NO_MAP_LOCK_REQUIRED;
|
||||
|
||||
const MapSettingsManager *settingsmgr = getEmergeManager(L)->map_settings_mgr;
|
||||
|
||||
// MapSettingsManager::makeMapgenParams cannot be used here because it would
|
||||
// make mapgen settings immutable from then on. Mapgen settings should stay
|
||||
// mutable until after mod loading ends.
|
||||
|
||||
std::string chunksize_str;
|
||||
settingsmgr->getMapSetting("chunksize", &chunksize_str);
|
||||
s16 chunksize = stoi(chunksize_str, 1, 10);
|
||||
|
||||
push_v3s16(L, {chunksize, chunksize, chunksize});
|
||||
return 1;
|
||||
}
|
||||
|
||||
// get_mapgen_setting(name)
|
||||
int ModApiMapgen::l_get_mapgen_setting(lua_State *L)
|
||||
{
|
||||
|
@ -2025,6 +2044,7 @@ void ModApiMapgen::Initialize(lua_State *L, int top)
|
|||
API_FCT(get_mapgen_params);
|
||||
API_FCT(set_mapgen_params);
|
||||
API_FCT(get_mapgen_edges);
|
||||
API_FCT(get_mapgen_chunksize);
|
||||
API_FCT(get_mapgen_setting);
|
||||
API_FCT(set_mapgen_setting);
|
||||
API_FCT(get_mapgen_setting_noiseparams);
|
||||
|
@ -2067,6 +2087,7 @@ void ModApiMapgen::InitializeEmerge(lua_State *L, int top)
|
|||
API_FCT(get_seed);
|
||||
API_FCT(get_mapgen_params);
|
||||
API_FCT(get_mapgen_edges);
|
||||
API_FCT(get_mapgen_chunksize);
|
||||
API_FCT(get_mapgen_setting);
|
||||
API_FCT(get_mapgen_setting_noiseparams);
|
||||
API_FCT(get_noiseparams);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue