1
0
Fork 0
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:
Loïc Blot 2020-04-11 19:59:43 +02:00 committed by GitHub
parent 5146086a64
commit 5cc06e4748
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 71 additions and 118 deletions

View file

@ -22,13 +22,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irr_v3d.h"
#include "lua_api/l_base.h"
class ServerEnvironment;
class ServerMap;
class NodeTimerRef : public ModApiBase
{
private:
v3s16 m_p;
ServerEnvironment *m_env = nullptr;
ServerMap *m_map;
static const char className[];
static const luaL_Reg methods[];
@ -50,14 +50,12 @@ private:
static int l_get_elapsed(lua_State *L);
public:
NodeTimerRef(v3s16 p, ServerEnvironment *env);
NodeTimerRef(v3s16 p, ServerMap *map) : m_p(p), m_map(map) {}
~NodeTimerRef() = default;
// Creates an NodeTimerRef and leaves it on top of stack
// Not callable from Lua; all references are created on the C side.
static void create(lua_State *L, v3s16 p, ServerEnvironment *env);
static void set_null(lua_State *L);
static void create(lua_State *L, v3s16 p, ServerMap *map);
static void Register(lua_State *L);
};