mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Check for actor being the player in various actions
This commit is contained in:
parent
fd48c1d6f4
commit
e5d54fb539
6 changed files with 14 additions and 2 deletions
|
@ -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…
Reference in a new issue