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

Method Think

source/src/bot/bot.cpp:90–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90void CBot::Think()
91{
92 if (intermission) return;
93 // Bot is dead?
94 if (m_pMyEnt->state == CS_DEAD)
95 {
96 if(lastmillis-m_pMyEnt->lastdeath<1200)
97 {
98 m_pMyEnt->move = 0;
99 moveplayer(m_pMyEnt, 1, true);
100 }
101 else if (!m_arena && lastmillis-m_pMyEnt->lastdeath>5000) Spawn();
102 SendBotInfo();
103 return;
104 }
105 CheckItemPickup();
106 TLinkedList<unreachable_ent_s*>::node_s *p = m_UnreachableEnts.GetFirst(), *tmp;
107 while(p)
108 {
109 if ((lastmillis - p->Entry->time) > 3500)
110 {
111 tmp = p;
112 p = p->next;
113 delete tmp->Entry;
114 m_UnreachableEnts.DeleteNode(tmp);
115 continue;
116 }
117 p = p->next;
118 }
119 if (!BotManager.IdleBots()) { MainAI(); }
120 else { ResetMoveSpeed(); }
121 // Aim to ideal yaw and pitch
122 AimToIdeal();
123 // Store current location, to see if the bot is stuck
124 m_vPrevOrigin = m_pMyEnt->o;
125 // Don't check for stuck if the bot doesn't want to move
126 if (!m_pMyEnt->move && !m_pMyEnt->strafe) m_iStuckCheckDelay = max(m_iStuckCheckDelay, lastmillis+100.0f);
127 // Move the bot
128 moveplayer(m_pMyEnt, 1, true);
129 // Update bot info on all clients
130 SendBotInfo();
131}
132
133void CBot::AimToVec(const vec &o)
134{

Callers 2

gl_drawframeFunction · 0.45
updateworldFunction · 0.45

Calls 5

moveplayerFunction · 0.85
maxFunction · 0.85
IdleBotsMethod · 0.80
GetFirstMethod · 0.45
DeleteNodeMethod · 0.45

Tested by

no test coverage detected