Minetest  5.4.0
ServerEnvironment Class Reference

#include <serverenvironment.h>

+ Inheritance diagram for ServerEnvironment:
+ Collaboration diagram for ServerEnvironment:

Public Member Functions

 ServerEnvironment (ServerMap *map, ServerScripting *scriptIface, Server *server, const std::string &path_world)
 
 ~ServerEnvironment ()
 
MapgetMap ()
 
ServerMapgetServerMap ()
 
ServerScriptinggetScriptIface ()
 
ServergetGameDef ()
 
float getSendRecommendedInterval ()
 
void kickAllPlayers (AccessDeniedCode reason, const std::string &str_reason, bool reconnect)
 
void saveLoadedPlayers (bool force=false)
 
void savePlayer (RemotePlayer *player)
 
PlayerSAOloadPlayer (RemotePlayer *player, bool *new_player, session_t peer_id, bool is_singleplayer)
 
void addPlayer (RemotePlayer *player)
 
void removePlayer (RemotePlayer *player)
 
bool removePlayerFromDatabase (const std::string &name)
 
void saveMeta ()
 
void loadMeta ()
 
u32 addParticleSpawner (float exptime)
 
u32 addParticleSpawner (float exptime, u16 attached_id)
 
void deleteParticleSpawner (u32 id, bool remove_from_object=true)
 
ServerActiveObjectgetActiveObject (u16 id)
 
u16 addActiveObject (ServerActiveObject *object)
 
void getAddedActiveObjects (PlayerSAO *playersao, s16 radius, s16 player_radius, std::set< u16 > &current_objects, std::queue< u16 > &added_objects)
 
void getRemovedActiveObjects (PlayerSAO *playersao, s16 radius, s16 player_radius, std::set< u16 > &current_objects, std::queue< u16 > &removed_objects)
 
bool getActiveObjectMessage (ActiveObjectMessage *dest)
 
virtual void getSelectedActiveObjects (const core::line3d< f32 > &shootline_on_map, std::vector< PointedThing > &objects)
 
void activateBlock (MapBlock *block, u32 additional_dtime=0)
 
void addActiveBlockModifier (ActiveBlockModifier *abm)
 
void addLoadingBlockModifierDef (LoadingBlockModifierDef *lbm)
 
bool setNode (v3s16 p, const MapNode &n)
 
bool removeNode (v3s16 p)
 
bool swapNode (v3s16 p, const MapNode &n)
 
u8 findSunlight (v3s16 pos) const
 
void getObjectsInsideRadius (std::vector< ServerActiveObject * > &objects, const v3f &pos, float radius, std::function< bool(ServerActiveObject *obj)> include_obj_cb)
 
void getObjectsInArea (std::vector< ServerActiveObject * > &objects, const aabb3f &box, std::function< bool(ServerActiveObject *obj)> include_obj_cb)
 
void clearObjects (ClearObjectsMode mode)
 
void step (f32 dtime)
 
u32 getGameTime () const
 
void reportMaxLagEstimate (float f)
 
float getMaxLagEstimate ()
 
std::set< v3s16 > * getForceloadedBlocks ()
 
void setStaticForActiveObjectsInBlock (v3s16 blockpos, bool static_exists, v3s16 static_block=v3s16(0, 0, 0))
 
RemotePlayergetPlayer (const session_t peer_id)
 
RemotePlayergetPlayer (const char *name)
 
const std::vector< RemotePlayer * > getPlayers () const
 
u32 getPlayerCount () const
 
AuthDatabasegetAuthDatabase ()
 
- Public Member Functions inherited from Environment
 Environment (IGameDef *gamedef)
 
virtual ~Environment ()=default
 
 DISABLE_CLASS_COPY (Environment)
 
u32 getDayNightRatio ()
 
virtual void setTimeOfDay (u32 time)
 
u32 getTimeOfDay ()
 
float getTimeOfDayF ()
 
void stepTimeOfDay (float dtime)
 
void setTimeOfDaySpeed (float speed)
 
void setDayNightRatioOverride (bool enable, u32 value)
 
u32 getDayCount ()
 
bool line_of_sight (v3f pos1, v3f pos2, v3s16 *p=nullptr)
 
