mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 10:36:42 +00:00
Remove container scripts before deleting container
This commit is contained in:
parent
69ccca490e
commit
271fcb80c6
7 changed files with 9 additions and 2 deletions
|
@ -549,6 +549,8 @@ namespace MWBase
|
||||||
|
|
||||||
/// Return the distance between actor's weapon and target's collision box.
|
/// Return the distance between actor's weapon and target's collision box.
|
||||||
virtual float getHitDistance(const MWWorld::Ptr& actor, const MWWorld::Ptr& target) = 0;
|
virtual float getHitDistance(const MWWorld::Ptr& actor, const MWWorld::Ptr& target) = 0;
|
||||||
|
|
||||||
|
virtual void removeContainerScripts(const MWWorld::Ptr& reference) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ namespace MWClass
|
||||||
ptr.get<ESM::Container>();
|
ptr.get<ESM::Container>();
|
||||||
if (ref->mBase->mFlags & ESM::Container::Respawn)
|
if (ref->mBase->mFlags & ESM::Container::Respawn)
|
||||||
{
|
{
|
||||||
|
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
|
||||||
ptr.getRefData().setCustomData(NULL);
|
ptr.getRefData().setCustomData(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -762,6 +762,7 @@ namespace MWClass
|
||||||
// Reset to original position
|
// Reset to original position
|
||||||
ptr.getRefData().setPosition(ptr.getCellRef().getPosition());
|
ptr.getRefData().setPosition(ptr.getCellRef().getPosition());
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
|
||||||
ptr.getRefData().setCustomData(NULL);
|
ptr.getRefData().setCustomData(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1224,6 +1224,7 @@ namespace MWClass
|
||||||
// Reset to original position
|
// Reset to original position
|
||||||
ptr.getRefData().setPosition(ptr.getCellRef().getPosition());
|
ptr.getRefData().setPosition(ptr.getCellRef().getPosition());
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
|
||||||
ptr.getRefData().setCustomData(NULL);
|
ptr.getRefData().setCustomData(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1127,6 +1127,7 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->undeleteObject(ptr);
|
MWBase::Environment::get().getWorld()->undeleteObject(ptr);
|
||||||
// resets runtime state such as inventory, stats and AI. does not reset position in the world
|
// resets runtime state such as inventory, stats and AI. does not reset position in the world
|
||||||
|
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
|
||||||
ptr.getRefData().setCustomData(NULL);
|
ptr.getRefData().setCustomData(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace MWWorld
|
||||||
void remove (RefData *ref);
|
void remove (RefData *ref);
|
||||||
|
|
||||||
void remove (const Ptr& ptr);
|
void remove (const Ptr& ptr);
|
||||||
///< Remove script for given reference (ignored if reference does not have a scirpt listed).
|
///< Remove script for given reference (ignored if reference does not have a script listed).
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,8 +129,9 @@ namespace MWWorld
|
||||||
void updateWindowManager ();
|
void updateWindowManager ();
|
||||||
void updatePlayer(bool paused);
|
void updatePlayer(bool paused);
|
||||||
MWWorld::Ptr getFacedObject(float maxDistance, bool ignorePlayer=true);
|
MWWorld::Ptr getFacedObject(float maxDistance, bool ignorePlayer=true);
|
||||||
|
public: // FIXME
|
||||||
void removeContainerScripts(const Ptr& reference);
|
void removeContainerScripts(const Ptr& reference);
|
||||||
|
private:
|
||||||
void addContainerScripts(const Ptr& reference, CellStore* cell);
|
void addContainerScripts(const Ptr& reference, CellStore* cell);
|
||||||
void PCDropped (const Ptr& item);
|
void PCDropped (const Ptr& item);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue