diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index f068812fa..b25305e03 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -22,6 +22,7 @@ #include "../mwmp/PlayerList.hpp" #include "../mwmp/CellController.hpp" #include "../mwmp/MechanicsHelper.hpp" +#include "../mwmp/WorldEvent.hpp" /* End of tes3mp addition */ @@ -1520,6 +1521,19 @@ namespace MWMechanics { MWBase::Environment::get().getWorld()->deleteObject(ptr); + /* + Start of tes3mp addition + + Send an ID_OBJECT_DELETE packet every time a summoned creature despawns + */ + mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); + worldEvent->reset(); + worldEvent->addObjectDelete(ptr); + worldEvent->sendObjectDelete(); + /* + End of tes3mp addition + */ + const ESM::Static* fx = MWBase::Environment::get().getWorld()->getStore().get() .search("VFX_Summon_End"); if (fx) diff --git a/apps/openmw/mwmechanics/summoning.cpp b/apps/openmw/mwmechanics/summoning.cpp index 0ba76ca81..fd3004406 100644 --- a/apps/openmw/mwmechanics/summoning.cpp +++ b/apps/openmw/mwmechanics/summoning.cpp @@ -175,6 +175,19 @@ namespace MWMechanics "", ptr.getRefData().getPosition().asVec3()); MWBase::Environment::get().getWorld()->deleteObject(ptr); + + /* + Start of tes3mp addition + + Send an ID_OBJECT_DELETE packet every time a summoned creature despawns + */ + mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent(); + worldEvent->reset(); + worldEvent->addObjectDelete(ptr); + worldEvent->sendObjectDelete(); + /* + End of tes3mp addition + */ } else ++it; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 7368d06b6..7a71d1cf8 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -3405,7 +3405,7 @@ namespace MWWorld worldEvent->addObjectSpawn(ptr); worldEvent->sendObjectSpawn(); - MWBase::Environment::get().getWorld()->deleteObject(ptr); + deleteObject(ptr); /* End of tes3mp change (major) */