void continueRaycast (RaycastState *state, PointedThing *result)
 
IGameDefgetGameDef ()
 

Static Public Member Functions

static bool migratePlayersDatabase (const GameParams &game_params, const Settings &cmd_args)
 
static bool migrateAuthDatabase (const GameParams &game_params, const Settings &cmd_args)
 

Private Member Functions

void loadDefaultMeta ()
 called if env_meta.txt doesn't exist (e.g. More...
 
u16 addActiveObjectRaw (ServerActiveObject *object, bool set_changed, u32 dtime_s)
 
void removeRemovedObjects ()
 
void activateObjects (MapBlock *block, u32 dtime_s)
 
void deactivateFarObjects (bool force_delete)
 
void deleteStaticFromBlock (ServerActiveObject *obj, u16 id, u32 mod_reason, bool no_emerge)
 
bool saveStaticToBlock (v3s16 blockpos, u16 store_id, ServerActiveObject *obj, const StaticObject &s_obj, u32 mod_reason)
 
ServerActiveObjectcreateSAO (ActiveObjectType type, v3f pos, const std::string &data)
 

Static Private Member Functions

static PlayerDatabaseopenPlayerDatabase (const std::string &name, const std::string &savedir, const Settings &conf)
 
static AuthDatabaseopenAuthDatabase (const std::string &name, const std::string &savedir, const Settings &conf)
 

Private Attributes

ServerMapm_map
 
ServerScriptingm_script
 
Serverm_server
 
server::ActiveObjectMgr m_ao_manager
 
const std::string m_path_world
 
std::queue< ActiveObjectMessagem_active_object_messages
 
float m_send_recommended_timer = 0.0f
 
IntervalLimiter m_object_management_interval
 
ActiveBlockList m_active_blocks
 
IntervalLimiter m_active_blocks_management_interval
 
IntervalLimiter m_active_block_modifier_interval
 
IntervalLimiter m_active_blocks_nodemetadata_interval
 
bool m_meta_loaded = false
 
u32 m_game_time = 0
 
float m_game_time_fraction_counter = 0.0f
 
u32 m_last_clear_objects_time = 0
 
std::vector< ABMWithStatem_abms
 
LBMManager m_lbm_mgr
 
float m_recommended_send_interval = 0.1f
 
float m_max_lag_estimate = 0.1f
 
std::vector< RemotePlayer * > m_players
 
PlayerDatabasem_player_database = nullptr
 
AuthDatabasem_auth_database = nullptr
 
std::mt19937 m_rgen
 
IntervalLimiter m_particle_management_interval
 
std::unordered_map< u32, float > m_particle_spawners
 
std::unordered_map< u32, u16 > m_particle_spawner_attachments
 

Additional Inherited Members

- Public Attributes inherited from Environment
u32 m_added_objects
 
- Protected Attributes inherited from Environment
std::atomic< float > m_time_of_day_speed
 
u32 m_time_of_day
 
float m_time_of_day_f
 
float m_time_conversion_skew = 0.0f
 
bool m_enable_day_night_ratio_override = false
 
u32 m_day_night_ratio_override = 0.0f
 
std::atomic< u32 > m_day_count
 
bool m_cache_enable_shaders
 
float m_cache_active_block_mgmt_interval
 
float m_cache_abm_interval
 
float m_cache_nodetimer_interval
 
float m_cache_abm_time_budget
 
IGameDefm_gamedef
 

Constructor & Destructor Documentation

◆ ServerEnvironment()

ServerEnvironment::ServerEnvironment ( ServerMap map,
ServerScripting scriptIface,
Server server,
const std::string &  path_world 
)

References DIR_DELIM, errorstream, Settings::exists(), Settings::getNoEx(), m_auth_database, m_player_database, openAuthDatabase(), openPlayerDatabase(), Settings::readConfigFile(), Settings::set(), Settings::updateConfigFile(), and warningstream.

+ Here is the call graph for this function:

◆ ~ServerEnvironment()

ServerEnvironment::~ServerEnvironment ( )

References ActiveBlockList::clear(), deactivateFarObjects(), Map::drop(), m_abms, m_active_blocks, m_auth_database, m_map, m_player_database, and m_players.

