Don't swat invincible karts

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9965 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-10-11 19:11:39 +00:00
parent 2a227e9d8b
commit 24ed5f15cc
2 changed files with 7 additions and 1 deletions

View File

@ -267,8 +267,12 @@ void Swatter::squashThingsAround()
{
Kart *kart = world->getKart(i);
// TODO: isSwatterReady()
if(kart->isEliminated() || kart==m_kart || kart->isSquashed())
if(kart->isEliminated() || kart==m_kart)
continue;
// don't swat an already hurt kart
if (kart->isInvulnerable() || kart->isSquashed())
continue;
float dist2 = (kart->getXYZ()-swatter_pos).length2();
if(dist2 >= min_dist2) continue; // too far away, ignore this kart

View File

@ -1031,6 +1031,8 @@ void Kart::showZipperFire()
*/
void Kart::setSquash(float time, float slowdown)
{
if (isInvulnerable()) return;
if(m_attachment->getType()==Attachment::ATTACH_BOMB)
{
this->handleExplosion(getXYZ(), /*direct hit*/true);