CDrone: Implement ShouldFire

This commit is contained in:
Luke Street 2020-09-13 20:49:46 -04:00
parent 21b04bf40d
commit 9489bd3812
2 changed files with 16 additions and 0 deletions

View File

@ -828,6 +828,21 @@ bool CDrone::ShouldAttack(CStateManager& mgr, float arg) {
return true;
}
bool CDrone::ShouldFire(CStateManager& mgr, float arg) {
if (mgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed || x624_ > 0.f) {
return false;
}
const zeus::CVector3f playerAimPos = mgr.GetPlayer().GetAimPosition(mgr, 0.f);
constexpr auto matFilter =
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid, EMaterialTypes::Character},
{EMaterialTypes::Player, EMaterialTypes::ProjectilePassthrough});
bool result = mgr.RayCollideWorld(GetLctrTransform("R_GUN_TOP_LCTR"sv).origin, playerAimPos, matFilter, this);
if (!result) {
return false;
}
return mgr.RayCollideWorld(GetLctrTransform("L_GUN_TOP_LCTR"sv).origin, playerAimPos, matFilter, this);
}
bool CDrone::HearShot(CStateManager& mgr, float arg) {
rstl::reserved_vector<TUniqueId, 1024> nearList;
BuildNearList(EMaterialTypes::Projectile, EMaterialTypes::Player, nearList, 10.f, mgr);

View File

@ -158,6 +158,7 @@ public:
bool AnimOver(CStateManager&, float arg) override;
bool AttackOver(CStateManager& mgr, float arg) override;
bool ShouldAttack(CStateManager&, float arg) override;
bool ShouldFire(CStateManager& mgr, float arg) override;
bool HearShot(CStateManager&, float arg) override;
bool CoverCheck(CStateManager&, float arg) override;
bool LineOfSight(CStateManager&, float arg) override;