+ Here is the call graph for this function:

Member Function Documentation

◆ activateBlock()

void ServerEnvironment::activateBlock ( MapBlock block,
u32  additional_dtime = 0 
)

References activateObjects(), LBMManager::applyLBMs(), BLOCK_TIMESTAMP_UNDEFINED, MapBlock::getNodeNoEx(), MapBlock::getPosRelative(), MapBlock::getTimestamp(), m_game_time, m_last_clear_objects_time, m_lbm_mgr, MapBlock::m_node_timers, m_script, MapBlock::m_static_objects, StaticObjectList::m_stored, ScriptApiNode::node_on_timer(), p(), MapBlock::resetUsageTimer(), MapBlock::setNodeTimer(), MapBlock::setTimestampNoChangedFlag(), and NodeTimerList::step().

Referenced by EmergeThread::finishGen(), and step().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ activateObjects()

void ServerEnvironment::activateObjects ( MapBlock block,
u32  dtime_s 
)
private

References addActiveObjectRaw(), BS, createSAO(), StaticObject::data, errorstream, g_settings, MapBlock::getPos(), Settings::getU16(), MapBlock::m_static_objects, StaticObjectList::m_stored, MOD_REASON_TOO_MANY_OBJECTS, MOD_STATE_WRITE_NEEDED, StaticObject::pos, PP, print_hexdump(), MapBlock::raiseModified(), StaticObject::type, and verbosestream.

Referenced by activateBlock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addActiveBlockModifier()

void ServerEnvironment::addActiveBlockModifier ( ActiveBlockModifier abm)

References m_abms.

Referenced by ScriptApiEnv::initializeEnvironment().

+ Here is the caller graph for this function:

◆ addActiveObject()

u16 ServerEnvironment::addActiveObject ( ServerActiveObject object)

References addActiveObjectRaw(), and Environment::m_added_objects.

Referenced by loadPlayer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addActiveObjectRaw()

u16 ServerEnvironment::addActiveObjectRaw ( ServerActiveObject object,
bool  set_changed,
u32  dtime_s 
)
private

References ScriptApiBase::addObjectReference(), BS, ServerMap::emergeBlock(), errorstream, floatToInt(), getNodeBlockPos(), ServerActiveObject::isStaticAllowed(), StaticObjectList::m_active, m_ao_manager, m_map, m_script, MapBlock::m_static_objects, MOD_REASON_ADD_ACTIVE_OBJECT_RAW, MOD_STATE_WRITE_NEEDED, p(), PP, MapBlock::raiseModified(), and server::ActiveObjectMgr::registerObject().

Referenced by activateObjects(), and addActiveObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLoadingBlockModifierDef()

void ServerEnvironment::addLoadingBlockModifierDef ( LoadingBlockModifierDef lbm)

References LBMManager::addLBMDef(), and m_lbm_mgr.

Referenced by ScriptApiEnv::initializeEnvironment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addParticleSpawner() [1/2]

u32 ServerEnvironment::addParticleSpawner ( float  exptime)

References m_particle_spawners, and PARTICLE_SPAWNER_NO_EXPIRY.

Referenced by Server::addParticleSpawner(), and addParticleSpawner().

+ Here is the caller graph for this function:

◆ addParticleSpawner() [2/2]

u32 ServerEnvironment::addParticleSpawner ( float  exptime,
u16  attached_id 
)

References addParticleSpawner(), getActiveObject(), and m_particle_spawner_attachments.

+ Here is the call graph for this function:

◆ addPlayer()

void ServerEnvironment::addPlayer ( RemotePlayer player)

References FATAL_ERROR_IF, Player::getName(), RemotePlayer::getPeerId(), getPlayer(), m_players, and PEER_ID_INEXISTENT.

Referenced by loadPlayer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearObjects()

◆ createSAO()

ServerActiveObject * ServerEnvironment::createSAO ( ActiveObjectType  type,
v3f  pos,
const std::string &  data 
)
private

References ACTIVEOBJECT_TYPE_LUAENTITY, and warningstream.

Referenced by activateObjects().

+ Here is the caller graph for this function:

◆ deactivateFarObjects()

◆ deleteParticleSpawner()

