diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2020-04-11 19:59:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-11 19:59:43 +0200 |
commit | 5cc06e4748a82acb36310fee89e72f30b2b35a36 (patch) | |
tree | bf99c5498f491c831c8494c064f2be5502f4bdf0 /src/script/lua_api/l_env.cpp | |
parent | 5146086a64d5eeb480948d612a008a2ec81455d4 (diff) | |
download | minetest-5cc06e4748a82acb36310fee89e72f30b2b35a36.tar.xz |
Reduce ServerEnvironment propagation (#9642)
ServerEnvironment is a huge class with many accessors. In various places it's not needed
Remove it to reduce the ServerEnvironment view.
Idea here is to reduce size of some of our objects to transport lightweight managers and permit easier testing
Pathfinder is now tied to a generic map, not a ServerMap, it can be
ported to client
Diffstat (limited to 'src/script/lua_api/l_env.cpp')
-rw-r--r-- | src/script/lua_api/l_env.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 40e50e64a..e3afe1862 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -577,7 +577,7 @@ int ModApiEnvMod::l_get_node_timer(lua_State *L) // Do it v3s16 p = read_v3s16(L, 1); - NodeTimerRef::create(L, p, env); + NodeTimerRef::create(L, p, &env->getServerMap()); return 1; } @@ -1193,7 +1193,7 @@ int ModApiEnvMod::l_find_path(lua_State *L) algo = PA_DIJKSTRA; } - std::vector<v3s16> path = get_path(env, pos1, pos2, + std::vector<v3s16> path = get_path(&env->getServerMap(), env->getGameDef()->ndef(), pos1, pos2, searchdistance, max_jump, max_drop, algo); if (!path.empty()) { @@ -1257,8 +1257,9 @@ int ModApiEnvMod::l_spawn_tree(lua_State *L) else return 0; + ServerMap *map = &env->getServerMap(); treegen::error e; - if ((e = treegen::spawn_ltree (env, p0, ndef, tree_def)) != treegen::SUCCESS) { + if ((e = treegen::spawn_ltree (map, p0, ndef, tree_def)) != treegen::SUCCESS) { if (e == treegen::UNBALANCED_BRACKETS) { luaL_error(L, "spawn_tree(): closing ']' has no matching opening bracket"); } else { |