-private:
-};
-
-class IBackgroundBlockEmerger
-{
-public:
- virtual void queueBlockEmerge(v3s16 blockpos, bool allow_generate)=0;
-};
-
-/*
- The server-side environment.
-
- This is not thread-safe. Server uses an environment mutex.
-*/
-
-class ServerEnvironment : public Environment
-{
-public:
- ServerEnvironment(ServerMap *map, lua_State *L, IGameDef *gamedef,
- IBackgroundBlockEmerger *emerger);
- ~ServerEnvironment();
-
- Map & getMap()
- { return *m_map; }
-
- ServerMap & getServerMap()
- { return *m_map; }
-
- lua_State* getLua()
- { return m_lua; }
-
- IGameDef *getGameDef()
- { return m_gamedef; }
-
- float getSendRecommendedInterval()
- {
- return 0.10;
- }
-
- /*
- Save players
- */
- void serializePlayers(const std::string &savedir);
- void deSerializePlayers(const std::string &savedir);
-
- /*
- Save and load time of day and game timer
- */
- void saveMeta(const std::string &savedir);
- void loadMeta(const std::string &savedir);
-
- /*
- External ActiveObject interface
- -------------------------------------------
- */
-
- ServerActiveObject* getActiveObject(u16 id);
-
- /*
- Add an active object to the environment.
- Environment handles deletion of object.
- Object may be deleted by environment immediately.
- If id of object is 0, assigns a free id to it.
- Returns the id of the object.
- Returns 0 if not added and thus deleted.
- */
- u16 addActiveObject(ServerActiveObject *object);
-
- /*
- Add an active object as a static object to the corresponding
- MapBlock.
- Caller allocates memory, ServerEnvironment frees memory.
- Return value: true if succeeded, false if failed.
- */
- bool addActiveObjectAsStatic(ServerActiveObject *object);
-
- /*
- Find out what new objects have been added to
- inside a radius around a position
- */
- void getAddedActiveObjects(v3s16 pos, s16 radius,
- core::map<u16, bool> ¤t_objects,
- core::map<u16, bool> &added_objects);
-
- /*
- Find out what new objects have been removed from
- inside a radius around a position
- */
- void getRemovedActiveObjects(v3s16 pos, s16 radius,
- core::map<u16, bool> ¤t_objects,
- core::map<u16, bool> &removed_objects);
-
- /*
- Get the next message emitted by some active object.
- Returns a message with id=0 if no messages are available.
- */
- ActiveObjectMessage getActiveObjectMessage();
-
- /*
- Activate objects and dynamically modify for the dtime determined
- from timestamp and additional_dtime
- */
- void activateBlock(MapBlock *block, u32 additional_dtime=0);