diff options
Diffstat (limited to 'src/client/clientenvironment.cpp')
-rw-r--r-- | src/client/clientenvironment.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/client/clientenvironment.cpp b/src/client/clientenvironment.cpp index e1b20ec84..5eb033302 100644 --- a/src/client/clientenvironment.cpp +++ b/src/client/clientenvironment.cpp @@ -402,6 +402,23 @@ void ClientEnvironment::addActiveObject(u16 id, u8 type, } } + +void ClientEnvironment::removeActiveObject(u16 id) +{ + // Get current attachment childs to detach them visually + std::unordered_set<int> attachment_childs; + if (auto *obj = getActiveObject(id)) + attachment_childs = obj->getAttachmentChildIds(); + + m_ao_manager.removeObject(id); + + // Perform a proper detach in Irrlicht + for (auto c_id : attachment_childs) { + if (ClientActiveObject *child = getActiveObject(c_id)) + child->updateAttachments(); + } +} + void ClientEnvironment::processActiveObjectMessage(u16 id, const std::string &data) { ClientActiveObject *obj = getActiveObject(id); |