1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-19 17:11:33 +00:00

Fix being able to jump when overencumbered

This commit is contained in:
scrawl 2014-12-02 18:42:13 +01:00
parent e6c59f5585
commit 14ae6d28b0
3 changed files with 28 additions and 21 deletions

View file

@ -969,6 +969,9 @@ namespace MWClass
float Npc::getJump(const MWWorld::Ptr &ptr) const float Npc::getJump(const MWWorld::Ptr &ptr) const
{ {
if(getEncumbrance(ptr) > getCapacity(ptr))
return 0.f;
const NpcCustomData *npcdata = static_cast<const NpcCustomData*>(ptr.getRefData().getCustomData()); const NpcCustomData *npcdata = static_cast<const NpcCustomData*>(ptr.getRefData().getCustomData());
const GMST& gmst = getGmst(); const GMST& gmst = getGmst();
const MWMechanics::MagicEffects &mageffects = npcdata->mNpcStats.getMagicEffects(); const MWMechanics::MagicEffects &mageffects = npcdata->mNpcStats.getMagicEffects();

View file

@ -371,6 +371,7 @@ namespace MWInput
{ {
mPlayer->setUpDown (1); mPlayer->setUpDown (1);
triedToMove = true; triedToMove = true;
mOverencumberedMessageDelay = 0.f;
} }
if (mAlwaysRunActive) if (mAlwaysRunActive)

View file

@ -1414,6 +1414,8 @@ void CharacterController::update(float duration)
{ {
// Started a jump. // Started a jump.
float z = cls.getJump(mPtr); float z = cls.getJump(mPtr);
if (z > 0)
{
if(vec.x == 0 && vec.y == 0) if(vec.x == 0 && vec.y == 0)
vec = Ogre::Vector3(0.0f, 0.0f, z); vec = Ogre::Vector3(0.0f, 0.0f, z);
else else
@ -1438,6 +1440,7 @@ void CharacterController::update(float duration)
fatigue.setCurrent(fatigue.getCurrent() - fatigueDecrease); fatigue.setCurrent(fatigue.getCurrent() - fatigueDecrease);
cls.getCreatureStats(mPtr).setFatigue(fatigue); cls.getCreatureStats(mPtr).setFatigue(fatigue);
} }
}
else if(mJumpState == JumpState_InAir) else if(mJumpState == JumpState_InAir)
{ {
forcestateupdate = true; forcestateupdate = true;