mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
Remove attached sounds when the active object is removed (#14341)
This commit is contained in:
@@ -1253,10 +1253,7 @@ void ServerEnvironment::clearObjects(ClearObjectsMode mode)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Tell the object about removal
|
||||
obj->removingFromEnvironment();
|
||||
// Deregister in scripting api
|
||||
m_script->removeObjectReference(obj);
|
||||
processActiveObjectRemove(obj, id);
|
||||
|
||||
// Delete active object
|
||||
return true;
|
||||
@@ -1976,10 +1973,7 @@ void ServerEnvironment::removeRemovedObjects()
|
||||
}
|
||||
}
|
||||
|
||||
// Tell the object about removal
|
||||
obj->removingFromEnvironment();
|
||||
// Deregister in scripting api
|
||||
m_script->removeObjectReference(obj);
|
||||
processActiveObjectRemove(obj, id);
|
||||
|
||||
// Delete
|
||||
return true;
|
||||
@@ -2216,10 +2210,7 @@ void ServerEnvironment::deactivateFarObjects(bool _force_delete)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Tell the object about removal
|
||||
obj->removingFromEnvironment();
|
||||
// Deregister in scripting api
|
||||
m_script->removeObjectReference(obj);
|
||||
processActiveObjectRemove(obj, id);
|
||||
|
||||
// Delete active object
|
||||
return true;
|
||||
@@ -2282,6 +2273,16 @@ bool ServerEnvironment::saveStaticToBlock(
|
||||
return true;
|
||||
}
|
||||
|
||||
void ServerEnvironment::processActiveObjectRemove(ServerActiveObject *obj, u16 id)
|
||||
{
|
||||
// Tell the object about removal
|
||||
obj->removingFromEnvironment();
|
||||
// Deregister in scripting api
|
||||
m_script->removeObjectReference(obj);
|
||||
// stop attached sounds
|
||||
m_server->stopAttachedSounds(id);
|
||||
}
|
||||
|
||||
PlayerDatabase *ServerEnvironment::openPlayerDatabase(const std::string &name,
|
||||
const std::string &savedir, const Settings &conf)
|
||||
{
|
||||
|
Reference in New Issue
Block a user