mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 17:15:32 +00:00
check the presence of OnActivate using the SuppressActivate flag instead of looking for keywords
This commit is contained in:
parent
4e6f53d6f1
commit
e8743f3f79
6 changed files with 8 additions and 16 deletions
|
@ -42,10 +42,6 @@ namespace MWBase
|
|||
///< Compile script with the given namen
|
||||
/// \return Success?
|
||||
|
||||
virtual bool hasOnActivate (const std::string& name) = 0;
|
||||
///< Determine if a script with the given name contains OnActivate
|
||||
/// \return Contains OnActivate?
|
||||
|
||||
virtual std::pair<int, int> compileAll() = 0;
|
||||
///< Compile all scripts
|
||||
/// \return count, success
|
||||
|
|
|
@ -663,8 +663,7 @@ namespace MWGui
|
|||
if (object.getClass().getName(object) == "") // objects without name presented to user can never be picked up
|
||||
return;
|
||||
|
||||
std::string scriptName = object.getClass().getScript(object); // Objects that have OnActivte in their script cannot be picked up through inventory
|
||||
if (!scriptName.empty() && MWBase::Environment::get().getScriptManager()->hasOnActivate(scriptName))
|
||||
if (object.getRefData().hasSuppressActivate()) // if Flag_SuppressActivate is set, script that contains OnActivate is attached to the item
|
||||
{
|
||||
if (std::find(mItemsToActivate.begin(), mItemsToActivate.end(), object) == mItemsToActivate.end())
|
||||
{
|
||||
|
|
|
@ -88,12 +88,6 @@ namespace MWScript
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ScriptManager::hasOnActivate(const std::string& name)
|
||||
{
|
||||
const ESM::Script *script = mStore.get<ESM::Script>().find(name);
|
||||
return script->mScriptText.find("OnActivate");
|
||||
}
|
||||
|
||||
void ScriptManager::run (const std::string& name, Interpreter::Context& interpreterContext)
|
||||
{
|
||||
// compile script
|
||||
|
|
|
@ -62,10 +62,6 @@ namespace MWScript
|
|||
///< Compile script with the given namen
|
||||
/// \return Success?
|
||||
|
||||
virtual bool hasOnActivate(const std::string& name);
|
||||
///< Determine if a script with the given name contains OnActivate
|
||||
/// \return Contains OnActivate?
|
||||
|
||||
virtual std::pair<int, int> compileAll();
|
||||
///< Compile all scripts
|
||||
/// \return count, success
|
||||
|
|
|
@ -192,6 +192,11 @@ namespace MWWorld
|
|||
return mEnabled;
|
||||
}
|
||||
|
||||
bool RefData::hasSuppressActivate()
|
||||
{
|
||||
return mFlags & Flag_SuppressActivate;
|
||||
}
|
||||
|
||||
void RefData::enable()
|
||||
{
|
||||
if (!mEnabled)
|
||||
|
|
|
@ -111,6 +111,8 @@ namespace MWWorld
|
|||
|
||||
bool isEnabled() const;
|
||||
|
||||
bool hasSuppressActivate();
|
||||
|
||||
void enable();
|
||||
|
||||
void disable();
|
||||
|
|
Loading…
Reference in a new issue