mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Remove attached sounds when the active object is removed (#14341)
This commit is contained in:
parent
39b1311a1b
commit
63a9853811
7 changed files with 44 additions and 12 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue