Check for actor being the player in various actions

sceneinput
scrawl 9 years ago
parent fd48c1d6f4
commit e5d54fb539

@ -10,6 +10,9 @@ namespace MWWorld
{
void ActionAlchemy::executeImp (const Ptr& actor)
{
if (actor != MWBase::Environment::get().getWorld()->getPlayerPtr())
return;
if(MWBase::Environment::get().getWorld()->getPlayer().isInCombat()) { //Ensure we're not in combat
MWBase::Environment::get().getWindowManager()->messageBox("#{sInventoryMessage3}");
return;

@ -32,7 +32,7 @@ namespace MWWorld
{
MWBase::Environment::get().getWorld()->breakInvisibility(actor);
if (actor.getClass().apply (actor, mId, actor) && mUsageType!=-1)
if (actor.getClass().apply (actor, mId, actor) && mUsageType!=-1 && actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
actor.getClass().skillUsageSucceeded (actor, mSkillIndex, mUsageType);
actor.getClass().getContainerStore(actor).remove(getTarget(), 1, actor);

@ -19,7 +19,7 @@ namespace MWWorld
// apply to actor
std::string id = getTarget().getClass().getId (getTarget());
if (actor.getClass().apply (actor, id, actor))
if (actor.getClass().apply (actor, id, actor) && actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
actor.getClass().skillUsageSucceeded (actor, ESM::Skill::Alchemy, 1);
}

@ -18,6 +18,9 @@ namespace MWWorld
void ActionRead::executeImp (const MWWorld::Ptr& actor) {
if (actor != MWBase::Environment::get().getWorld()->getPlayerPtr())
return;
//Ensure we're not in combat
if(MWBase::Environment::get().getWorld()->getPlayer().isInCombat()
// Reading in combat is still allowed if the scroll/book is not in the player inventory yet

@ -14,6 +14,9 @@ namespace MWWorld
void ActionRepair::executeImp (const Ptr& actor)
{
if (actor != MWBase::Environment::get().getWorld()->getPlayerPtr())
return;
if(MWBase::Environment::get().getWorld()->getPlayer().isInCombat()) {
MWBase::Environment::get().getWindowManager()->messageBox("#{sInventoryMessage2}");
return;

@ -16,6 +16,9 @@ namespace MWWorld
void ActionSoulgem::executeImp(const Ptr &actor)
{
if (actor != MWBase::Environment::get().getWorld()->getPlayerPtr())
return;
if(MWBase::Environment::get().getWorld()->getPlayer().isInCombat()) { //Ensure we're not in combat
MWBase::Environment::get().getWindowManager()->messageBox("#{sInventoryMessage5}");
return;

Loading…
Cancel
Save