X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fserverenvironment.h;h=a11c814ed1e9e3a419b7eb22d3f99fad376cfe6c;hb=ed0882fd58fb0f663cc115d23a11643874facc06;hp=55ecbd05f004d41d9f8970724d57d83387d5ee96;hpb=5c588f89e79e02cba392abe3d00688772321f88b;p=minetest.git diff --git a/src/serverenvironment.h b/src/serverenvironment.h index 55ecbd05f..a11c814ed 100644 --- a/src/serverenvironment.h +++ b/src/serverenvironment.h @@ -190,14 +190,6 @@ enum ClearObjectsMode { CLEAR_OBJECTS_MODE_QUICK, }; -/* - The server-side environment. - - This is not thread-safe. Server uses an environment mutex. -*/ - -typedef std::unordered_map ServerActiveObjectMap; - class ServerEnvironment : public Environment { public: @@ -289,9 +281,9 @@ class ServerEnvironment : public Environment /* Get the next message emitted by some active object. - Returns a message with id=0 if no messages are available. + Returns false if no messages are available, true otherwise. */ - ActiveObjectMessage getActiveObjectMessage(); + bool getActiveObjectMessage(ActiveObjectMessage *dest); virtual void getSelectedActiveObjects( const core::line3d &shootline_on_map, @@ -322,10 +314,21 @@ class ServerEnvironment : public Environment bool removeNode(v3s16 p); bool swapNode(v3s16 p, const MapNode &n); + // Find the daylight value at pos with a Depth First Search + u8 findSunlight(v3s16 pos) const; + // Find all active objects inside a radius around a point - void getObjectsInsideRadius(std::vector &objects, const v3f &pos, float radius) + void getObjectsInsideRadius(std::vector &objects, const v3f &pos, float radius, + std::function include_obj_cb) + { + return m_ao_manager.getObjectsInsideRadius(pos, radius, objects, include_obj_cb); + } + + // Find all active objects inside a box + void getObjectsInArea(std::vector &objects, const aabb3f &box, + std::function include_obj_cb) { - return m_ao_manager.getObjectsInsideRadius(pos, radius, objects); + return m_ao_manager.getObjectsInArea(box, objects, include_obj_cb); } // Clear objects, loading and going through every MapBlock @@ -435,10 +438,11 @@ class ServerEnvironment : public Environment IntervalLimiter m_object_management_interval; // List of active blocks ActiveBlockList m_active_blocks; - IntervalLimiter m_database_check_interval; IntervalLimiter m_active_blocks_management_interval; IntervalLimiter m_active_block_modifier_interval; IntervalLimiter m_active_blocks_nodemetadata_interval; + // Whether the variables below have been read from file yet + bool m_meta_loaded = false; // Time from the beginning of the game in seconds. // Incremented in step(). u32 m_game_time = 0;