forked from teamnwah/openmw-tes3coop
prevent activation, leave the rest to the script
This commit is contained in:
parent
a9e5e19482
commit
bcbfa5fe1e
4 changed files with 3 additions and 16 deletions
|
@ -653,6 +653,9 @@ namespace MWGui
|
||||||
if (object.getClass().getName(object) == "") // objects without name presented to user can never be picked up
|
if (object.getClass().getName(object) == "") // objects without name presented to user can never be picked up
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!object.getRefData().activate())
|
||||||
|
return;
|
||||||
|
|
||||||
int count = object.getRefData().getCount();
|
int count = object.getRefData().getCount();
|
||||||
|
|
||||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
|
@ -663,12 +666,6 @@ namespace MWGui
|
||||||
// add to player inventory
|
// add to player inventory
|
||||||
// can't use ActionTake here because we need an MWWorld::Ptr to the newly inserted object
|
// can't use ActionTake here because we need an MWWorld::Ptr to the newly inserted object
|
||||||
MWWorld::Ptr newObject = *player.getClass().getContainerStore (player).add (object, object.getRefData().getCount(), player);
|
MWWorld::Ptr newObject = *player.getClass().getContainerStore (player).add (object, object.getRefData().getCount(), player);
|
||||||
|
|
||||||
if (object.getRefData().hasSuppressActivate()) // if Flag_SuppressActivate is set, script that contains OnActivate is attached to the item
|
|
||||||
{
|
|
||||||
newObject.getRefData().onActivate(); // set the flag_SuppressActivate flag for the new item
|
|
||||||
newObject.getRefData().activate();
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove from world
|
// remove from world
|
||||||
MWBase::Environment::get().getWorld()->deleteObject (object);
|
MWBase::Environment::get().getWorld()->deleteObject (object);
|
||||||
|
|
|
@ -14,9 +14,6 @@ namespace MWWorld
|
||||||
|
|
||||||
void ActionTake::executeImp (const Ptr& actor)
|
void ActionTake::executeImp (const Ptr& actor)
|
||||||
{
|
{
|
||||||
//No need to do anything if moving items from the player's inventory back into player's inventory
|
|
||||||
if (actor == MWBase::Environment::get().getWorld()->getPlayerPtr() && getTarget().getCell() == 0)
|
|
||||||
return;
|
|
||||||
MWBase::Environment::get().getMechanicsManager()->itemTaken(
|
MWBase::Environment::get().getMechanicsManager()->itemTaken(
|
||||||
actor, getTarget(), MWWorld::Ptr(), getTarget().getRefData().getCount());
|
actor, getTarget(), MWWorld::Ptr(), getTarget().getRefData().getCount());
|
||||||
MWWorld::Ptr newitem = *actor.getClass().getContainerStore (actor).add (getTarget(), getTarget().getRefData().getCount(), actor);
|
MWWorld::Ptr newitem = *actor.getClass().getContainerStore (actor).add (getTarget(), getTarget().getRefData().getCount(), actor);
|
||||||
|
|
|
@ -192,11 +192,6 @@ namespace MWWorld
|
||||||
return mEnabled;
|
return mEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RefData::hasSuppressActivate()
|
|
||||||
{
|
|
||||||
return mFlags & Flag_SuppressActivate;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RefData::enable()
|
void RefData::enable()
|
||||||
{
|
{
|
||||||
if (!mEnabled)
|
if (!mEnabled)
|
||||||
|
|
|
@ -111,8 +111,6 @@ namespace MWWorld
|
||||||
|
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
|
|
||||||
bool hasSuppressActivate();
|
|
||||||
|
|
||||||
void enable();
|
void enable();
|
||||||
|
|
||||||
void disable();
|
void disable();
|
||||||
|
|
Loading…
Reference in a new issue