]> git.lizzy.rs Git - minetest.git/blobdiff - src/serverenvironment.h
Include irrlichttypes.h first to work around Irrlicht#433 (#10872)
[minetest.git] / src / serverenvironment.h
index e106582492c1a2e9d90b17279478d1c60f813837..a11c814ed1e9e3a419b7eb22d3f99fad376cfe6c 100644 (file)
@@ -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<u16, ServerActiveObject *> 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<f32> &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<u16> &objects, const v3f &pos, float radius)
+       void getObjectsInsideRadius(std::vector<ServerActiveObject *> &objects, const v3f &pos, float radius,
+                       std::function<bool(ServerActiveObject *obj)> 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<ServerActiveObject *> &objects, const aabb3f &box,
+                       std::function<bool(ServerActiveObject *obj)> 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
@@ -438,6 +441,8 @@ class ServerEnvironment : public Environment
        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;