Merge pull request #2363 from akortunov/herbalism

Additional herbalism-related tweaks
pull/541/head
Alexei Dobrohotov 6 years ago committed by GitHub
commit a737935748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -89,6 +89,10 @@ namespace MWClass
ptr.get<ESM::Container>();
if (ref->mBase->mFlags & ESM::Container::Respawn)
{
// Container was not touched, there is no need to modify its content.
if (ptr.getRefData().getCustomData() == nullptr)
return;
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
ptr.getRefData().setCustomData(nullptr);
}

@ -1990,9 +1990,7 @@ namespace MWRender
mObjectRoot->accept(visitor);
}
if (ptr.getTypeName() == typeid(ESM::Container).name() &&
SceneUtil::hasUserDescription(mObjectRoot, Constants::HerbalismLabel) &&
ptr.getRefData().getCustomData() != nullptr)
if (ptr.getRefData().getCustomData() != nullptr && canBeHarvested())
{
const MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr);
if (!store.hasVisibleItems())

@ -3335,9 +3335,13 @@ namespace MWWorld
return true;
// Consider references inside containers as well (except if we are looking for a Creature, they cannot be in containers)
if (mType != World::Detect_Creature &&
(ptr.getClass().isActor() || ptr.getClass().getTypeName() == typeid(ESM::Container).name()))
bool isContainer = ptr.getClass().getTypeName() == typeid(ESM::Container).name();
if (mType != World::Detect_Creature && (ptr.getClass().isActor() || isContainer))
{
// but ignore containers without resolved content
if (isContainer && ptr.getRefData().getCustomData() == nullptr)
return true;
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr);
{
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)

Loading…
Cancel
Save