51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef ENVIRONMENT_HEADER
-#define ENVIRONMENT_HEADER
+#pragma once
/*
This class is the game's environment.
#include <atomic>
#include <mutex>
#include "irr_v3d.h"
-#include "activeobject.h"
-#include "util/numeric.h"
#include "network/networkprotocol.h" // for AccessDeniedCode
+#include "util/basic_macros.h"
class IGameDef;
class Map;
public:
// Environment will delete the map passed to the constructor
Environment(IGameDef *gamedef);
- virtual ~Environment();
+ virtual ~Environment() = default;
DISABLE_CLASS_COPY(Environment);
/*
u32 getDayCount();
+ /*!
+ * Returns false if the given line intersects with a
+ * non-air node, true otherwise.
+ * \param pos1 start of the line
+ * \param pos2 end of the line
+ * \param p output, position of the first non-air node
+ * the line intersects
+ */
+ bool line_of_sight(v3f pos1, v3f pos2, v3s16 *p = nullptr);
+
/*!
* Gets the objects pointed by the shootline as
* pointed things.
/*
* Below: values managed by m_time_lock
- */
- // Time of day in milli-hours (0-23999); determines day and night
- 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;
+ */
+ // 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;
// 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 = 0.0f;
std::atomic<u32> m_day_count;
/*
* Above: values managed by m_time_lock
- */
+ */
/* TODO: Add a callback function so these can be updated when a setting
* changes. At this point in time it doesn't matter (e.g. /set
float m_cache_active_block_mgmt_interval;
float m_cache_abm_interval;
float m_cache_nodetimer_interval;
+ float m_cache_abm_time_budget;
IGameDef *m_gamedef;
private:
std::mutex m_time_lock;
};
-
-#endif