1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:53:51 +00:00

[Client] Handle reenabling of harvested objects via Container packet

It is no longer necessary to send ObjectState packets when harvesting objects, as the Container packet will handle the refreshing of those objects' animations instead.
This commit is contained in:
David Cernat 2021-04-06 13:22:17 +02:00
parent b2328b7063
commit a7f517507c
2 changed files with 7 additions and 23 deletions

View file

@ -293,6 +293,13 @@ void ObjectList::editContainers(MWWorld::CellStore* cellStore)
mwmp::Main::get().getCellController()->getLocalActor(ptrFound)->updateEquipment(true, true); mwmp::Main::get().getCellController()->getLocalActor(ptrFound)->updateEquipment(true, true);
} }
// If this container can be harvested, disable and then enable it again to refresh its animation
if (ptrFound.getClass().canBeHarvested(ptrFound))
{
MWBase::Environment::get().getWorld()->disable(ptrFound);
MWBase::Environment::get().getWorld()->enable(ptrFound);
}
// If this container was open for us, update its view // If this container was open for us, update its view
if (isCurrentContainer) if (isCurrentContainer)
{ {

View file

@ -146,28 +146,5 @@ namespace MWWorld
// Update animation object // Update animation object
MWBase::Environment::get().getWorld()->disable(target); MWBase::Environment::get().getWorld()->disable(target);
MWBase::Environment::get().getWorld()->enable(target); MWBase::Environment::get().getWorld()->enable(target);
/*
Start of tes3mp addition
Send ID_OBJECT_STATE packets whenever an object is harvested, as long as
the player is logged in on the server
*/
if (mwmp::Main::get().getLocalPlayer()->isLoggedIn())
{
mwmp::ObjectList* objectList = mwmp::Main::get().getNetworking()->getObjectList();
objectList->reset();
objectList->packetOrigin = mwmp::CLIENT_GAMEPLAY;
objectList->addObjectState(target, false);
objectList->sendObjectState();
objectList->reset();
objectList->packetOrigin = mwmp::CLIENT_GAMEPLAY;
objectList->addObjectState(target, true);
objectList->sendObjectState();
}
/*
End of tes3mp addition
*/
} }
} }