forked from mirror/openmw-tes3mp
Use fCombatDistance as the creature attack range
This commit is contained in:
parent
07abaf8777
commit
8fcc1911d9
2 changed files with 6 additions and 8 deletions
|
@ -242,13 +242,10 @@ namespace MWClass
|
||||||
|
|
||||||
MWMechanics::applyFatigueLoss(ptr, weapon, attackStrength);
|
MWMechanics::applyFatigueLoss(ptr, weapon, attackStrength);
|
||||||
|
|
||||||
// TODO: where is the distance defined?
|
float dist = gmst.find("fCombatDistance")->getFloat();
|
||||||
float dist = 200.f;
|
|
||||||
if (!weapon.isEmpty())
|
if (!weapon.isEmpty())
|
||||||
{
|
dist *= weapon.get<ESM::Weapon>()->mBase->mData.mReach;
|
||||||
const float fCombatDistance = gmst.find("fCombatDistance")->getFloat();
|
|
||||||
dist = fCombatDistance * weapon.get<ESM::Weapon>()->mBase->mData.mReach;
|
|
||||||
}
|
|
||||||
std::pair<MWWorld::Ptr, osg::Vec3f> result = MWBase::Environment::get().getWorld()->getHitContact(ptr, dist);
|
std::pair<MWWorld::Ptr, osg::Vec3f> result = MWBase::Environment::get().getWorld()->getHitContact(ptr, dist);
|
||||||
if (result.first.isEmpty())
|
if (result.first.isEmpty())
|
||||||
return; // Didn't hit anything
|
return; // Didn't hit anything
|
||||||
|
|
|
@ -261,6 +261,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
// Get weapon characteristics
|
// Get weapon characteristics
|
||||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||||
|
static const float fCombatDistance = world->getStore().get<ESM::GameSetting>().find("fCombatDistance")->getFloat();
|
||||||
if (actorClass.hasInventoryStore(actor))
|
if (actorClass.hasInventoryStore(actor))
|
||||||
{
|
{
|
||||||
//Get weapon range
|
//Get weapon range
|
||||||
|
@ -279,12 +280,12 @@ namespace MWMechanics
|
||||||
weapon = weaponSlot->get<ESM::Weapon>()->mBase;
|
weapon = weaponSlot->get<ESM::Weapon>()->mBase;
|
||||||
weapRange = weapon->mData.mReach;
|
weapRange = weapon->mData.mReach;
|
||||||
}
|
}
|
||||||
weapRange *= 100.0f;
|
weapRange *= fCombatDistance;
|
||||||
}
|
}
|
||||||
else //is creature
|
else //is creature
|
||||||
{
|
{
|
||||||
weaptype = actorClass.getCreatureStats(actor).getDrawState() == DrawState_Spell ? WeapType_Spell : WeapType_HandToHand;
|
weaptype = actorClass.getCreatureStats(actor).getDrawState() == DrawState_Spell ? WeapType_Spell : WeapType_HandToHand;
|
||||||
weapRange = 150.0f; //TODO: use true attack range (the same problem in Creature::hit)
|
weapRange = fCombatDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool distantCombat = false;
|
bool distantCombat = false;
|
||||||
|
|
Loading…
Reference in a new issue