2007-11-25 19:42:40 +00:00
|
|
|
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
|
2007-09-25 23:03:15 +00:00
|
|
|
#include <engine/config.h>
|
|
|
|
#include "srv_common.h"
|
|
|
|
#include "srv_tdm.h"
|
|
|
|
|
2007-11-04 00:19:41 +00:00
|
|
|
gameobject_tdm::gameobject_tdm()
|
|
|
|
{
|
|
|
|
is_teamplay = true;
|
|
|
|
}
|
|
|
|
|
2007-11-26 19:18:49 +00:00
|
|
|
|
|
|
|
int gameobject_tdm::on_player_death(class player *victim, class player *killer, int weapon)
|
|
|
|
{
|
|
|
|
gameobject::on_player_death(victim, killer, weapon);
|
|
|
|
|
|
|
|
if(weapon >= 0)
|
|
|
|
{
|
|
|
|
// do team scoring
|
|
|
|
if(killer == victim)
|
|
|
|
teamscore[killer->team&1]--; // klant arschel
|
|
|
|
else
|
|
|
|
teamscore[killer->team&1]++; // good shit
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-09-25 23:03:15 +00:00
|
|
|
void gameobject_tdm::tick()
|
|
|
|
{
|
2007-11-26 19:18:49 +00:00
|
|
|
if(game_over_tick == -1 && !warmup)
|
2007-09-25 23:03:15 +00:00
|
|
|
{
|
|
|
|
// check score win condition
|
2007-10-03 21:32:02 +00:00
|
|
|
if((config.scorelimit > 0 && (teamscore[0] >= config.scorelimit || teamscore[1] >= config.scorelimit)) ||
|
2007-09-25 23:03:15 +00:00
|
|
|
(config.timelimit > 0 && (server_tick()-round_start_tick) >= config.timelimit*server_tickspeed()*60))
|
|
|
|
{
|
2007-11-26 19:18:49 +00:00
|
|
|
if(teamscore[0] != teamscore[0])
|
2007-09-25 23:03:15 +00:00
|
|
|
endround();
|
|
|
|
else
|
|
|
|
sudden_death = 1;
|
|
|
|
}
|
|
|
|
}
|
2007-10-04 23:58:22 +00:00
|
|
|
|
|
|
|
gameobject::tick();
|
2007-09-25 23:03:15 +00:00
|
|
|
}
|