| 88 | } |
| 89 | |
| 90 | void 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 | |
| 133 | void CBot::AimToVec(const vec &o) |
| 134 | { |
no test coverage detected