You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/apps/openmw/mwworld/actiontake.cpp

52 lines
1.5 KiB
C++

#include "actiontake.hpp"
/*
Start of tes3mp addition
Include additional headers for multiplayer purposes
*/
#include "../mwmp/Main.hpp"
#include "../mwmp/Networking.hpp"
#include "../mwmp/ObjectList.hpp"
/*
End of tes3mp addition
*/
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "class.hpp"
#include "containerstore.hpp"
namespace MWWorld
{
ActionTake::ActionTake (const MWWorld::Ptr& object) : Action (true, object) {}
void ActionTake::executeImp (const Ptr& actor)
{
MWBase::Environment::get().getMechanicsManager()->itemTaken(
actor, getTarget(), MWWorld::Ptr(), getTarget().getRefData().getCount());
MWWorld::Ptr newitem = *actor.getClass().getContainerStore (actor).add (getTarget(), getTarget().getRefData().getCount(), actor);
/*
Start of tes3mp addition
Send an ID_OBJECT_DELETE packet every time an item is taken from the world
by the player outside of the inventory screen
*/
mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
objectList->reset();
objectList->packetOrigin = mwmp::CLIENT_GAMEPLAY;
objectList->addObjectDelete(getTarget());
objectList->sendObjectDelete();
/*
End of tes3mp addition
*/
MWBase::Environment::get().getWorld()->deleteObject (getTarget());
setTarget(newitem);
}
}