Implement stayOutside script variable

openmw-38
scrawl 9 years ago
parent 27617468c8
commit 2d302aef99

@ -3,6 +3,9 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwworld/class.hpp"
#include "player.hpp"
namespace
@ -40,6 +43,11 @@ namespace MWWorld
for(std::set<MWWorld::Ptr>::iterator it = followers.begin();it != followers.end();++it)
{
MWWorld::Ptr follower = *it;
std::string script = follower.getClass().getScript(follower);
if (!script.empty() && follower.getRefData().getLocals().getIntVar(script, "stayoutside") == 1)
continue;
if ((follower.getRefData().getPosition().asVec3() - actor.getRefData().getPosition().asVec3()).length2()
<= 800*800)
teleport(*it);

Loading…
Cancel
Save