static void PeriodicAllClientLogic(void) { SetNextThinkTime(self); self->fb.prev_touch_marker = self->fb.touch_marker; if (PAST(weapon_refresh_time)) { FrogbotSetFirepower(self); } // If we haven't touched a marker in a while, find closest marker if (PAST(touch_marker_time)) { SetMarker(self, LocateMarker(self->s.v.origin)); } if (self->fb.touch_marker) { BotPathCheck (self, self->fb.touch_marker); if (self->fb.state & AWARE_SURROUNDINGS) { if (self->isBot) { BotTouchMarkerLogic(); } else { HumanTouchMarkerLogic(); } } else { self->fb.goal_refresh_time = 0; self->fb.state |= AWARE_SURROUNDINGS; self->fb.old_linked_marker = (self->isBot ? NULL : self->fb.old_linked_marker); } } }
void CASW_Burning::BurnEntity( CBaseEntity *pEntity, CBaseEntity *pAttacker, float fFireDuration, float fBurnInterval, float fDamagePerInterval, CBaseEntity *pDamagingWeapon /*= NULL */ ) { if (!pEntity) return; int c = m_Burning.Count(); for (int i=0;i<c;i++) { if (m_Burning[i]->m_hEntity.Get() == pEntity) // already burning this ent { m_Burning[i]->m_fDieTime = MAX(m_Burning[i]->m_fDieTime, gpGlobals->curtime + fFireDuration); return; } } //Msg("BurnEntity: %d:%s for %f seconds, interval %f damageper %f\n", pEntity->entindex(), pEntity->GetClassName(), //fFireDuration, fBurnInterval, fDamagePerInterval); // add a new one CASW_BurnInfo *pBurn = new CASW_BurnInfo(pEntity, pAttacker, gpGlobals->curtime + fFireDuration, fBurnInterval, fDamagePerInterval, pDamagingWeapon ); if (pBurn) { m_Burning.AddToTail(pBurn); SetNextThinkTime(); } }
void CASW_Burning::FireThink() { int c = m_Burning.Count(); for (int i=c-1;i>=0;i--) // go backwards in case we remove one { CBaseEntity *pEnt = m_Burning[i]->m_hEntity.Get(); if (m_Burning[i]->m_fDieTime <= gpGlobals->curtime || !pEnt) { delete m_Burning[i]; m_Burning.Remove(i); CBaseAnimating *pAnim = dynamic_cast<CBaseAnimating*>(pEnt); if (pAnim) { //OnEntityExtinguished(pEnt); pAnim->Extinguish(); // this makes the entity remove its FL_ONFIRE flag, its m_bOnFire bool and then calls back to us to check its not in the list anymore } } else { if (m_Burning[i]->m_fNextBurnTime <= gpGlobals->curtime + 0.01f) { // hurt the entity! CBaseEntity *pAttacker = m_Burning[i]->m_hAttacker.Get(); if (!pAttacker) pAttacker = this; //Msg("%f: burning %d:%s from %d:%s for %f\n", gpGlobals->curtime, //pEnt->entindex(), pEnt->GetClassName(), //pAttacker->entindex(), pAttacker->GetClassName(), //m_Burning[i]->m_fDamagePerInterval); CTakeDamageInfo info( this, pAttacker, m_Burning[i]->m_fDamagePerInterval, DMG_BURN | DMG_DIRECT ); info.SetWeapon( m_Burning[i]->m_hDamagingWeapon.Get() ); pEnt->TakeDamage( info ); m_Burning[i]->m_fNextBurnTime += m_Burning[i]->m_fBurnInterval; } } } SetNextThinkTime(); }