summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2014-12-14 18:46:19 -0500
committerkwolekr <kwolekr@minetest.net>2014-12-14 18:46:46 -0500
commit8fe1d3fc2e4564fd30658c7008ef7a0e6161e2d3 (patch)
tree607cad11544dde9bb2094da2976bb3fc508efdf9 /src/script
parentdf0ca45ee2d8750f362bd062ee9e6cb39e63f0b4 (diff)
downloadminetest-8fe1d3fc2e4564fd30658c7008ef7a0e6161e2d3.tar.gz
minetest-8fe1d3fc2e4564fd30658c7008ef7a0e6161e2d3.tar.bz2
minetest-8fe1d3fc2e4564fd30658c7008ef7a0e6161e2d3.zip
Expose mapgen chunksize in on_mapgen_init callbacks
Diffstat (limited to 'src/script')
-rw-r--r--src/script/cpp_api/s_env.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/script/cpp_api/s_env.cpp b/src/script/cpp_api/s_env.cpp
index 2fe7d8074..916c562fb 100644
--- a/src/script/cpp_api/s_env.cpp
+++ b/src/script/cpp_api/s_env.cpp
@@ -61,7 +61,7 @@ void ScriptApiEnv::environment_Step(float dtime)
void ScriptApiEnv::player_event(ServerActiveObject* player, std::string type)
{
SCRIPTAPI_PRECHECKHEADER
-
+
if (player == NULL)
return;
@@ -82,28 +82,31 @@ void ScriptApiEnv::player_event(ServerActiveObject* player, std::string type)
void ScriptApiEnv::environment_OnMapgenInit(MapgenParams *mgparams)
{
SCRIPTAPI_PRECHECKHEADER
-
+
// Get core.registered_on_mapgen_inits
lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_mapgen_inits");
// Call callbacks
lua_newtable(L);
-
+
lua_pushstring(L, mgparams->mg_name.c_str());
lua_setfield(L, -2, "mgname");
-
+
lua_pushinteger(L, mgparams->seed);
lua_setfield(L, -2, "seed");
-
+
lua_pushinteger(L, mgparams->water_level);
lua_setfield(L, -2, "water_level");
-
+
+ lua_pushinteger(L, mgparams->chunksize);
+ lua_setfield(L, -2, "chunksize");
+
std::string flagstr = writeFlagString(mgparams->flags,
flagdesc_mapgen, (u32)-1);
lua_pushstring(L, flagstr.c_str());
lua_setfield(L, -2, "flags");
-
+
script_run_callbacks(L, 1, RUN_CALLBACKS_MODE_FIRST);
}