void ServerEnvironment::deleteParticleSpawner ( u32  id,
bool  remove_from_object = true 
)

References ServerActiveObject::detachParticleSpawner(), getActiveObject(), m_particle_spawner_attachments, and m_particle_spawners.

Referenced by LuaEntitySAO::~LuaEntitySAO(), Server::deleteParticleSpawner(), and PlayerSAO::removingFromEnvironment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteStaticFromBlock()

void ServerEnvironment::deleteStaticFromBlock ( ServerActiveObject obj,
u16  id,
u32  mod_reason,
bool  no_emerge 
)
private

References ServerMap::emergeBlock(), errorstream, Map::getBlockNoCreateNoEx(), m_map, ServerActiveObject::m_static_block, ServerActiveObject::m_static_exists, MapBlock::m_static_objects, MOD_REASON_UNKNOWN, MOD_STATE_WRITE_NEEDED, PP, MapBlock::raiseModified(), and StaticObjectList::remove().

Referenced by clearObjects(), deactivateFarObjects(), and removeRemovedObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findSunlight()

u8 ServerEnvironment::findSunlight ( v3s16  pos) const

References ServerMap::emergeBlock(), NodeDefManager::get(), MapDatabase::getBlockAsInteger(), Map::getNode(), m_map, m_server, IGameDef::ndef(), MapNode::param1, and ContentFeatures::sunlight_propagates.

+ Here is the call graph for this function:

◆ getActiveObject()

ServerActiveObject* ServerEnvironment::getActiveObject ( u16  id)
inline

References ActiveObjectMgr< T >::getActiveObject(), and m_ao_manager.

Referenced by addParticleSpawner(), Server::AsyncRunStep(), UnitSAO::clearChildAttachments(), UnitSAO::clearParentAttachment(), ClientInterface::DeleteClient(), deleteParticleSpawner(), getAttachedObject(), LuaEntitySAO::getClientInitializationData(), PlayerSAO::getClientInitializationData(), UnitSAO::getParent(), ServerSoundParams::getPos(), getRemovedActiveObjects(), Server::handleCommand_Interact(), UnitSAO::onAttach(), UnitSAO::onDetach(), Server::SendActiveObjectRemoveAdd(), and Server::sendMetadataChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActiveObjectMessage()

bool ServerEnvironment::getActiveObjectMessage ( ActiveObjectMessage dest)

References m_active_object_messages.

Referenced by Server::AsyncRunStep().

+ Here is the caller graph for this function:

◆ getAddedActiveObjects()

void ServerEnvironment::getAddedActiveObjects ( PlayerSAO playersao,
s16  radius,
s16  player_radius,
std::set< u16 > &  current_objects,
std::queue< u16 > &  added_objects 
)

References BS, server::ActiveObjectMgr::getAddedActiveObjectsAroundPos(), ServerActiveObject::getBasePosition(), and m_ao_manager.

Referenced by Server::SendActiveObjectRemoveAdd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAuthDatabase()

AuthDatabase* ServerEnvironment::getAuthDatabase ( )
inline

References m_auth_database.

Referenced by ModApiAuth::getAuthDb().

+ Here is the caller graph for this function:

◆ getForceloadedBlocks()

std::set<v3s16>* ServerEnvironment::getForceloadedBlocks ( )
inline

◆ getGameDef()

◆ getGameTime()

u32 ServerEnvironment::getGameTime ( ) const
inline

References m_game_time.

Referenced by Server::AsyncRunStep().

+ Here is the caller graph for this function:

◆ getMap()

◆ getMaxLagEstimate()

float ServerEnvironment::getMaxLagEstimate ( )
inline

References m_max_lag_estimate.

Referenced by Server::AsyncRunStep(), PlayerSAO::checkMovementCheat(), Server::getStatusString(), and PlayerSAO::step().

+ Here is the caller graph for this function:

◆ getObjectsInArea()

void ServerEnvironment::getObjectsInArea ( std::vector< ServerActiveObject * > &  objects,
const aabb3f box,
std::function< bool(ServerActiveObject *obj)>  include_obj_cb 
)
inline

References server::ActiveObjectMgr::getObjectsInArea(), and m_ao_manager.

