-autosneak (AutoSneak) bool false
+autosneak (AutoSneak) bool false
m_active_objects.find(id);
return (n != m_active_objects.end() ? n->second : nullptr);
}
-
+
+ std::unordered_map<u16, T *> getAllActiveObjects() const
+ {
+ return m_active_objects;
+ }
+
protected:
u16 getFreeId() const
{
void Client::sendPlayerPos(v3f pos)
{
- if (g_settings->getBool("freecam"))
- return;
-
LocalPlayer *player = m_env.getLocalPlayer();
if (!player)
return;
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 &&
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;
LocalPlayer *player = m_env.getLocalPlayer();
if (!player)
return;
- sendPlayerPos(player->getPosition());
+ sendPlayerPos(player->getLegitPosition());
}
void Client::removeNode(v3s16 p)
MapBlockVect blocks;
sector->getBlocks(blocks);
for (MapBlock *block : blocks) {
- addUpdateMeshTask(block->getPos(), false, true);
+ addUpdateMeshTask(block->getPos(), false, false);
}
}
}
{
return m_ao_manager.getActiveObject(id);
}
+
+ std::unordered_map<u16, ClientActiveObject*> getAllActiveObjects()
+ {
+ return m_ao_manager.getAllActiveObjects();
+ }
/*
Adds an active object to the environment.
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; }
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,
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<DistanceSortedActiveObject> 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));
}
}