mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-25 05:41:33 +00:00
Allow talking with fleeing creatures (bug #7631)
This commit is contained in:
parent
a08ca11c34
commit
ee5ca066fd
7 changed files with 28 additions and 5 deletions
|
@ -78,6 +78,7 @@
|
||||||
Bug #7604: Goblins Grunt becomes idle once injured
|
Bug #7604: Goblins Grunt becomes idle once injured
|
||||||
Bug #7609: ForceGreeting should not open dialogue for werewolves
|
Bug #7609: ForceGreeting should not open dialogue for werewolves
|
||||||
Bug #7630: Charm can be cast on creatures
|
Bug #7630: Charm can be cast on creatures
|
||||||
|
Bug #7631: Cannot trade with/talk to Creeper or Mudcrab Merchant when they're fleeing
|
||||||
Feature #3537: Shader-based water ripples
|
Feature #3537: Shader-based water ripples
|
||||||
Feature #5492: Let rain and snow collide with statics
|
Feature #5492: Let rain and snow collide with statics
|
||||||
Feature #6149: Dehardcode Lua API_REVISION
|
Feature #6149: Dehardcode Lua API_REVISION
|
||||||
|
|
|
@ -464,18 +464,20 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
|
|
||||||
const MWMechanics::CreatureStats& stats = getCreatureStats(ptr);
|
const MWMechanics::CreatureStats& stats = getCreatureStats(ptr);
|
||||||
|
const MWMechanics::AiSequence& aiSequence = stats.getAiSequence();
|
||||||
|
|
||||||
|
const bool isInCombat = aiSequence.isInCombat();
|
||||||
if (stats.isDead())
|
if (stats.isDead())
|
||||||
{
|
{
|
||||||
// by default user can loot friendly actors during death animation
|
// by default user can loot friendly actors during death animation
|
||||||
if (Settings::game().mCanLootDuringDeathAnimation && !stats.getAiSequence().isInCombat())
|
if (Settings::game().mCanLootDuringDeathAnimation && !isInCombat)
|
||||||
return std::make_unique<MWWorld::ActionOpen>(ptr);
|
return std::make_unique<MWWorld::ActionOpen>(ptr);
|
||||||
|
|
||||||
// otherwise wait until death animation
|
// otherwise wait until death animation
|
||||||
if (stats.isDeathAnimationFinished())
|
if (stats.isDeathAnimationFinished())
|
||||||
return std::make_unique<MWWorld::ActionOpen>(ptr);
|
return std::make_unique<MWWorld::ActionOpen>(ptr);
|
||||||
}
|
}
|
||||||
else if (!stats.getAiSequence().isInCombat() && !stats.getKnockedDown())
|
else if ((!isInCombat || aiSequence.isFleeing()) && !stats.getKnockedDown())
|
||||||
return std::make_unique<MWWorld::ActionTalk>(ptr);
|
return std::make_unique<MWWorld::ActionTalk>(ptr);
|
||||||
|
|
||||||
// Tribunal and some mod companions oddly enough must use open action as fallback
|
// Tribunal and some mod companions oddly enough must use open action as fallback
|
||||||
|
@ -570,7 +572,8 @@ namespace MWClass
|
||||||
if (customData.mCreatureStats.isDead() && customData.mCreatureStats.isDeathAnimationFinished())
|
if (customData.mCreatureStats.isDead() && customData.mCreatureStats.isDeathAnimationFinished())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return !customData.mCreatureStats.getAiSequence().isInCombat();
|
const MWMechanics::AiSequence& aiSeq = customData.mCreatureStats.getAiSequence();
|
||||||
|
return !aiSeq.isInCombat() || aiSeq.isFleeing();
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::ToolTipInfo Creature::getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const
|
MWGui::ToolTipInfo Creature::getToolTipInfo(const MWWorld::ConstPtr& ptr, int count) const
|
||||||
|
|
|
@ -708,7 +708,7 @@ namespace MWMechanics
|
||||||
mFleeDest = ESM::Pathgrid::Point(0, 0, 0);
|
mFleeDest = ESM::Pathgrid::Point(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AiCombatStorage::isFleeing()
|
bool AiCombatStorage::isFleeing() const
|
||||||
{
|
{
|
||||||
return mFleeState != FleeState_None;
|
return mFleeState != FleeState_None;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
void startFleeing();
|
void startFleeing();
|
||||||
void stopFleeing();
|
void stopFleeing();
|
||||||
bool isFleeing();
|
bool isFleeing() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Causes the actor to fight another actor
|
/// \brief Causes the actor to fight another actor
|
||||||
|
|
|
@ -135,6 +135,15 @@ namespace MWMechanics
|
||||||
return mNumPursuitPackages > 0;
|
return mNumPursuitPackages > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AiSequence::isFleeing() const
|
||||||
|
{
|
||||||
|
if (!isInCombat())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const AiCombatStorage* storage = mAiState.getPtr<AiCombatStorage>();
|
||||||
|
return storage && storage->isFleeing();
|
||||||
|
}
|
||||||
|
|
||||||
bool AiSequence::isEngagedWithActor() const
|
bool AiSequence::isEngagedWithActor() const
|
||||||
{
|
{
|
||||||
if (!isInCombat())
|
if (!isInCombat())
|
||||||
|
|
|
@ -117,6 +117,9 @@ namespace MWMechanics
|
||||||
/// Is there any pursuit package.
|
/// Is there any pursuit package.
|
||||||
bool isInPursuit() const;
|
bool isInPursuit() const;
|
||||||
|
|
||||||
|
/// Is the actor fleeing?
|
||||||
|
bool isFleeing() const;
|
||||||
|
|
||||||
/// Removes all packages using the specified id.
|
/// Removes all packages using the specified id.
|
||||||
void removePackagesById(AiPackageTypeId id);
|
void removePackagesById(AiPackageTypeId id);
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,13 @@ namespace MWMechanics
|
||||||
return *result;
|
return *result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \brief returns pointer to stored object in the desired type
|
||||||
|
template <class Derived>
|
||||||
|
Derived* getPtr() const
|
||||||
|
{
|
||||||
|
return dynamic_cast<Derived*>(mStorage.get());
|
||||||
|
}
|
||||||
|
|
||||||
template <class Derived>
|
template <class Derived>
|
||||||
void copy(DerivedClassStorage& destination) const
|
void copy(DerivedClassStorage& destination) const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue