diff --git a/clientmods/dragonfire/autosneak/settingtypes.txt b/clientmods/dragonfire/autosneak/settingtypes.txt index 6b588143e..787076970 100644 --- a/clientmods/dragonfire/autosneak/settingtypes.txt +++ b/clientmods/dragonfire/autosneak/settingtypes.txt @@ -1 +1 @@ -autosneak (AutoSneak) bool false +autosneak (AutoSneak) bool false diff --git a/src/activeobjectmgr.h b/src/activeobjectmgr.h index 95e7d3344..8c4630c79 100644 --- a/src/activeobjectmgr.h +++ b/src/activeobjectmgr.h @@ -41,7 +41,12 @@ public: m_active_objects.find(id); return (n != m_active_objects.end() ? n->second : nullptr); } - + + std::unordered_map getAllActiveObjects() const + { + return m_active_objects; + } + protected: u16 getFreeId() const { diff --git a/src/client/client.cpp b/src/client/client.cpp index bbc32c6d4..d3e7a278d 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -1289,9 +1289,6 @@ void Client::sendReady() void Client::sendPlayerPos(v3f pos) { - if (g_settings->getBool("freecam")) - return; - LocalPlayer *player = m_env.getLocalPlayer(); if (!player) return; @@ -1309,7 +1306,7 @@ void Client::sendPlayerPos(v3f pos) if ( player->last_position == pos && - player->last_speed == player->getSpeed() && + player->last_speed == player->getLegitSpeed() && player->last_pitch == player->getPitch() && player->last_yaw == player->getYaw() && player->last_keyPressed == player->keyPressed && @@ -1318,7 +1315,7 @@ void Client::sendPlayerPos(v3f pos) return; player->last_position = pos; - player->last_speed = player->getSpeed(); + player->last_speed = player->getLegitSpeed(); player->last_pitch = player->getPitch(); player->last_yaw = player->getYaw(); player->last_keyPressed = player->keyPressed; @@ -1337,7 +1334,7 @@ void Client::sendPlayerPos() LocalPlayer *player = m_env.getLocalPlayer(); if (!player) return; - sendPlayerPos(player->getPosition()); + sendPlayerPos(player->getLegitPosition()); } void Client::removeNode(v3s16 p) @@ -1678,7 +1675,7 @@ void Client::updateAllMapBlocks() MapBlockVect blocks; sector->getBlocks(blocks); for (MapBlock *block : blocks) { - addUpdateMeshTask(block->getPos(), false, true); + addUpdateMeshTask(block->getPos(), false, false); } } } diff --git a/src/client/clientenvironment.h b/src/client/clientenvironment.h index 864496a41..52d999c99 100644 --- a/src/client/clientenvironment.h +++ b/src/client/clientenvironment.h @@ -92,6 +92,11 @@ public: { return m_ao_manager.getActiveObject(id); } + + std::unordered_map getAllActiveObjects() + { + return m_ao_manager.getAllActiveObjects(); + } /* Adds an active object to the environment. diff --git a/src/client/clientobject.h b/src/client/clientobject.h index ecd8059ef..19f8e3b72 100644 --- a/src/client/clientobject.h +++ b/src/client/clientobject.h @@ -44,6 +44,7 @@ public: virtual void updateLight(u32 day_night_ratio) {} + virtual bool isItem() const { return false; } virtual bool getCollisionBox(aabb3f *toset) const { return false; } virtual bool getSelectionBox(aabb3f *toset) const { return false; } virtual bool collideWithObjects() const { return false; } diff --git a/src/client/content_cao.h b/src/client/content_cao.h index 88aa4870c..51b58b030 100644 --- a/src/client/content_cao.h +++ b/src/client/content_cao.h @@ -215,6 +215,8 @@ public: m_is_visible = toset; } + bool isItem() const { return m_prop.visual == "wielditem" || m_prop.visual == "item"; } + void setChildrenVisible(bool toset); void setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation); void getAttachment(int *parent_id, std::string *bone, v3f *position, diff --git a/src/gui/tracers.cpp b/src/gui/tracers.cpp index b1f7b15c0..ee41d0fb0 100644 --- a/src/gui/tracers.cpp +++ b/src/gui/tracers.cpp @@ -26,16 +26,17 @@ with this program; if not, write to the Free Software Foundation, Inc., void Tracers::draw(video::IVideoDriver* driver, Client *client) { ClientEnvironment &env = client->getEnv(); - LocalPlayer *player = env.getLocalPlayer(); Camera *camera = client->getCamera(); - v3f player_pos = player->getPosition(); v3f head_pos = camera->getPosition() + camera->getDirection(); - std::vector allObjects; - env.getActiveObjects(player_pos, 1000000, allObjects); - for (const auto &allObject : allObjects) { - ClientActiveObject *obj = allObject.obj; - if (obj->isLocalPlayer() || obj->getParent()) + auto allObjects = env.getAllActiveObjects(); + for (auto &it : allObjects) { + ClientActiveObject *obj = it.second; + if (obj->isLocalPlayer() || obj->getParent() || obj->isItem()) continue; - driver->draw3DLine(head_pos, obj->getPosition(), video::SColor(255, 255, 255, 255)); + v3f pos = obj->getPosition(); + aabb3f box; + if (obj->getSelectionBox(&box)) + pos += box.getCenter(); + driver->draw3DLine(head_pos, pos, video::SColor(255, 255, 255, 255)); } }