+ Here is the call graph for this function:

◆ getObjectsInsideRadius()

void ServerEnvironment::getObjectsInsideRadius ( std::vector< ServerActiveObject * > &  objects,
const v3f pos,
float  radius,
std::function< bool(ServerActiveObject *obj)>  include_obj_cb 
)
inline

References server::ActiveObjectMgr::getObjectsInsideRadius(), and m_ao_manager.

Referenced by collisionMoveSimple(), and getSelectedActiveObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPlayer() [1/2]

RemotePlayer * ServerEnvironment::getPlayer ( const char *  name)

References m_players.

◆ getPlayer() [2/2]

RemotePlayer * ServerEnvironment::getPlayer ( const session_t  peer_id)

References m_players.

Referenced by Server::addParticleSpawner(), addPlayer(), Server::AsyncRunStep(), ServerInventoryManager::createDetachedInventory(), Server::DeleteClient(), Server::deleteParticleSpawner(), Server::dynamicAddMedia(), Server::emergePlayer(), ServerInventoryManager::getInventory(), RemoteClient::GetNextBlocks(), Server::getPlayerName(), Server::getPlayerSAO(), Server::getStatusString(), Server::handleCommand_ChatMessage(), Server::handleCommand_Damage(), Server::handleCommand_Interact(), Server::handleCommand_InventoryAction(), Server::handleCommand_InventoryFields(), Server::handleCommand_NodeMetaFields(), Server::handleCommand_PlayerItem(), Server::handleCommand_PlayerPos(), Server::handleCommand_Respawn(), ModApiServer::l_remove_player(), Server::notifyPlayer(), Server::playSound(), ServerInventoryManager::removeDetachedInventory(), Server::reportFormspecPrependModified(), Server::reportInventoryFormspecModified(), Server::reportPrivsModified(), Server::sendAddNode(), Server::SendAddParticleSpawner(), Server::SendChatMessage(), Server::SendMinimapModes(), Server::SendMovePlayer(), Server::SendPlayerFormspecPrepend(), Server::SendPlayerFov(), Server::SendPlayerInventoryFormspec(), Server::SendPlayerPrivileges(), Server::sendRemoveNode(), Server::SendSpawnParticle(), ServerInventoryManager::setInventoryModified(), Server::showFormspec(), Server::spawnParticle(), Server::StageTwoClientInit(), and ClientInterface::UpdatePlayerList().

+ Here is the caller graph for this function:

◆ getPlayerCount()

u32 ServerEnvironment::getPlayerCount ( ) const
inline

References m_players.

Referenced by ModApiEnvMod::l_get_connected_players(), and Server::SendBlocks().

+ Here is the caller graph for this function:

◆ getPlayers()

const std::vector<RemotePlayer *> ServerEnvironment::getPlayers ( ) const
inline

References m_players.

Referenced by ModApiEnvMod::l_get_connected_players().

+ Here is the caller graph for this function:

◆ getRemovedActiveObjects()

void ServerEnvironment::getRemovedActiveObjects ( PlayerSAO playersao,
s16  radius,
s16  player_radius,
std::set< u16 > &  current_objects,
std::queue< u16 > &  removed_objects 
)

References ACTIVEOBJECT_TYPE_PLAYER, BS, getActiveObject(), ServerActiveObject::getBasePosition(), ActiveObject::getType(), infostream, and ServerActiveObject::isGone().

Referenced by Server::SendActiveObjectRemoveAdd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScriptIface()

◆ getSelectedActiveObjects()

void ServerEnvironment::getSelectedActiveObjects ( const core::line3d< f32 > &  shootline_on_map,
std::vector< PointedThing > &  objects 
)
virtual

Gets the objects pointed by the shootline as pointed things. If this is a client environment, the local player won't be returned.

Parameters
[in]shootline_on_mapthe shootline for the test in world coordinates
[out]objectsfound objects

Implements Environment.

References boxLineCollision(), and getObjectsInsideRadius().

+ Here is the call graph for this function:

◆ getSendRecommendedInterval()

float ServerEnvironment::getSendRecommendedInterval ( )
inline

References m_recommended_send_interval.

Referenced by LuaEntitySAO::sendPosition(), step(), and PlayerSAO::step().

