-
Автор темы
- #1
Код:
void RequestHit2(CEntity* g_pCEntity, EntityId projectileId, Vec3 pos, int CheckVisible) //<---
{
CGameFramework* m_pFramework = SSystemGlobalEnvironment::Singleton()->GetIGame()->GetCGameFramework(); if (!m_pFramework) return;
CRenderer* pRenderer = SSystemGlobalEnvironment::Singleton()->GetIRenderer(); if (!pRenderer) return;
CGameRules* pGameRules = m_pFramework->GetGameRulesSystem(); if (!pGameRules) return;
CActor* mActor = m_pFramework->GetClientActor(); if (!mActor) return;
CItem* g_pItem = mActor->GetCurrentItem(); if (!g_pItem) return;
CWeapon* g_pWeapon = g_pItem->GetIWeapon(); if (!g_pWeapon) return;
LPCSTR WeaponName = g_pItem->GetIWeaponEntity()->GetName();
WEAPON_NAMES WeaponInfo;
SClientGameHitInfo info;
memset(&info, 0, sizeof(SClientGameHitInfo));
info.source.itemId = g_pItem->GetItemId();
info.source.projectileId = projectileId;
info.source.ammoClassId = 65535;
info.shared.shooterId = mActor->GetEntityId();
info.shared.targetId = g_pCEntity->GetEntityId();
//info.shared.material = GetHitMaterial(g_pCEntity);
info.shared.material = pGameRules->GetHitMaterialId(GetHitMaterial(g_pCEntity));
info.shared.partId = 0;
info.shared.pos = pos;
info.shared.typeId = 1;
info.shared.shootPos = pRenderer->GetViewCamera();
info.shared.dir = info.shared.pos - info.shared.shootPos;
info.travelDistance = info.shared.dir.GetLength();
info.shared.dir = info.shared.dir / info.travelDistance;
info.source.normal = info.shared.dir * -1.f;
info.bFromRemote = false;
info.canBeReported = true;
info.bRequest = true;
if (CheckVisible ? true : SSystemGlobalEnvironment::Singleton()->GetIPhysicalWorld()->isVisible(info.shared.shootPos, info.shared.pos)) {
if (strstr(WeaponName, WeaponInfo.stormtrooper_weapon1) || strstr(WeaponName, WeaponInfo.stormtrooper_weapon2) || strstr(WeaponName, WeaponInfo.sniper_weapons) || strstr(WeaponName, WeaponInfo.sed_weapon1) || strstr(WeaponName, WeaponInfo.medic_weapons) || strstr(WeaponName, WeaponInfo.engineer_weapons) || strstr(WeaponName, WeaponInfo.pistols)) {
if (!strstr(WeaponName, "arl")) {
if (!strstr(WeaponName, "ft")) {
if (AutoShot ? 1 : g_pWeapon->GetIWeaponSpecific()->IsFiring()) {//автовыстрел
if (Hit)
g_pWeapon->GetIWeaponSpecific()->RequestShootHit(&info); //
}
}
}
}
}
};