LocalPlayer::accelerateHorizontal: cleanups
[oweals/minetest.git] / src / environment.h
index 4c00ef9e85890c9b83c8d743db02c5ddec3512cf..1b1cfc50a7091ab0ca1243897b71b7da22efdc48 100644 (file)
@@ -42,6 +42,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 class IGameDef;
 class Map;
+struct PointedThing;
+class RaycastState;
 
 class Environment
 {
@@ -49,6 +51,7 @@ public:
        // Environment will delete the map passed to the constructor
        Environment(IGameDef *gamedef);
        virtual ~Environment();
+       DISABLE_CLASS_COPY(Environment);
 
        /*
                Step everything in environment.
@@ -75,6 +78,26 @@ public:
 
        u32 getDayCount();
 
+       /*!
+        * Gets the objects pointed by the shootline as
+        * pointed things.
+        * If this is a client environment, the local player
+        * won't be returned.
+        * @param[in]  shootline_on_map the shootline for
+        * the test in world coordinates
+        *
+        * @param[out] objects          found objects
+        */
+       virtual void getSelectedActiveObjects(const core::line3d<f32> &shootline_on_map,
+                       std::vector<PointedThing> &objects) = 0;
+
+       /*!
+        * Returns the next node or object the shootline meets.
+        * @param state current state of the raycast
+        * @result output, will contain the next pointed thing
+        */
+       void continueRaycast(RaycastState *state, PointedThing *result);
+
        // counter used internally when triggering ABMs
        u32 m_added_objects;
 
@@ -87,15 +110,15 @@ protected:
         * Below: values managed by m_time_lock
        */
        // Time of day in milli-hours (0-23999); determines day and night
-       u32 m_time_of_day;
-       // Time of day in 0...1
-       float m_time_of_day_f;
+       u32 m_time_of_day = 5250;
+       // Time of day in 0...1; start 5:15am unless overridden by game
+       float m_time_of_day_f = 5250.0f / 24000.0f;
        // Stores the skew created by the float -> u32 conversion
        // to be applied at next conversion, so that there is no real skew.
-       float m_time_conversion_skew;
+       float m_time_conversion_skew = 0.0f;
        // Overriding the day-night ratio is useful for custom sky visuals
-       bool m_enable_day_night_ratio_override;
-       u32 m_day_night_ratio_override;
+       bool m_enable_day_night_ratio_override = false;
+       u32 m_day_night_ratio_override = 0.0f;
        // Days from the server start, accounts for time shift
        // in game (e.g. /time or bed usage)
        std::atomic<u32> m_day_count;
@@ -121,8 +144,6 @@ protected:
 
 private:
        std::mutex m_time_lock;
-
-       DISABLE_CLASS_COPY(Environment);
 };
 
 #endif