ka_RespawnBall(this);
}
+.entity kh_previous_owner;
void ka_TouchEvent(entity this, entity toucher) // runs any time that the ball comes in contact with something
{
if (!this || game_stopped)
sound(this, CH_TRIGGER, SND_KA_TOUCH, VOL_BASE, ATTEN_NORM);
return;
}
- else if(this.wait > time) { return; }
+ else if(this.wait > time && this.kh_previous_owner == toucher)
+ return;
// attach the ball to the player
this.owner = toucher;
// reset the ball
setattachment(ball, NULL, "");
set_movetype(ball, MOVETYPE_BOUNCE);
- ball.wait = time + 1;
+ ball.kh_previous_owner = player;
+ ball.wait = time + 0.5; // same as for thrown weapons
settouch(ball, ka_TouchEvent);
setthink(ball, ka_RespawnBall);
ball.nextthink = time + autocvar_g_keepawayball_respawntime;
}
}
+.entity kh_previous_owner;
void tka_TouchEvent(entity this, entity toucher) // runs any time that the ball comes in contact with something
{
if (!this || game_stopped)
sound(this, CH_TRIGGER, SND_KA_TOUCH, VOL_BASE, ATTEN_NORM);
return;
}
- else if(this.wait > time) { return; }
+ else if(this.wait > time && this.kh_previous_owner == toucher)
+ return;
// attach the ball to the player
this.owner = toucher;
// reset the ball
setattachment(ball, NULL, "");
set_movetype(ball, MOVETYPE_BOUNCE);
- ball.wait = time + 1;
+ ball.kh_previous_owner = player;
+ ball.wait = time + 0.5; // same as for thrown weapons
settouch(ball, tka_TouchEvent);
setthink(ball, tka_RespawnBall);
ball.nextthink = time + autocvar_g_tkaball_respawntime;