aboutsummaryrefslogtreecommitdiff
path: root/src/environment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/environment.cpp')
-rw-r--r--src/environment.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/environment.cpp b/src/environment.cpp
index 9748f6b71..81021ad83 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -741,8 +741,12 @@ void ServerEnvironment::clearAllObjects()
obj->m_removed = true;
continue;
}
+
+ // Tell the object about removal
+ obj->removingFromEnvironment();
// Deregister in scripting api
scriptapi_rm_object_reference(m_lua, obj);
+
// Delete active object
delete obj;
// Id to be removed from m_active_objects
@@ -1395,6 +1399,8 @@ void ServerEnvironment::removeRemovedObjects()
if(obj->m_known_by_count > 0)
continue;
+ // Tell the object about removal
+ obj->removingFromEnvironment();
// Deregister in scripting api
scriptapi_rm_object_reference(m_lua, obj);
@@ -1680,6 +1686,8 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete)
<<"object id="<<id<<" is not known by clients"
<<"; deleting"<<std::endl;
+ // Tell the object about removal
+ obj->removingFromEnvironment();
// Deregister in scripting api
scriptapi_rm_object_reference(m_lua, obj);