Add ClientObjectRef:remove and return true in on_object_add callback to remove newly added object

This commit is contained in:
Elias Fleckenstein
2021-09-19 18:55:25 +02:00
parent fb4815c660
commit 950d2c9b3e
4 changed files with 10 additions and 5 deletions

View File

@@ -822,8 +822,11 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
setNodeLight(m_last_light);
updateMeshCulling();
if (m_client->modsLoaded())
m_client->getScript()->on_object_add(m_id);
if (m_client->modsLoaded() && m_client->getScript()->on_object_add(m_id)) {
removeFromScene(false);
return;
}
if (m_client->modsLoaded())
m_client->getScript()->on_object_properties_change(m_id);