prevent activation, leave the rest to the script

new-script-api
rexelion 7 years ago
parent a9e5e19482
commit bcbfa5fe1e

@ -653,6 +653,9 @@ namespace MWGui
if (object.getClass().getName(object) == "") // objects without name presented to user can never be picked up
return;
if (!object.getRefData().activate())
return;
int count = object.getRefData().getCount();
MWWorld::Ptr player = MWMechanics::getPlayer();
@ -663,12 +666,6 @@ namespace MWGui
// add to player inventory
// 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);
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
MWBase::Environment::get().getWorld()->deleteObject (object);

@ -14,9 +14,6 @@ namespace MWWorld
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(
actor, getTarget(), MWWorld::Ptr(), getTarget().getRefData().getCount());
MWWorld::Ptr newitem = *actor.getClass().getContainerStore (actor).add (getTarget(), getTarget().getRefData().getCount(), actor);

@ -192,11 +192,6 @@ namespace MWWorld
return mEnabled;
}
bool RefData::hasSuppressActivate()
{
return mFlags & Flag_SuppressActivate;
}
void RefData::enable()
{
if (!mEnabled)

@ -111,8 +111,6 @@ namespace MWWorld
bool isEnabled() const;
bool hasSuppressActivate();
void enable();
void disable();

Loading…
Cancel
Save