2012-04-15 17:52:39 +02:00
|
|
|
#include "actionopen.hpp"
|
|
|
|
|
2012-05-11 11:52:07 +02:00
|
|
|
#include "../mwbase/environment.hpp"
|
2018-09-22 12:57:50 +04:00
|
|
|
#include "../mwbase/mechanicsmanager.hpp"
|
2012-08-12 18:11:09 +02:00
|
|
|
#include "../mwbase/windowmanager.hpp"
|
2012-07-03 12:30:50 +02:00
|
|
|
|
2022-06-26 16:42:29 +02:00
|
|
|
#include "../mwmechanics/actorutil.hpp"
|
2014-01-03 23:33:14 +01:00
|
|
|
#include "../mwmechanics/disease.hpp"
|
|
|
|
|
2012-04-15 17:52:39 +02:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
2017-09-22 21:26:41 +02:00
|
|
|
ActionOpen::ActionOpen(const MWWorld::Ptr& container)
|
2013-03-07 14:00:13 +01:00
|
|
|
: Action(false, container)
|
2012-09-04 15:29:51 +02:00
|
|
|
{
|
2012-04-15 17:52:39 +02:00
|
|
|
}
|
|
|
|
|
2013-02-17 15:56:22 +01:00
|
|
|
void ActionOpen::executeImp(const MWWorld::Ptr& actor)
|
2012-04-15 17:52:39 +02:00
|
|
|
{
|
2012-05-25 18:45:17 +02:00
|
|
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
2013-02-17 15:56:22 +01:00
|
|
|
return;
|
2012-05-25 18:45:17 +02:00
|
|
|
|
2019-11-18 12:41:11 +04:00
|
|
|
if (actor != MWMechanics::getPlayer())
|
|
|
|
return;
|
|
|
|
|
2018-09-22 12:57:50 +04:00
|
|
|
if (!MWBase::Environment::get().getMechanicsManager()->onOpen(getTarget()))
|
|
|
|
return;
|
|
|
|
|
2014-01-03 23:33:14 +01:00
|
|
|
MWMechanics::diseaseContact(actor, getTarget());
|
|
|
|
|
2017-09-22 21:26:41 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Container, getTarget());
|
2012-04-15 17:52:39 +02:00
|
|
|
}
|
|
|
|
}
|