MCPcopy Create free account
hub / github.com/assaultcube/AC / CheckScope

Method CheckScope

source/src/bot/bot_ai.cpp:723–737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

721}
722
723void CBot::CheckScope()
724{
725#define MINSCOPEDIST 15
726#define MINSCOPETIME 1000
727 if(m_pMyEnt->weaponsel->type != GUN_SNIPER) return;
728 sniperrifle *sniper = (sniperrifle *)m_pMyEnt->weaponsel;
729 if(m_pMyEnt->enemy && m_pMyEnt->o.dist(m_pMyEnt->enemy->o) > MINSCOPEDIST)
730 {
731 sniper->setscope(true);
732 }
733 else if(m_pMyEnt->scoping && lastmillis - sniper->scoped_since < MINSCOPETIME)
734 {
735 sniper->setscope(false);
736 }
737}
738
739
740void CBot::MainAI()

Callers

nothing calls this directly

Calls 2

distMethod · 0.80
setscopeMethod · 0.80

Tested by

no test coverage detected