+ // Time of day in 0...1
+ float m_time_of_day_f;
+ float m_time_of_day_speed;
+ // Used to buffer dtime for adding to m_time_of_day
+ float m_time_counter;
+ // Overriding the day-night ratio is useful for custom sky visuals
+ bool m_enable_day_night_ratio_override;
+ u32 m_day_night_ratio_override;
+
+private:
+ JMutex m_lock;
+
+};
+
+/*
+ Active block modifier interface.
+
+ These are fed into ServerEnvironment at initialization time;
+ ServerEnvironment handles deleting them.
+*/
+
+class ActiveBlockModifier
+{
+public:
+ ActiveBlockModifier(){};
+ virtual ~ActiveBlockModifier(){};
+
+ // Set of contents to trigger on
+ virtual std::set<std::string> getTriggerContents()=0;
+ // Set of required neighbors (trigger doesn't happen if none are found)
+ // Empty = do not check neighbors
+ virtual std::set<std::string> getRequiredNeighbors()
+ { return std::set<std::string>(); }
+ // Trigger interval in seconds
+ virtual float getTriggerInterval() = 0;
+ // Random chance of (1 / return value), 0 is disallowed
+ virtual u32 getTriggerChance() = 0;
+ // This is called usually at interval for 1/chance of the nodes
+ virtual void trigger(ServerEnvironment *env, v3s16 p, MapNode n){};
+ virtual void trigger(ServerEnvironment *env, v3s16 p, MapNode n,
+ u32 active_object_count, u32 active_object_count_wider){};
+};
+
+struct ABMWithState
+{
+ ActiveBlockModifier *abm;
+ float timer;
+
+ ABMWithState(ActiveBlockModifier *abm_);