Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
serverenvironment.h
Go to the documentation of this file.
1/*
2Minetest
3Copyright (C) 2010-2017 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5This program is free software; you can redistribute it and/or modify
6it under the terms of the GNU Lesser General Public License as published by
7the Free Software Foundation; either version 2.1 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU Lesser General Public License for more details.
14
15You should have received a copy of the GNU Lesser General Public License along
16with this program; if not, write to the Free Software Foundation, Inc.,
1751 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18*/
19
20#pragma once
21
22#include <set>
23#include <utility>
24
25#include "activeobject.h"
26#include "environment.h"
27#include "servermap.h"
28#include "settings.h"
30#include "util/numeric.h"
31#include "util/metricsbackend.h"
32
33class IGameDef;
34struct GameParams;
35class RemotePlayer;
36class PlayerDatabase;
37class AuthDatabase;
38class PlayerSAO;
41struct StaticObject;
43class Server;
44class ServerScripting;
45enum AccessDeniedCode : u8;
46typedef u16 session_t;
47
48/*
49 {Active, Loading} block modifier interface.
50
51 These are fed into ServerEnvironment at initialization time;
52 ServerEnvironment handles deleting them.
53*/
54
56{
57public:
59 virtual ~ActiveBlockModifier() = default;
60
61 // Set of contents to trigger on
62 virtual const std::vector<std::string> &getTriggerContents() const = 0;
63 // Set of required neighbors (trigger doesn't happen if none are found)
64 // Empty = do not check neighbors
65 virtual const std::vector<std::string> &getRequiredNeighbors() const = 0;
66 // Trigger interval in seconds
67 virtual float getTriggerInterval() = 0;
68 // Random chance of (1 / return value), 0 is disallowed
69 virtual u32 getTriggerChance() = 0;
70 // Whether to modify chance to simulate time lost by an unnattended block
71 virtual bool getSimpleCatchUp() = 0;
72 // get min Y for apply abm
73 virtual s16 getMinY() = 0;
74 // get max Y for apply abm
75 virtual s16 getMaxY() = 0;
76 // This is called usually at interval for 1/chance of the nodes
77 virtual void trigger(ServerEnvironment *env, v3s16 p, MapNode n){};
78 virtual void trigger(ServerEnvironment *env, v3s16 p, MapNode n,
79 u32 active_object_count, u32 active_object_count_wider){};
80};
81
83{
85 float timer = 0.0f;
86
88};
89
91{
92 // Set of contents to trigger on
93 std::set<std::string> trigger_contents;
94 std::string name;
95 bool run_at_every_load = false;
96
97 virtual ~LoadingBlockModifierDef() = default;
98
99 virtual void trigger(ServerEnvironment *env, v3s16 p,
100 MapNode n, float dtime_s) {};
101};
102
104{
105 typedef std::unordered_map<content_t, std::vector<LoadingBlockModifierDef *>> lbm_map;
107
108 std::vector<LoadingBlockModifierDef *> lbm_list;
109
110 // Needs to be separate method (not inside destructor),
111 // because the LBMContentMapping may be copied and destructed
112 // many times during operation in the lbm_lookup_map.
113 void deleteContents();
114 void addLBM(LoadingBlockModifierDef *lbm_def, IGameDef *gamedef);
115 const lbm_map::mapped_type *lookup(content_t c) const;
116};
117
119{
120public:
121 LBMManager() = default;
122 ~LBMManager();
123
124 // Don't call this after loadIntroductionTimes() ran.
125 void addLBMDef(LoadingBlockModifierDef *lbm_def);
126
127 void loadIntroductionTimes(const std::string &times,
128 IGameDef *gamedef, u32 now);
129
130 // Don't call this before loadIntroductionTimes() ran.
131 std::string createIntroductionTimesString();
132
133 // Don't call this before loadIntroductionTimes() ran.
134 void applyLBMs(ServerEnvironment *env, MapBlock *block,
135 u32 stamp, float dtime_s);
136
137 // Warning: do not make this std::unordered_map, order is relevant here
138 typedef std::map<u32, LBMContentMapping> lbm_lookup_map;
139
140private:
141 // Once we set this to true, we can only query,
142 // not modify
143 bool m_query_mode = false;
144
145 // For m_query_mode == false:
146 // The key of the map is the LBM def's name.
147 std::unordered_map<std::string, LoadingBlockModifierDef *> m_lbm_defs;
148
149 // For m_query_mode == true:
150 // The key of the map is the LBM def's first introduction time.
152
153 // Returns an iterator to the LBMs that were introduced
154 // after the given time. This is guaranteed to return
155 // valid values for everything
156 lbm_lookup_map::const_iterator getLBMsIntroducedAfter(u32 time)
157 { return m_lbm_lookup.lower_bound(time); }
158};
159
160/*
161 List of active blocks, used by ServerEnvironment
162*/
163
165{
166public:
167 void update(std::vector<PlayerSAO*> &active_players,
168 s16 active_block_range,
169 s16 active_object_range,
170 std::set<v3s16> &blocks_removed,
171 std::set<v3s16> &blocks_added,
172 std::set<v3s16> &extra_blocks_added);
173
174 bool contains(v3s16 p) const {
175 return (m_list.find(p) != m_list.end());
176 }
177
178 auto size() const {
179 return m_list.size();
180 }
181
182 void clear() {
183 m_list.clear();
184 }
185
186 void remove(v3s16 p) {
187 m_list.erase(p);
188 m_abm_list.erase(p);
189 }
190
191 std::set<v3s16> m_list;
192 std::set<v3s16> m_abm_list;
193 // list of blocks that are always active, not modified by this class
194 std::set<v3s16> m_forceloaded_list;
195};
196
197/*
198 ServerEnvironment::m_on_mapblocks_changed_receiver
199*/
201 std::unordered_set<v3s16> modified_blocks;
202 bool receiving = false;
203
204 void onMapEditEvent(const MapEditEvent &event) override;
205};
206
207/*
208 Operation mode for ServerEnvironment::clearObjects()
209*/
211 // Load and go through every mapblock, clearing objects
213
214 // Clear objects immediately in loaded mapblocks;
215 // clear objects in unloaded mapblocks only when the mapblocks are next activated.
217};
218
219class ServerEnvironment final : public Environment
220{
221public:
222 ServerEnvironment(std::unique_ptr<ServerMap> map, Server *server, MetricsBackend *mb);
224
225 void init();
226
227 Map & getMap();
228
230
231 //TODO find way to remove this fct!
233 { return m_script; }
234
236 { return m_server; }
237
240
241 // Save players
242 void saveLoadedPlayers(bool force = false);
243 void savePlayer(RemotePlayer *player);
244 PlayerSAO *loadPlayer(RemotePlayer *player, bool *new_player, session_t peer_id,
245 bool is_singleplayer);
246 void addPlayer(RemotePlayer *player);
247 void removePlayer(RemotePlayer *player);
248 bool removePlayerFromDatabase(const std::string &name);
249
250 /*
251 Save and load time of day and game timer
252 */
253 void saveMeta();
254 void loadMeta();
255
256 u32 addParticleSpawner(float exptime);
257 u32 addParticleSpawner(float exptime, u16 attached_id);
258 void deleteParticleSpawner(u32 id, bool remove_from_object = true);
259
260 /*
261 External ActiveObject interface
262 -------------------------------------------
263 */
264
266 {
267 return m_ao_manager.getActiveObject(id);
268 }
269
270 /*
271 Add an active object to the environment.
272 Environment handles deletion of object.
273 Object may be deleted by environment immediately.
274 If id of object is 0, assigns a free id to it.
275 Returns the id of the object.
276 Returns 0 if not added and thus deleted.
277 */
278 u16 addActiveObject(std::unique_ptr<ServerActiveObject> object);
279
280 /*
281 Find out what new objects have been added to
282 inside a radius around a position
283 */
284 void getAddedActiveObjects(PlayerSAO *playersao, s16 radius,
285 s16 player_radius,
286 const std::set<u16> &current_objects,
287 std::vector<u16> &added_objects);
288
289 /*
290 Find out what new objects have been removed from
291 inside a radius around a position
292 */
293 void getRemovedActiveObjects(PlayerSAO *playersao, s16 radius,
294 s16 player_radius,
295 const std::set<u16> &current_objects,
296 std::vector<std::pair<bool /* gone? */, u16>> &removed_objects);
297
298 /*
299 Get the next message emitted by some active object.
300 Returns false if no messages are available, true otherwise.
301 */
303
304 virtual void getSelectedActiveObjects(
305 const core::line3d<f32> &shootline_on_map,
306 std::vector<PointedThing> &objects,
307 const std::optional<Pointabilities> &pointabilities
308 );
309
310 /*
311 Activate objects and dynamically modify for the dtime determined
312 from timestamp and additional_dtime
313 */
314 void activateBlock(MapBlock *block, u32 additional_dtime=0);
315
316 /*
317 {Active,Loading}BlockModifiers
318 -------------------------------------------
319 */
320
323
324 /*
325 Other stuff
326 -------------------------------------------
327 */
328
329 // Script-aware node setters
330 bool setNode(v3s16 p, const MapNode &n);
331 bool removeNode(v3s16 p);
332 bool swapNode(v3s16 p, const MapNode &n);
333
334 // Find the daylight value at pos with a Depth First Search
335 u8 findSunlight(v3s16 pos) const;
336
337 // Find all active objects inside a radius around a point
338 void getObjectsInsideRadius(std::vector<ServerActiveObject *> &objects, const v3f &pos, float radius,
339 std::function<bool(ServerActiveObject *obj)> include_obj_cb)
340 {
341 return m_ao_manager.getObjectsInsideRadius(pos, radius, objects, include_obj_cb);
342 }
343
344 // Find all active objects inside a box
345 void getObjectsInArea(std::vector<ServerActiveObject *> &objects, const aabb3f &box,
346 std::function<bool(ServerActiveObject *obj)> include_obj_cb)
347 {
348 return m_ao_manager.getObjectsInArea(box, objects, include_obj_cb);
349 }
350
351 // Clear objects, loading and going through every MapBlock
353
354 // to be called before destructor
356
357 // This makes stuff happen
358 void step(f32 dtime);
359
360 u32 getGameTime() const { return m_game_time; }
361
363 float getMaxLagEstimate() const { return m_max_lag_estimate; }
364
366
367 // Sorted by how ready a mapblock is
372 BS_ACTIVE // always highest value
373 };
375
376 // Sets the static object status all the active objects in the specified block
377 // This is only really needed for deleting blocks from the map
379 bool static_exists, v3s16 static_block=v3s16(0,0,0));
380
381 RemotePlayer *getPlayer(const session_t peer_id);
382 RemotePlayer *getPlayer(const char* name, bool match_invalid_peer = false);
383 const std::vector<RemotePlayer *> getPlayers() const { return m_players; }
384 u32 getPlayerCount() const { return m_players.size(); }
385
386 static bool migratePlayersDatabase(const GameParams &game_params,
387 const Settings &cmd_args);
388
390 static bool migrateAuthDatabase(const GameParams &game_params,
391 const Settings &cmd_args);
392private:
393
397 void loadDefaultMeta();
398
399 static PlayerDatabase *openPlayerDatabase(const std::string &name,
400 const std::string &savedir, const Settings &conf);
401 static AuthDatabase *openAuthDatabase(const std::string &name,
402 const std::string &savedir, const Settings &conf);
403 /*
404 Internal ActiveObject interface
405 -------------------------------------------
406 */
407
408 /*
409 Add an active object to the environment.
410
411 Called by addActiveObject.
412
413 Object may be deleted by environment immediately.
414 If id of object is 0, assigns a free id to it.
415 Returns the id of the object.
416 Returns 0 if not added and thus deleted.
417 */
418 u16 addActiveObjectRaw(std::unique_ptr<ServerActiveObject> object,
419 const StaticObject *from_static, u32 dtime_s);
420
421 /*
422 Remove all objects that satisfy (isGone() && m_known_by_count==0)
423 */
425
426 /*
427 Convert stored objects from block to active
428 */
429 void activateObjects(MapBlock *block, u32 dtime_s);
430
431 /*
432 Convert objects that are not in active blocks to static.
433
434 If m_known_by_count != 0, active object is not deleted, but static
435 data is still updated.
436
437 If force_delete is set, active object is deleted nevertheless. It
438 shall only be set so in the destructor of the environment.
439 */
440 void deactivateFarObjects(bool force_delete);
441
442 /*
443 A few helpers used by the three above methods
444 */
446 ServerActiveObject *obj, u16 id, u32 mod_reason, bool no_emerge);
447 bool saveStaticToBlock(v3s16 blockpos, u16 store_id,
448 ServerActiveObject *obj, const StaticObject &s_obj, u32 mod_reason);
449
451
452 /*
453 Member variables
454 */
455
456 // The map
457 std::unique_ptr<ServerMap> m_map;
458 // Lua state
460 // Server definition
462 // Active Object Manager
464 // on_mapblocks_changed map event receiver
466 // Outgoing network message buffer for active objects
467 std::queue<ActiveObjectMessage> m_active_object_messages;
468 // Some timers
471 // List of active blocks
477 // Whether the variables below have been read from file yet
478 bool m_meta_loaded = false;
479 // Time from the beginning of the game in seconds.
480 // Incremented in step().
481 u32 m_game_time = 0;
482 // A helper variable for incrementing the latter
484 // Time of last clearObjects call (game time).
485 // When a mapblock older than this is loaded, its objects are cleared.
487 // Active block modifiers
488 std::vector<ABMWithState> m_abms;
490 // An interval for generally sending object positions and stuff
492 // Estimate for general maximum lag as determined by server.
493 // Can raise to high values like 15s with eg. map generation mods.
494 float m_max_lag_estimate = 0.1f;
495
496 // peer_ids in here should be unique, except that there may be many 0s
497 std::vector<RemotePlayer*> m_players;
498
501
502 // Particles
504 std::unordered_map<u32, float> m_particle_spawners;
506 std::unordered_map<u32, u16> m_particle_spawner_attachments;
507
508 // Environment metrics
512
513 std::unique_ptr<ServerActiveObject> createSAO(ActiveObjectType type, v3f pos,
514 const std::string &data);
515};
ActiveObjectType
Definition: activeobject.h:29
Definition: serverenvironment.h:165
void clear()
Definition: serverenvironment.h:182
void remove(v3s16 p)
Definition: serverenvironment.h:186
void update(std::vector< PlayerSAO * > &active_players, s16 active_block_range, s16 active_object_range, std::set< v3s16 > &blocks_removed, std::set< v3s16 > &blocks_added, std::set< v3s16 > &extra_blocks_added)
Definition: serverenvironment.cpp:332
std::set< v3s16 > m_forceloaded_list
Definition: serverenvironment.h:194
bool contains(v3s16 p) const
Definition: serverenvironment.h:174
std::set< v3s16 > m_abm_list
Definition: serverenvironment.h:192
std::set< v3s16 > m_list
Definition: serverenvironment.h:191
auto size() const
Definition: serverenvironment.h:178
Definition: serverenvironment.h:56
virtual ~ActiveBlockModifier()=default
virtual void trigger(ServerEnvironment *env, v3s16 p, MapNode n, u32 active_object_count, u32 active_object_count_wider)
Definition: serverenvironment.h:78
virtual const std::vector< std::string > & getRequiredNeighbors() const =0
virtual bool getSimpleCatchUp()=0
virtual const std::vector< std::string > & getTriggerContents() const =0
virtual void trigger(ServerEnvironment *env, v3s16 p, MapNode n)
Definition: serverenvironment.h:77
virtual s16 getMinY()=0
ActiveBlockModifier()=default
virtual s16 getMaxY()=0
virtual u32 getTriggerChance()=0
virtual float getTriggerInterval()=0
T * getActiveObject(u16 id)
Definition: activeobjectmgr.h:64
Definition: database.h:76
Definition: environment.h:49
Definition: gamedef.h:51
Definition: numeric.h:359
Definition: serverenvironment.h:119
lbm_lookup_map m_lbm_lookup
Definition: serverenvironment.h:151
void addLBMDef(LoadingBlockModifierDef *lbm_def)
Definition: serverenvironment.cpp:138
void applyLBMs(ServerEnvironment *env, MapBlock *block, u32 stamp, float dtime_s)
Definition: serverenvironment.cpp:252
std::string createIntroductionTimesString()
Definition: serverenvironment.cpp:230
~LBMManager()
Definition: serverenvironment.cpp:127
std::map< u32, LBMContentMapping > lbm_lookup_map
Definition: serverenvironment.h:138
lbm_lookup_map::const_iterator getLBMsIntroducedAfter(u32 time)
Definition: serverenvironment.h:156
bool m_query_mode
Definition: serverenvironment.h:143
void loadIntroductionTimes(const std::string &times, IGameDef *gamedef, u32 now)
Definition: serverenvironment.cpp:153
std::unordered_map< std::string, LoadingBlockModifierDef * > m_lbm_defs
Definition: serverenvironment.h:147
LBMManager()=default
Definition: mapblock.h:73
Definition: map.h:109
Definition: map.h:116
Definition: metricsbackend.h:54
Definition: database.h:56
Definition: player_sao.h:71
Definition: remoteplayer.h:40
Definition: serveractiveobject.h:55
Definition: serverenvironment.h:220
bool swapNode(v3s16 p, const MapNode &n)
Definition: serverenvironment.cpp:1138
void removePlayer(RemotePlayer *player)
Definition: serverenvironment.cpp:607
ServerScripting * getScriptIface()
Definition: serverenvironment.h:232
IntervalLimiter m_object_management_interval
Definition: serverenvironment.h:470
void getAddedActiveObjects(PlayerSAO *playersao, s16 radius, s16 player_radius, const std::set< u16 > &current_objects, std::vector< u16 > &added_objects)
Definition: serverenvironment.cpp:1718
void init()
Definition: serverenvironment.cpp:453
static bool migratePlayersDatabase(const GameParams &game_params, const Settings &cmd_args)
Definition: serverenvironment.cpp:2344
void saveMeta()
Definition: serverenvironment.cpp:692
IntervalLimiter m_particle_management_interval
Definition: serverenvironment.h:503
IntervalLimiter m_active_blocks_mgmt_interval
Definition: serverenvironment.h:474
void savePlayer(RemotePlayer *player)
Definition: serverenvironment.cpp:640
MetricGaugePtr m_active_block_gauge
Definition: serverenvironment.h:510
std::vector< RemotePlayer * > m_players
Definition: serverenvironment.h:497
PlayerSAO * loadPlayer(RemotePlayer *player, bool *new_player, session_t peer_id, bool is_singleplayer)
Definition: serverenvironment.cpp:651
virtual void getSelectedActiveObjects(const core::line3d< f32 > &shootline_on_map, std::vector< PointedThing > &objects, const std::optional< Pointabilities > &pointabilities)
Definition: serverenvironment.cpp:1815
std::unique_ptr< ServerMap > m_map
Definition: serverenvironment.h:457
MetricGaugePtr m_active_object_gauge
Definition: serverenvironment.h:511
float m_recommended_send_interval
Definition: serverenvironment.h:491
void processActiveObjectRemove(ServerActiveObject *obj)
Definition: serverenvironment.cpp:2302
server::ActiveObjectMgr m_ao_manager
Definition: serverenvironment.h:463
void saveLoadedPlayers(bool force=false)
Definition: serverenvironment.cpp:624
OnMapblocksChangedReceiver m_on_mapblocks_changed_receiver
Definition: serverenvironment.h:465
float m_max_lag_estimate
Definition: serverenvironment.h:494
bool getActiveObjectMessage(ActiveObjectMessage *dest)
Definition: serverenvironment.cpp:1805
bool m_meta_loaded
Definition: serverenvironment.h:478
void setStaticForActiveObjectsInBlock(v3s16 blockpos, bool static_exists, v3s16 static_block=v3s16(0, 0, 0))
Definition: serverenvironment.cpp:1782
u32 addParticleSpawner(float exptime)
Definition: serverenvironment.cpp:1665
u32 m_game_time
Definition: serverenvironment.h:481
std::queue< ActiveObjectMessage > m_active_object_messages
Definition: serverenvironment.h:467
u8 findSunlight(v3s16 pos) const
Definition: serverenvironment.cpp:1149
float getMaxLagEstimate() const
Definition: serverenvironment.h:363
AuthDatabase * getAuthDatabase()
Definition: serverenvironment.h:389
const std::vector< RemotePlayer * > getPlayers() const
Definition: serverenvironment.h:383
Server * getGameDef()
Definition: serverenvironment.h:235
static AuthDatabase * openAuthDatabase(const std::string &name, const std::string &savedir, const Settings &conf)
Definition: serverenvironment.cpp:2431
void removeRemovedObjects()
Definition: serverenvironment.cpp:1952
std::unordered_map< u32, float > m_particle_spawners
Definition: serverenvironment.h:504
u16 addActiveObjectRaw(std::unique_ptr< ServerActiveObject > object, const StaticObject *from_static, u32 dtime_s)
Definition: serverenvironment.cpp:1884
void activateBlock(MapBlock *block, u32 additional_dtime=0)
Definition: serverenvironment.cpp:1021
BlockStatus getBlockStatus(v3s16 blockpos)
Definition: serverenvironment.cpp:1650
float getSendRecommendedInterval()
Definition: serverenvironment.h:238
Map & getMap()
Definition: serverenvironment.cpp:559
void deactivateFarObjects(bool force_delete)
Definition: serverenvironment.cpp:2119
RemotePlayer * getPlayer(const session_t peer_id)
Definition: serverenvironment.cpp:569
void clearObjects(ClearObjectsMode mode)
Definition: serverenvironment.cpp:1234
void reportMaxLagEstimate(float f)
Definition: serverenvironment.h:362
Server * m_server
Definition: serverenvironment.h:461
void deactivateBlocksAndObjects()
Definition: serverenvironment.cpp:529
bool setNode(v3s16 p, const MapNode &n)
Definition: serverenvironment.cpp:1080
MetricCounterPtr m_step_time_counter
Definition: serverenvironment.h:509
void loadDefaultMeta()
called if env_meta.txt doesn't exist (e.g.
Definition: serverenvironment.cpp:787
AuthDatabase * m_auth_database
Definition: serverenvironment.h:500
bool removePlayerFromDatabase(const std::string &name)
Definition: serverenvironment.cpp:619
std::set< v3s16 > * getForceloadedBlocks()
Definition: serverenvironment.h:365
ServerActiveObject * getActiveObject(u16 id)
Definition: serverenvironment.h:265
void addLoadingBlockModifierDef(LoadingBlockModifierDef *lbm)
Definition: serverenvironment.cpp:1075
IntervalLimiter m_active_block_modifier_interval
Definition: serverenvironment.h:475
u16 addActiveObject(std::unique_ptr< ServerActiveObject > object)
Definition: serverenvironment.cpp:1706
bool removeNode(v3s16 p)
Definition: serverenvironment.cpp:1113
LBMManager m_lbm_mgr
Definition: serverenvironment.h:489
void getObjectsInsideRadius(std::vector< ServerActiveObject * > &objects, const v3f &pos, float radius, std::function< bool(ServerActiveObject *obj)> include_obj_cb)
Definition: serverenvironment.h:338
u32 getPlayerCount() const
Definition: serverenvironment.h:384
ActiveBlockList m_active_blocks
Definition: serverenvironment.h:472
void loadMeta()
Definition: serverenvironment.cpp:720
std::unique_ptr< ServerActiveObject > createSAO(ActiveObjectType type, v3f pos, const std::string &data)
Definition: serverenvironment.cpp:2034
bool saveStaticToBlock(v3s16 blockpos, u16 store_id, ServerActiveObject *obj, const StaticObject &s_obj, u32 mod_reason)
Definition: serverenvironment.cpp:2273
static PlayerDatabase * openPlayerDatabase(const std::string &name, const std::string &savedir, const Settings &conf)
Definition: serverenvironment.cpp:2315
std::vector< ABMWithState > m_abms
Definition: serverenvironment.h:488
int m_fast_active_block_divider
Definition: serverenvironment.h:473
ServerScripting * m_script
Definition: serverenvironment.h:459
u32 m_particle_spawners_id_last_used
Definition: serverenvironment.h:505
u32 getGameTime() const
Definition: serverenvironment.h:360
std::unordered_map< u32, u16 > m_particle_spawner_attachments
Definition: serverenvironment.h:506
~ServerEnvironment()
Definition: serverenvironment.cpp:538
float m_game_time_fraction_counter
Definition: serverenvironment.h:483
void addPlayer(RemotePlayer *player)
Definition: serverenvironment.cpp:591
u32 m_last_clear_objects_time
Definition: serverenvironment.h:486
void deleteStaticFromBlock(ServerActiveObject *obj, u16 id, u32 mod_reason, bool no_emerge)
Definition: serverenvironment.cpp:2248
ServerMap & getServerMap()
Definition: serverenvironment.cpp:564
void getObjectsInArea(std::vector< ServerActiveObject * > &objects, const aabb3f &box, std::function< bool(ServerActiveObject *obj)> include_obj_cb)
Definition: serverenvironment.h:345
void getRemovedActiveObjects(PlayerSAO *playersao, s16 radius, s16 player_radius, const std::set< u16 > &current_objects, std::vector< std::pair< bool, u16 > > &removed_objects)
Definition: serverenvironment.cpp:1737
static bool migrateAuthDatabase(const GameParams &game_params, const Settings &cmd_args)
Definition: serverenvironment.cpp:2456
void activateObjects(MapBlock *block, u32 dtime_s)
Definition: serverenvironment.cpp:2049
float m_send_recommended_timer
Definition: serverenvironment.h:469
void deleteParticleSpawner(u32 id, bool remove_from_object=true)
Definition: serverenvironment.cpp:1692
PlayerDatabase * m_player_database
Definition: serverenvironment.h:499
void addActiveBlockModifier(ActiveBlockModifier *abm)
Definition: serverenvironment.cpp:1070
BlockStatus
Definition: serverenvironment.h:368
@ BS_EMERGING
Definition: serverenvironment.h:370
@ BS_ACTIVE
Definition: serverenvironment.h:372
@ BS_LOADED
Definition: serverenvironment.h:371
@ BS_UNKNOWN
Definition: serverenvironment.h:369
IntervalLimiter m_active_blocks_nodemetadata_interval
Definition: serverenvironment.h:476
void step(f32 dtime)
Definition: serverenvironment.cpp:1347
Definition: servermap.h:46
Definition: scripting_server.h:48
Definition: server.h:146
Definition: settings.h:124
Definition: activeobjectmgr.h:30
void getObjectsInArea(const aabb3f &box, std::vector< ServerActiveObject * > &result, std::function< bool(ServerActiveObject *obj)> include_obj_cb)
Definition: activeobjectmgr.cpp:139
void getObjectsInsideRadius(const v3f &pos, float radius, std::vector< ServerActiveObject * > &result, std::function< bool(ServerActiveObject *obj)> include_obj_cb)
Definition: activeobjectmgr.cpp:121
core::aabbox3d< f32 > aabb3f
Definition: irr_aabb3d.h:26
core::vector3d< s16 > v3s16
Definition: irr_v3d.h:28
core::vector3df v3f
Definition: irr_v3d.h:26
u16 content_t
Definition: mapnode.h:37
std::shared_ptr< MetricCounter > MetricCounterPtr
Definition: metricsbackend.h:37
std::shared_ptr< MetricGauge > MetricGaugePtr
Definition: metricsbackend.h:51
Definition: activeobjectmgr.cpp:26
AccessDeniedCode
Definition: networkprotocol.h:1080
u16 session_t
Definition: networkprotocol.h:251
ClearObjectsMode
Definition: serverenvironment.h:210
@ CLEAR_OBJECTS_MODE_QUICK
Definition: serverenvironment.h:216
@ CLEAR_OBJECTS_MODE_FULL
Definition: serverenvironment.h:212
u16 session_t
Definition: serverenvironment.h:46
Definition: serverenvironment.h:83
float timer
Definition: serverenvironment.h:85
ActiveBlockModifier * abm
Definition: serverenvironment.h:84
Definition: activeobject.h:48
Definition: gameparams.h:27
Definition: serverenvironment.h:104
void addLBM(LoadingBlockModifierDef *lbm_def, IGameDef *gamedef)
Definition: serverenvironment.cpp:87
const lbm_map::mapped_type * lookup(content_t c) const
Definition: serverenvironment.cpp:116
void deleteContents()
Definition: serverenvironment.cpp:80
std::unordered_map< content_t, std::vector< LoadingBlockModifierDef * > > lbm_map
Definition: serverenvironment.h:105
lbm_map map
Definition: serverenvironment.h:106
std::vector< LoadingBlockModifierDef * > lbm_list
Definition: serverenvironment.h:108
Definition: serverenvironment.h:91
std::string name
Definition: serverenvironment.h:94
std::set< std::string > trigger_contents
Definition: serverenvironment.h:93
virtual void trigger(ServerEnvironment *env, v3s16 p, MapNode n, float dtime_s)
Definition: serverenvironment.h:99
bool run_at_every_load
Definition: serverenvironment.h:95
virtual ~LoadingBlockModifierDef()=default
Definition: map.h:59
Definition: mapnode.h:139
Definition: serverenvironment.h:200
std::unordered_set< v3s16 > modified_blocks
Definition: serverenvironment.h:201
void onMapEditEvent(const MapEditEvent &event) override
Definition: serverenvironment.cpp:424
bool receiving
Definition: serverenvironment.h:202
Definition: staticobject.h:32
static std::string p(std::string path)
Definition: test_filesys.cpp:64