[Client] Add isUsingRangedWeapon() method to MechanicsHelper

pull/473/head
David Cernat 6 years ago
parent 3f6ca6f22b
commit af49f711ca

@ -75,6 +75,26 @@ void MechanicsHelper::spawnLeveledCreatures(MWWorld::CellStore* cellStore)
objectList->sendObjectSpawn();
}
bool MechanicsHelper::isUsingRangedWeapon(const MWWorld::Ptr& ptr)
{
if (ptr.getClass().hasInventoryStore(ptr))
{
MWWorld::InventoryStore &inventoryStore = ptr.getClass().getInventoryStore(ptr);
MWWorld::ContainerStoreIterator weaponSlot = inventoryStore.getSlot(
MWWorld::InventoryStore::Slot_CarriedRight);
if (weaponSlot != inventoryStore.end())
{
const ESM::Weapon* weaponRecord = weaponSlot->get<ESM::Weapon>()->mBase;
if (weaponRecord->mData.mType >= ESM::Weapon::MarksmanBow)
return true;
}
}
return false;
}
Attack *MechanicsHelper::getLocalAttack(const MWWorld::Ptr& ptr)
{
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())

@ -15,6 +15,8 @@ namespace MechanicsHelper
void spawnLeveledCreatures(MWWorld::CellStore* cellStore);
bool isUsingRangedWeapon(const MWWorld::Ptr& ptr);
mwmp::Attack *getLocalAttack(const MWWorld::Ptr& ptr);
mwmp::Attack *getDedicatedAttack(const MWWorld::Ptr& ptr);

Loading…
Cancel
Save