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 std::unique_ptr<PlayerSAO> loadPlayer(RemotePlayer *player, session_t peer_id);
244 void addPlayer(RemotePlayer *player);
245 void removePlayer(RemotePlayer *player);
246 bool removePlayerFromDatabase(const std::string &name);
247
248 /*
249 Save and load time of day and game timer
250 */
251 void saveMeta();
252 void loadMeta();
253
254 u32 addParticleSpawner(float exptime);
255 u32 addParticleSpawner(float exptime, u16 attached_id);
256 void deleteParticleSpawner(u32 id, bool remove_from_object = true);
257
258 /*
259 External ActiveObject interface
260 -------------------------------------------
261 */
262
267
268 /*
269 Add an active object to the environment.
270 Environment handles deletion of object.
271 Object may be deleted by environment immediately.
272 If id of object is 0, assigns a free id to it.
273 Returns the id of the object.
274 Returns 0 if not added and thus deleted.
275 */
276 u16 addActiveObject(std::unique_ptr<ServerActiveObject> object);
277
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 std::string &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: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:1163
void removePlayer(RemotePlayer *player)
Definition serverenvironment.cpp:626
ServerScripting * getScriptIface()
Definition serverenvironment.h:231
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:1733
void init()
Definition serverenvironment.cpp:472
static bool migratePlayersDatabase(const GameParams &game_params, const Settings &cmd_args)
Definition serverenvironment.cpp:2369
void saveMeta()
Definition serverenvironment.cpp:701
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:659
MetricGaugePtr m_active_block_gauge
Definition serverenvironment.h:510
std::vector< RemotePlayer * > m_players
Definition serverenvironment.h:497
virtual void getSelectedActiveObjects(const core::line3d< f32 > &shootline_on_map, std::vector< PointedThing > &objects, const std::optional< Pointabilities > &pointabilities)
Definition serverenvironment.cpp:1840
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:2327
server::ActiveObjectMgr m_ao_manager
Definition serverenvironment.h:463
void saveLoadedPlayers(bool force=false)
Definition serverenvironment.cpp:643
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:1830
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:1807
u32 addParticleSpawner(float exptime)
Definition serverenvironment.cpp:1675
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:1174
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:234
static AuthDatabase * openAuthDatabase(const std::string &name, const std::string &savedir, const Settings &conf)
Definition serverenvironment.cpp:2456
void removeRemovedObjects()
Definition serverenvironment.cpp:1977
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:1909
void activateBlock(MapBlock *block, u32 additional_dtime=0)
Definition serverenvironment.cpp:1046
BlockStatus getBlockStatus(v3s16 blockpos)
Definition serverenvironment.cpp:1660
float getSendRecommendedInterval()
Definition serverenvironment.h:237
Map & getMap()
Definition serverenvironment.cpp:578
void deactivateFarObjects(bool force_delete)
Definition serverenvironment.cpp:2144
RemotePlayer * getPlayer(const session_t peer_id)
Definition serverenvironment.cpp:588
void clearObjects(ClearObjectsMode mode)
Definition serverenvironment.cpp:1259
void reportMaxLagEstimate(float f)
Definition serverenvironment.h:362
Server * m_server
Definition serverenvironment.h:461
void deactivateBlocksAndObjects()
Definition serverenvironment.cpp:548
bool setNode(v3s16 p, const MapNode &n)
Definition serverenvironment.cpp:1105
MetricCounterPtr m_step_time_counter
Definition serverenvironment.h:509
void loadDefaultMeta()
called if env_meta.txt doesn't exist (e.g.
Definition serverenvironment.cpp:796
AuthDatabase * m_auth_database
Definition serverenvironment.h:500
std::unique_ptr< PlayerSAO > loadPlayer(RemotePlayer *player, session_t peer_id)
Definition serverenvironment.cpp:670
bool removePlayerFromDatabase(const std::string &name)
Definition serverenvironment.cpp:638
std::set< v3s16 > * getForceloadedBlocks()
Definition serverenvironment.h:365
ServerActiveObject * getActiveObject(u16 id)
Definition serverenvironment.h:263
void addLoadingBlockModifierDef(LoadingBlockModifierDef *lbm)
Definition serverenvironment.cpp:1100
IntervalLimiter m_active_block_modifier_interval
Definition serverenvironment.h:475
void invalidateActiveObjectObserverCaches()
Definition serverenvironment.cpp:1724
u16 addActiveObject(std::unique_ptr< ServerActiveObject > object)
Definition serverenvironment.cpp:1716
bool removeNode(v3s16 p)
Definition serverenvironment.cpp:1138
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:729
std::unique_ptr< ServerActiveObject > createSAO(ActiveObjectType type, v3f pos, const std::string &data)
Definition serverenvironment.cpp:2059
bool saveStaticToBlock(v3s16 blockpos, u16 store_id, ServerActiveObject *obj, const StaticObject &s_obj, u32 mod_reason)
Definition serverenvironment.cpp:2298
static PlayerDatabase * openPlayerDatabase(const std::string &name, const std::string &savedir, const Settings &conf)
Definition serverenvironment.cpp:2340
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
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:506
~ServerEnvironment()
Definition serverenvironment.cpp:557
float m_game_time_fraction_counter
Definition serverenvironment.h:483
void addPlayer(RemotePlayer *player)
Definition serverenvironment.cpp:610
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:2273
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: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:1757
static bool migrateAuthDatabase(const GameParams &game_params, const Settings &cmd_args)
Definition serverenvironment.cpp:2481
void activateObjects(MapBlock *block, u32 dtime_s)
Definition serverenvironment.cpp:2074
float m_send_recommended_timer
Definition serverenvironment.h:469
void deleteParticleSpawner(u32 id, bool remove_from_object=true)
Definition serverenvironment.cpp:1702
PlayerDatabase * m_player_database
Definition serverenvironment.h:499
void addActiveBlockModifier(ActiveBlockModifier *abm)
Definition serverenvironment.cpp:1095
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:1372
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:55