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