mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:53:52 +00:00
Merge pull request #62 from OpenMW/master
Add OpenMW commits up to 20 Sep
This commit is contained in:
commit
f515111845
2 changed files with 3 additions and 1 deletions
|
@ -229,7 +229,7 @@ namespace MWMechanics
|
||||||
osg::Vec3f vAimDir = MWBase::Environment::get().getWorld()->aimToTarget(actor, target);
|
osg::Vec3f vAimDir = MWBase::Environment::get().getWorld()->aimToTarget(actor, target);
|
||||||
float distToTarget = MWBase::Environment::get().getWorld()->getHitDistance(actor, target);
|
float distToTarget = MWBase::Environment::get().getWorld()->getHitDistance(actor, target);
|
||||||
|
|
||||||
storage.mReadyToAttack = (distToTarget <= rangeAttack);
|
storage.mReadyToAttack = (currentAction->isAttackingOrSpell() && distToTarget <= rangeAttack);
|
||||||
|
|
||||||
// can't fight if attacker can't go where target is. E.g. A fish can't attack person on land.
|
// can't fight if attacker can't go where target is. E.g. A fish can't attack person on land.
|
||||||
if (distToTarget > rangeAttack
|
if (distToTarget > rangeAttack
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace MWMechanics
|
||||||
virtual float getCombatRange (bool& isRanged) const = 0;
|
virtual float getCombatRange (bool& isRanged) const = 0;
|
||||||
virtual float getActionCooldown() { return 0.f; }
|
virtual float getActionCooldown() { return 0.f; }
|
||||||
virtual const ESM::Weapon* getWeapon() const { return NULL; };
|
virtual const ESM::Weapon* getWeapon() const { return NULL; };
|
||||||
|
virtual bool isAttackingOrSpell() const { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class ActionSpell : public Action
|
class ActionSpell : public Action
|
||||||
|
@ -53,6 +54,7 @@ namespace MWMechanics
|
||||||
/// Drinks the given potion.
|
/// Drinks the given potion.
|
||||||
virtual void prepare(const MWWorld::Ptr& actor);
|
virtual void prepare(const MWWorld::Ptr& actor);
|
||||||
virtual float getCombatRange (bool& isRanged) const;
|
virtual float getCombatRange (bool& isRanged) const;
|
||||||
|
virtual bool isAttackingOrSpell() const { return false; }
|
||||||
|
|
||||||
/// Since this action has no animation, apply a small cool down for using it
|
/// Since this action has no animation, apply a small cool down for using it
|
||||||
virtual float getActionCooldown() { return 1.f; }
|
virtual float getActionCooldown() { return 1.f; }
|
||||||
|
|
Loading…
Reference in a new issue