ToggleAI: Report current status on toggle

actorid
scrawl 11 years ago
parent 688415ce54
commit 793649c854

@ -156,7 +156,7 @@ namespace MWBase
/// paused we may want to do it manually (after equipping permanent enchantment)
virtual void updateMagicEffects (const MWWorld::Ptr& ptr) = 0;
virtual void toggleAI() = 0;
virtual bool toggleAI() = 0;
virtual bool isAIActive() = 0;
virtual void getObjectsInRange (const Ogre::Vector3& position, float radius, std::vector<MWWorld::Ptr>& objects) = 0;

@ -750,9 +750,10 @@ namespace MWMechanics
mActors.updateMagicEffects(ptr);
}
void MechanicsManager::toggleAI()
bool MechanicsManager::toggleAI()
{
mAI = !mAI;
return mAI;
}
bool MechanicsManager::isAIActive()

@ -137,7 +137,7 @@ namespace MWMechanics
virtual std::list<MWWorld::Ptr> getActorsFollowing(const MWWorld::Ptr& actor);
virtual void toggleAI();
virtual bool toggleAI();
virtual bool isAIActive();
virtual void playerLoaded();

@ -464,7 +464,12 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime)
{
MWBase::Environment::get().getMechanicsManager()->toggleAI();
InterpreterContext& context
= static_cast<InterpreterContext&> (runtime.getContext());
bool enabled = MWBase::Environment::get().getMechanicsManager()->toggleAI();
context.report (enabled ? "AI -> On" : "AI -> Off");
}
};

Loading…
Cancel
Save