mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-01 18:15:32 +00:00
removed the attempt to unify activation and use scripts which was incorrect
This commit is contained in:
parent
71de10cb7e
commit
ca4fa21d64
4 changed files with 19 additions and 34 deletions
|
@ -437,11 +437,25 @@ void OMW::Engine::activate()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MWScript::InterpreterContext interpreterContext (&ptr.getRefData().getLocals(), ptr);
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action =
|
boost::shared_ptr<MWWorld::Action> action =
|
||||||
MWWorld::Class::get (ptr).activate (ptr, MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
MWWorld::Class::get (ptr).activate (ptr, MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||||
|
|
||||||
// execute action and script
|
interpreterContext.activate (ptr, action);
|
||||||
MWBase::Environment::get().getWorld()->executeActionScript(ptr, action);
|
|
||||||
|
std::string script = MWWorld::Class::get (ptr).getScript (ptr);
|
||||||
|
|
||||||
|
if (!script.empty())
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWorld()->getLocalScripts().setIgnore (ptr);
|
||||||
|
MWBase::Environment::get().getScriptManager()->run (script, interpreterContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!interpreterContext.hasActivationBeenHandled())
|
||||||
|
{
|
||||||
|
interpreterContext.executeActivation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OMW::Engine::screenshot()
|
void OMW::Engine::screenshot()
|
||||||
|
|
|
@ -153,8 +153,9 @@ namespace MWGui
|
||||||
|
|
||||||
std::cout << "Item can't be equipped" << std::endl;
|
std::cout << "Item can't be equipped" << std::endl;
|
||||||
|
|
||||||
// execute action and script
|
action->execute();
|
||||||
MWBase::Environment::get().getWorld()->executeActionScript(ptr, action);
|
|
||||||
|
/// \todo scripts
|
||||||
|
|
||||||
// this is necessary for books/scrolls: if they are already in the player's inventory,
|
// this is necessary for books/scrolls: if they are already in the player's inventory,
|
||||||
// the "Take" button should not be visible.
|
// the "Take" button should not be visible.
|
||||||
|
|
|
@ -17,13 +17,6 @@
|
||||||
|
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
|
||||||
#include "../mwscript/scriptmanager.hpp"
|
|
||||||
#include "../mwscript/compilercontext.hpp"
|
|
||||||
#include "../mwscript/interpretercontext.hpp"
|
|
||||||
#include "../mwscript/extensions.hpp"
|
|
||||||
#include "../mwscript/globalscripts.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
#include "ptr.hpp"
|
#include "ptr.hpp"
|
||||||
#include "class.hpp"
|
#include "class.hpp"
|
||||||
#include "player.hpp"
|
#include "player.hpp"
|
||||||
|
@ -1025,24 +1018,4 @@ namespace MWWorld
|
||||||
|
|
||||||
mWorldScene->insertObject(object, cell);
|
mWorldScene->insertObject(object, cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::executeActionScript(MWWorld::Ptr ptr, boost::shared_ptr<Action> action)
|
|
||||||
{
|
|
||||||
MWScript::InterpreterContext interpreterContext (&ptr.getRefData().getLocals(), ptr);
|
|
||||||
|
|
||||||
action->execute();
|
|
||||||
|
|
||||||
// execute script
|
|
||||||
interpreterContext.activate (ptr, action);
|
|
||||||
std::string script = MWWorld::Class::get (ptr).getScript (ptr);
|
|
||||||
if (!script.empty())
|
|
||||||
{
|
|
||||||
getLocalScripts().setIgnore (ptr);
|
|
||||||
MWBase::Environment::get().getScriptManager()->run (script, interpreterContext);
|
|
||||||
}
|
|
||||||
if (!interpreterContext.hasActivationBeenHandled())
|
|
||||||
{
|
|
||||||
interpreterContext.executeActivation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,9 +274,6 @@ namespace MWWorld
|
||||||
|
|
||||||
bool canPlaceObject(float cursorX, float cursorY);
|
bool canPlaceObject(float cursorX, float cursorY);
|
||||||
///< @return true if it is possible to place on object at specified cursor location
|
///< @return true if it is possible to place on object at specified cursor location
|
||||||
|
|
||||||
void executeActionScript(MWWorld::Ptr ptr, boost::shared_ptr<Action> action);
|
|
||||||
///< execute the activation script of an object (when activating the object with space, or when activating it via the inventory)
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue