#include <clientenvironment.h>
Public Member Functions | |
ClientEnvironment (irr_ptr< ClientMap > map, ITextureSource *texturesource, Client *client) | |
~ClientEnvironment () | |
Map & | getMap () |
ClientMap & | getClientMap () |
Client * | getGameDef () |
void | setScript (ClientScripting *script) |
void | step (f32 dtime) |
virtual void | setLocalPlayer (LocalPlayer *player) |
LocalPlayer * | getLocalPlayer () const |
void | addSimpleObject (ClientSimpleObject *simple) |
GenericCAO * | getGenericCAO (u16 id) |
ClientActiveObject * | getActiveObject (u16 id) |
u16 | addActiveObject (std::unique_ptr< ClientActiveObject > object) |
void | addActiveObject (u16 id, u8 type, const std::string &init_data) |
void | removeActiveObject (u16 id) |
void | processActiveObjectMessage (u16 id, const std::string &data) |
void | damageLocalPlayer (u16 damage, bool handle_hp=true) |
void | getActiveObjects (const v3f &origin, f32 max_d, std::vector< DistanceSortedActiveObject > &dest) |
bool | hasClientEnvEvents () const |
ClientEnvEvent | getClientEnvEvent () |
virtual void | getSelectedActiveObjects (const core::line3d< f32 > &shootline_on_map, std::vector< PointedThing > &objects, const std::optional< Pointabilities > &pointabilities) |
const std::set< std::string > & | getPlayerNames () |
void | addPlayerName (const std::string &name) |
void | removePlayerName (const std::string &name) |
void | updateCameraOffset (const v3s16 &camera_offset) |
v3s16 | getCameraOffset () const |
void | updateFrameTime (bool is_paused) |
u64 | getFrameTime () const |
u64 | getFrameTimeDelta () const |
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) |
IGameDef * | getGameDef () |
Private Attributes | |
irr_ptr< ClientMap > | m_map |
LocalPlayer * | m_local_player = nullptr |
ITextureSource * | m_texturesource |
Client * | m_client |
ClientScripting * | m_script = nullptr |
client::ActiveObjectMgr | m_ao_manager |
std::vector< ClientSimpleObject * > | m_simple_objects |
std::queue< ClientEnvEvent > | m_client_event_queue |
IntervalLimiter | m_active_object_light_update_interval |
std::set< std::string > | m_player_names |
v3s16 | m_camera_offset |
u64 | m_frame_time = 0 |
u64 | m_frame_dtime = 0 |
u64 | m_frame_time_pause_accumulator = 0 |
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 |
float | m_cache_active_block_mgmt_interval |
float | m_cache_abm_interval |
float | m_cache_nodetimer_interval |
float | m_cache_abm_time_budget |
IGameDef * | m_gamedef |
ClientEnvironment::ClientEnvironment | ( | irr_ptr< ClientMap > | map, |
ITextureSource * | texturesource, | ||
Client * | client ) |
ClientEnvironment::~ClientEnvironment | ( | ) |
References ActiveObjectMgr< T >::clear(), m_ao_manager, m_local_player, m_map, and m_simple_objects.
u16 ClientEnvironment::addActiveObject | ( | std::unique_ptr< ClientActiveObject > | object | ) |
References ClientActiveObject::addToScene(), Environment::getDayNightRatio(), Client::getSceneManager(), m_ao_manager, m_client, m_texturesource, and client::ActiveObjectMgr::registerObject().
Referenced by addActiveObject(), and Client::handleCommand_ActiveObjectRemoveAdd().
void ClientEnvironment::addActiveObject | ( | u16 | id, |
u8 | type, | ||
const std::string & | init_data ) |
References addActiveObject(), ClientActiveObject::create(), errorstream, getActiveObject(), infostream, m_client, serializeJsonString(), and BaseException::what().
|
inline |
References m_player_names.
Referenced by Client::handleCommand_UpdatePlayerList().
void ClientEnvironment::addSimpleObject | ( | ClientSimpleObject * | simple | ) |
References m_simple_objects.
Referenced by GenericCAO::directReportPunch(), and GenericCAO::processMessage().
void ClientEnvironment::damageLocalPlayer | ( | u16 | damage, |
bool | handle_hp = true ) |
References CEE_PLAYER_DAMAGE, getLocalPlayer(), LocalPlayer::hp, m_client_event_queue, and ClientEnvEvent::type.
Referenced by step().
|
inline |
References ActiveObjectMgr< T >::getActiveObject(), and m_ao_manager.
Referenced by addActiveObject(), GenericCAO::clearChildAttachments(), getGenericCAO(), GenericCAO::getParent(), Client::handleCommand_PlaySound(), processActiveObjectMessage(), removeActiveObject(), GenericCAO::setAttachment(), Client::step(), and GenericCAO::step().
|
inline |
References client::ActiveObjectMgr::getActiveObjects(), and m_ao_manager.
Referenced by add_object_boxes().
|
inline |
References m_camera_offset.
Referenced by GenericCAO::getPosition(), ParticleSpawner::spawnParticle(), GenericCAO::updateAttachments(), GenericCAO::updateNodePos(), and Particle::updateVertices().
ClientEnvEvent ClientEnvironment::getClientEnvEvent | ( | ) |
References FATAL_ERROR_IF, and m_client_event_queue.
Referenced by Client::step().
ClientMap & ClientEnvironment::getClientMap | ( | ) |
References m_map.
Referenced by Client::interact(), MapPostFxStep::run(), Client::sendPlayerPos(), Camera::update(), Particle::updateLight(), and Game::updatePointedThing().
|
inline |
References m_frame_time.
Referenced by GameGlobalShaderConstantSetter::onSetConstants().
|
inline |
References m_frame_dtime.
Referenced by GameGlobalShaderConstantSetter::onSetConstants().
|
inline |
References m_client.
Referenced by SmokePuffCSO::SmokePuffCSO(), ParticleManager::handleParticleEvent(), ParticleSpawner::spawnParticle(), GenericCAO::step(), Particle::step(), and Particle::updateLight().
GenericCAO * ClientEnvironment::getGenericCAO | ( | u16 | id | ) |
References ACTIVEOBJECT_TYPE_GENERIC, getActiveObject(), and ActiveObject::getType().
Referenced by GenericCAO::setChildrenVisible(), and ParticleSpawner::step().
|
inline |
References m_local_player.
Referenced by add_object_boxes(), Client::afterContentReceived(), Client::CSMClampPos(), Client::CSMClampRadius(), Client::CSMGetNode(), damageLocalPlayer(), PlayerInventoryFormSource::getForm(), Client::getFormspecPrepend(), Client::getHP(), Client::getInventory(), Client::handleCommand_AuthAccept(), Client::handleCommand_Breath(), Client::handleCommand_EyeOffset(), Client::handleCommand_FormspecPrepend(), Client::handleCommand_Fov(), Client::handleCommand_HP(), Client::handleCommand_HudSetFlags(), Client::handleCommand_HudSetParam(), Client::handleCommand_Inventory(), Client::handleCommand_InventoryFormSpec(), Client::handleCommand_LocalPlayerAnimations(), Client::handleCommand_Movement(), Client::handleCommand_MovePlayer(), Client::handleCommand_MovePlayerRel(), Client::handleCommand_PlayerSpeed(), Client::handleCommand_SetLighting(), Client::interact(), Client::loadMods(), Camera::notifyFovChange(), GameGlobalShaderConstantSetter::onSetConstants(), GenericCAO::processInitData(), GenericCAO::processMessage(), Client::sendChangePassword(), Client::sendPlayerPos(), Client::setPlayerControl(), Client::setPlayerItem(), Client::startAuth(), Client::step(), step(), GenericCAO::step(), Particle::updateVertices(), and Client::updateWieldedItem().
|
virtual |
Implements Environment.
References m_map.
Referenced by SmokePuffCSO::SmokePuffCSO(), Client::addNode(), Client::addUpdateMeshTask(), Client::addUpdateMeshTaskForNode(), Client::addUpdateMeshTaskWithEdge(), Client::CSMGetNode(), Client::getInventory(), Client::handleCommand_BlockData(), Client::handleCommand_NodemetaChanged(), Client::removeNode(), ShadowRenderer::renderShadowMap(), Client::step(), GenericCAO::step(), and GenericCAO::updateLight().
|
inline |
References m_player_names.
Referenced by Client::getConnectedPlayerNames().
|
virtual |
Gets the objects pointed by the shootline as pointed things. If this is a client environment, the local player won't be returned.
[in] | shootline_on_map | the shootline for the test in world coordinates |
[out] | objects | found objects |
Implements Environment.
References boxLineCollision(), client::ActiveObjectMgr::getActiveSelectableObjects(), GenericCAO::getGroups(), ActiveObject::getId(), GenericCAO::getName(), ClientActiveObject::getPosition(), GenericCAO::getProperties(), ClientActiveObject::getSceneNode(), GenericCAO::getSceneNode(), ClientActiveObject::getSelectionBox(), GenericCAO::isPlayer(), m_ao_manager, ObjectProperties::pointable, POINTABLE_NOT, and ObjectProperties::rotate_selectionbox.
|
inline |
References m_client_event_queue.
Referenced by Client::step().
void ClientEnvironment::processActiveObjectMessage | ( | u16 | id, |
const std::string & | data ) |
References errorstream, getActiveObject(), ActiveObject::getType(), infostream, ClientActiveObject::processMessage(), and BaseException::what().
Referenced by Client::handleCommand_ActiveObjectMessages().
void ClientEnvironment::removeActiveObject | ( | u16 | id | ) |
References getActiveObject(), m_ao_manager, and client::ActiveObjectMgr::removeObject().
Referenced by Client::handleCommand_ActiveObjectRemoveAdd().
|
inline |
References m_player_names.
Referenced by Client::handleCommand_UpdatePlayerList().
|
virtual |
References FATAL_ERROR_IF, and m_local_player.
Referenced by Client::Client().
|
inline |
|
virtual |
Implements Environment.
References LocalPlayer::applyControl(), Profiler::avg(), BS, Client::checkLocalPrivilege(), COLLISION_NODE, CONTENT_AIR, damageLocalPlayer(), encode_light(), ScriptApiClient::environment_step(), final_color_blend(), g_profiler, g_settings, Settings::getBool(), LocalPlayer::getCAO(), Environment::getDayNightRatio(), Client::getEventManager(), GenericCAO::getGroups(), getInteriorLight(), LocalPlayer::getLightPosition(), getLocalPlayer(), Player::getSpeed(), LocalPlayer::gravity, PlayerPhysicsOverride::gravity, ContentFeatures::groups, LocalPlayer::in_liquid, LocalPlayer::in_liquid_stable, LocalPlayer::is_climbing, GenericCAO::isImmortal(), itemgroup_get(), LocalPlayer::light_color, PlayerPhysicsOverride::liquid_fluidity, PlayerPhysicsOverride::liquid_fluidity_smooth, PlayerPhysicsOverride::liquid_sink, m_active_object_light_update_interval, m_ao_manager, m_client, m_map, m_script, m_simple_objects, ClientSimpleObject::m_to_be_removed, Client::modsLoaded(), LocalPlayer::move(), LocalPlayer::move_resistance, Player::movement_gravity, Player::movement_liquid_fluidity, Player::movement_liquid_fluidity_smooth, Player::movement_liquid_sink, MYMAX, MYMIN, IGameDef::ndef(), p(), Player::physics_override, MtEvent::PLAYER_FALLING_DAMAGE, MtEventManager::put(), Player::setSpeed(), client::ActiveObjectMgr::step(), ClientSimpleObject::step(), IntervalLimiter::step(), Environment::stepTimeOfDay(), LocalPlayer::swimming_pitch, LocalPlayer::swimming_vertical, and U16_MAX.
Referenced by Client::step().
|
inline |
References m_camera_offset.
void ClientEnvironment::updateFrameTime | ( | bool | is_paused | ) |
References porting::getTimeMs(), m_frame_dtime, m_frame_time, m_frame_time_pause_accumulator, and MYMAX.
|
private |
Referenced by step().
|
private |
Referenced by ~ClientEnvironment(), addActiveObject(), getActiveObject(), getActiveObjects(), getSelectedActiveObjects(), removeActiveObject(), and step().
|
private |
Referenced by getCameraOffset(), and updateCameraOffset().
|
private |
Referenced by addActiveObject(), addActiveObject(), getGameDef(), and step().
|
private |
Referenced by damageLocalPlayer(), getClientEnvEvent(), and hasClientEnvEvents().
|
private |
Referenced by getFrameTimeDelta(), and updateFrameTime().
|
private |
Referenced by getFrameTime(), and updateFrameTime().
|
private |
Referenced by updateFrameTime().
|
private |
Referenced by ~ClientEnvironment(), getLocalPlayer(), and setLocalPlayer().
|
private |
Referenced by ~ClientEnvironment(), getClientMap(), getMap(), and step().
|
private |
Referenced by addPlayerName(), getPlayerNames(), and removePlayerName().
|
private |
Referenced by setScript(), and step().
|
private |
Referenced by ~ClientEnvironment(), addSimpleObject(), and step().
|
private |
Referenced by addActiveObject().