+ Here is the caller graph for this function:

◆ getServerMap()

ServerMap & ServerEnvironment::getServerMap ( )

References m_map.

Referenced by Server::acceptAuth(), ABMHandler::apply(), and Server::findSpawnPos().

+ Here is the caller graph for this function:

◆ kickAllPlayers()

void ServerEnvironment::kickAllPlayers ( AccessDeniedCode  reason,
const std::string &  str_reason,
bool  reconnect 
)

References Server::DenyAccessVerCompliant(), m_players, and m_server.

Referenced by Server::~Server(), and Server::step().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadDefaultMeta()

void ServerEnvironment::loadDefaultMeta ( )
private

called if env_meta.txt doesn't exist (e.g.

new world)

References LBMManager::loadIntroductionTimes(), m_game_time, m_lbm_mgr, and m_server.

Referenced by loadMeta().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadMeta()

void ServerEnvironment::loadMeta ( )

References DIR_DELIM, Settings::exists(), Settings::get(), Settings::getU64(), infostream, loadDefaultMeta(), LBMManager::loadIntroductionTimes(), Environment::m_day_count, m_game_time, m_last_clear_objects_time, m_lbm_mgr, m_meta_loaded, m_path_world, m_server, Settings::parseConfigLines(), fs::PathExists(), SANITY_CHECK, and Environment::setTimeOfDay().

Referenced by Server::init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadPlayer()

PlayerSAO * ServerEnvironment::loadPlayer ( RemotePlayer player,
bool *  new_player,
session_t  peer_id,
bool  is_singleplayer 
)

References actionstream, addActiveObject(), addPlayer(), Player::clearHud(), Server::findSpawnPos(), ServerActiveObject::getBasePosition(), Player::getName(), infostream, PlayerDatabase::loadPlayer(), m_player_database, m_server, objectpos_over_limit(), PlayerSAO::setBasePosition(), and RemotePlayer::setModified().

Referenced by Server::emergePlayer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ migrateAuthDatabase()

bool ServerEnvironment::migrateAuthDatabase ( const GameParams game_params,
const Settings cmd_args 
)
static

References actionstream, DIR_DELIM, errorstream, Settings::exists(), Settings::get(), openAuthDatabase(), fs::PathExists(), Settings::readConfigFile(), fs::Rename(), Settings::set(), Settings::updateConfigFile(), warningstream, BaseException::what(), and GameParams::world_path.

Referenced by run_dedicated_server().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ migratePlayersDatabase()

bool ServerEnvironment::migratePlayersDatabase ( const GameParams game_params,
const Settings cmd_args 
)
static

References actionstream, fs::CreateDir(), fs::DeleteSingleFileOrEmptyDirectory(), DIR_DELIM, errorstream, Settings::exists(), PlayerSAO::finalize(), Settings::get(), PlayerDatabase::listPlayers(), PlayerDatabase::loadPlayer(), openPlayerDatabase(), Settings::readConfigFile(), fs::Rename(), PlayerDatabase::savePlayer(), Settings::set(), RemotePlayer::setPlayerSAO(), Settings::updateConfigFile(), BaseException::what(), and GameParams::world_path.

Referenced by run_dedicated_server().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openAuthDatabase()

AuthDatabase * ServerEnvironment::openAuthDatabase ( const std::string &  name,
const std::string &  savedir,
const Settings conf 
)
staticprivate

References Settings::getNoEx().

Referenced by ServerEnvironment(), and migrateAuthDatabase().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openPlayerDatabase()

PlayerDatabase * ServerEnvironment::openPlayerDatabase ( const std::string &  name,
const std::string &  savedir,
const Settings conf 
)
staticprivate

References DIR_DELIM, and Settings::getNoEx().

Referenced by ServerEnvironment(), and migratePlayersDatabase().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeNode()

bool ServerEnvironment::removeNode ( v3s16  p)

References NodeDefManager::get(), Map::getNode(), ContentFeatures::has_after_destruct, ContentFeatures::has_on_destruct, m_map, m_script, m_server, IGameDef::ndef(), ScriptApiNode::node_after_destruct(), ScriptApiNode::node_on_destruct(), p(), Map::removeNodeWithEvent(), and ServerMap::updateVManip().

+ Here is the call graph for this function:

◆ removePlayer()

void ServerEnvironment::removePlayer ( RemotePlayer player)

References m_players.

Referenced by PlayerSAO::unlinkPlayerSessionAndSave().

+ Here is the caller graph for this function:

◆ removePlayerFromDatabase()

bool ServerEnvironment::removePlayerFromDatabase ( const std::string &  name)

References m_player_database, and PlayerDatabase::removePlayer().

Referenced by ModApiServer::l_remove_player().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeRemovedObjects()

◆ reportMaxLagEstimate()

void ServerEnvironment::reportMaxLagEstimate ( float  f)
inline

References m_max_lag_estimate.

Referenced by Server::AsyncRunStep().

+ Here is the caller graph for this function:

◆ saveLoadedPlayers()

void ServerEnvironment::saveLoadedPlayers ( bool  force = false)

References errorstream, m_player_database, m_players, PlayerDatabase::savePlayer(), and BaseException::what().

Referenced by Server::~Server(), and Server::AsyncRunStep().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveMeta()

void ServerEnvironment::saveMeta ( )

References LBMManager::createIntroductionTimesString(), DIR_DELIM, Environment::getTimeOfDay(), infostream, Environment::m_day_count, m_game_time, m_last_clear_objects_time, m_lbm_mgr, m_meta_loaded, m_path_world, fs::safeWriteToFile(), Settings::set(), Settings::setU64(), and Settings::writeLines().

Referenced by Server::~Server(), and Server::AsyncRunStep().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePlayer()

void ServerEnvironment::savePlayer ( RemotePlayer player)

References errorstream, Player::getName(), m_player_database, PlayerDatabase::savePlayer(), and BaseException::what().

Referenced by PlayerSAO::unlinkPlayerSessionAndSave().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveStaticToBlock()

bool ServerEnvironment::saveStaticToBlock ( v3s16  blockpos,
u16  store_id,
ServerActiveObject obj,
const StaticObject s_obj,
u32  mod_reason 
)
private

References ServerMap::emergeBlock(), errorstream, g_settings, Settings::getU16(), StaticObjectList::insert(), m_map, ServerActiveObject::m_static_block, ServerActiveObject::m_static_exists, MapBlock::m_static_objects, StaticObjectList::m_stored, MOD_REASON_UNKNOWN, MOD_STATE_WRITE_NEEDED, PP, MapBlock::raiseModified(), and warningstream.

Referenced by deactivateFarObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setNode()

bool ServerEnvironment::setNode ( v3s16  p,
const MapNode n 
)

◆ setStaticForActiveObjectsInBlock()

void ServerEnvironment::setStaticForActiveObjectsInBlock ( v3s16  blockpos,
bool  static_exists,
v3s16  static_block = v3s16(0,0,0) 
)

References errorstream, ActiveObjectMgr< T >::getActiveObject(), Map::getBlockNoCreateNoEx(), StaticObjectList::m_active, m_ao_manager, m_map, ServerActiveObject::m_static_block, ServerActiveObject::m_static_exists, and MapBlock::m_static_objects.

+ Here is the call graph for this function:

◆ step()

void ServerEnvironment::step ( f32  dtime)
virtual

Implements Environment.

References activateBlock(), ABMHandler::apply(), Profiler::avg(), BS, deactivateFarObjects(), ScriptApiEnv::environment_Step(), g_profiler, g_settings, Map::getBlockNoCreateNoEx(), ServerMap::getBlockOrEmerge(), MapBlock::getDiskTimestamp(), Settings::getFloat(), MapBlock::getNodeNoEx(), MapBlock::getPosRelative(), Settings::getS16(), getSendRecommendedInterval(), TimeTaker::getTimerTime(), MapBlock::getTimestamp(), ActiveBlockList::m_abm_list, m_abms, m_active_block_modifier_interval, m_active_blocks, m_active_blocks_management_interval, m_active_blocks_nodemetadata_interval, m_active_object_messages, m_ao_manager, Environment::m_cache_abm_interval, Environment::m_cache_abm_time_budget, Environment::m_cache_active_block_mgmt_interval, Environment::m_cache_nodetimer_interval, m_game_time, m_game_time_fraction_counter, ActiveBlockList::m_list, m_map, MapBlock::m_node_timers, m_object_management_interval, m_particle_management_interval, m_particle_spawners, m_players, m_recommended_send_interval, m_rgen, m_script, m_send_recommended_timer, m_server, MOD_REASON_BLOCK_EXPIRED, MOD_STATE_WRITE_AT_UNLOAD, ScriptApiNode::node_on_timer(), p(), PARTICLE_SPAWNER_NO_EXPIRY, PEER_ID_INEXISTENT, MapBlock::raiseModified(), removeRemovedObjects(), MapBlock::resetUsageTimer(), Server::sendDetachedInventories(), Server::SendInventory(), MapBlock::setNodeTimer(), MapBlock::setTimestamp(), MapBlock::setTimestampNoChangedFlag(), SPT_AVG, NodeTimerList::step(), server::ActiveObjectMgr::step(), IntervalLimiter::step(), Environment::stepTimeOfDay(), TimeTaker::stop(), ActiveBlockList::update(), and warningstream.

Referenced by Server::AsyncRunStep().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ swapNode()

bool ServerEnvironment::swapNode ( v3s16  p,
const MapNode n 
)

References Map::addNodeWithEvent(), m_map, p(), and ServerMap::updateVManip().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_abms

std::vector<ABMWithState> ServerEnvironment::m_abms
private

◆ m_active_block_modifier_interval

IntervalLimiter ServerEnvironment::m_active_block_modifier_interval
private

Referenced by step().

◆ m_active_blocks

ActiveBlockList ServerEnvironment::m_active_blocks
private

◆ m_active_blocks_management_interval

IntervalLimiter ServerEnvironment::m_active_blocks_management_interval
private

Referenced by step().

◆ m_active_blocks_nodemetadata_interval

IntervalLimiter ServerEnvironment::m_active_blocks_nodemetadata_interval
private

Referenced by step().

◆ m_active_object_messages

std::queue<ActiveObjectMessage> ServerEnvironment::m_active_object_messages
private

Referenced by getActiveObjectMessage(), and step().

◆ m_ao_manager

◆ m_auth_database

AuthDatabase* ServerEnvironment::m_auth_database = nullptr
private

◆ m_game_time

u32 ServerEnvironment::m_game_time = 0
private

◆ m_game_time_fraction_counter

float ServerEnvironment::m_game_time_fraction_counter = 0.0f
private

Referenced by step().

◆ m_last_clear_objects_time

u32 ServerEnvironment::m_last_clear_objects_time = 0
private

◆ m_lbm_mgr

LBMManager ServerEnvironment::m_lbm_mgr
private

◆ m_map

◆ m_max_lag_estimate

float ServerEnvironment::m_max_lag_estimate = 0.1f
private

◆ m_meta_loaded

bool ServerEnvironment::m_meta_loaded = false
private

Referenced by loadMeta(), and saveMeta().

◆ m_object_management_interval

IntervalLimiter ServerEnvironment::m_object_management_interval
private

Referenced by step().

◆ m_particle_management_interval

IntervalLimiter ServerEnvironment::m_particle_management_interval
private

Referenced by step().

◆ m_particle_spawner_attachments

std::unordered_map<u32, u16> ServerEnvironment::m_particle_spawner_attachments
private

◆ m_particle_spawners

std::unordered_map<u32, float> ServerEnvironment::m_particle_spawners
private

◆ m_path_world

const std::string ServerEnvironment::m_path_world
private

Referenced by loadMeta(), and saveMeta().

◆ m_player_database

PlayerDatabase* ServerEnvironment::m_player_database = nullptr
private

◆ m_players

◆ m_recommended_send_interval

float ServerEnvironment::m_recommended_send_interval = 0.1f
private

Referenced by getSendRecommendedInterval(), and step().

◆ m_rgen

std::mt19937 ServerEnvironment::m_rgen
private

Referenced by step().

◆ m_script

◆ m_send_recommended_timer

float ServerEnvironment::m_send_recommended_timer = 0.0f
private

Referenced by step().

◆ m_server


The documentation for this class was generated from the following files: