1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Add callback on_mapblocks_changed

This commit is contained in:
Jude Melton-Houghton 2022-09-03 22:05:07 -04:00
parent 7701e70dc9
commit 5c248c2d7d
10 changed files with 141 additions and 6 deletions

View file

@ -21,7 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "activeobject.h"
#include "environment.h"
#include "mapnode.h"
#include "map.h"
#include "settings.h"
#include "server/activeobjectmgr.h"
#include "util/numeric.h"
@ -30,9 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <random>
class IGameDef;
class ServerMap;
struct GameParams;
class MapBlock;
class RemotePlayer;
class PlayerDatabase;
class AuthDatabase;
@ -193,6 +191,16 @@ public:
std::set<v3s16> m_forceloaded_list;
};
/*
ServerEnvironment::m_on_mapblocks_changed_receiver
*/
struct OnMapblocksChangedReceiver : public MapEventReceiver {
std::unordered_set<v3s16> modified_blocks;
bool receiving = false;
void onMapEditEvent(const MapEditEvent &event) override;
};
/*
Operation mode for ServerEnvironment::clearObjects()
*/
@ -455,6 +463,8 @@ private:
Server *m_server;
// Active Object Manager
server::ActiveObjectMgr m_ao_manager;
// on_mapblocks_changed map event receiver
OnMapblocksChangedReceiver m_on_mapblocks_changed_receiver;
// World path
const std::string m_path_world;
// Outgoing network message buffer for active objects