mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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
This commit is contained in:
parent
5146086a64
commit
5cc06e4748
7 changed files with 71 additions and 118 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue