warmup += autocvar_g_ca_warmup;
allowed_to_spawn = 1;
}
- else if(g_freezetag)
- {
- redalive = bluealive = yellowalive = pinkalive = 0;
- warmup = max(time, game_starttime);
- if(autocvar_g_freezetag_warmup > 0)
- warmup += autocvar_g_freezetag_warmup;
- }
else if(g_race || g_cts)
race_ReadyRestart();
+ else MUTATOR_CALLHOOK(reset_map_global);
lms_lowest_lives = 999;
lms_next_place = player_count;
// Moving the player reset code here since the player-reset depends
// on spawnpoint entities which have to be reset first --blub
if(dorespawn)
+ if(!MUTATOR_CALLHOOK(reset_map_players))
FOR_EACH_CLIENT(self) {
if(self.flags & FL_CLIENT) // reset all players
{
self.classname = "player";
PutClientInServer();
}
- else if(g_freezetag)
- {
- if(self.classname == "player")
- PutClientInServer();
- }
else
{
/*
void freezetag_CheckWinner()
{
- if(time <= game_starttime) // game didn't even start yet! nobody can win in that case.
+ if(time <= game_starttime || inWarmupStage)
return;
if(next_round || (time > warmup - autocvar_g_freezetag_warmup && time < warmup))
self.freezetag_frozen = 1;
self.freezetag_revive_progress = 0;
self.health = 1;
+ if(inWarmupStage)
+ self.freezetag_frozen_timeout = time + 5;
entity ice;
ice = spawn();
void freezetag_Unfreeze(entity attacker)
{
self.freezetag_frozen = 0;
+ self.freezetag_frozen_timeout = 0;
self.freezetag_revive_progress = 0;
self.health = autocvar_g_balance_health_start;
MUTATOR_HOOKFUNCTION(freezetag_PlayerDies)
{
-
if(frag_deathtype == DEATH_HURTTRIGGER)
{
if(!self.freezetag_frozen)
{
freezetag_remove_alive();
+ freezetag_Freeze(world);
freezetag_CheckWinner();
}
PutClientInServer(); // respawn the player
MUTATOR_HOOKFUNCTION(freezetag_PlayerSpawn)
{
- freezetag_add_alive();
- if(time <= game_starttime || total_players == 0)
+ if(self.freezetag_frozen) // stay frozen if respawning after death (DEATH_HURTTRIGGER)
return 1;
- freezetag_Unfreeze(world); // start by making sure that all ice blocks are removed
+ freezetag_add_alive();
+
+ if(time <= game_starttime || inWarmupStage || total_players == 0)
+ return 1;
if(total_players == 1) // only one player active on server, start a new match immediately
if(!next_round && warmup && (time < warmup - autocvar_g_freezetag_warmup || time > warmup)) // not awaiting next round
if(warmup && time > warmup) // spawn too late, freeze player
{
- if(!next_round) // no msg if player respawn after a death by DEATH_HURTTRIGGER
- centerprint(self, "^1Round already started, you spawn as frozen.");
+ centerprint(self, "^1Round already started, you spawn as frozen.");
freezetag_Freeze(world);
freezetag_remove_alive();
}
return 1;
}
+MUTATOR_HOOKFUNCTION(freezetag_reset_map_global)
+{
+ redalive = bluealive = yellowalive = pinkalive = 0;
+ warmup = max(time, game_starttime);
+ if(autocvar_g_freezetag_warmup > 0)
+ warmup += autocvar_g_freezetag_warmup;
+ return 1;
+}
+
+MUTATOR_HOOKFUNCTION(freezetag_reset_map_players)
+{
+ FOR_EACH_PLAYER(self)
+ {
+ if (self.freezetag_frozen)
+ freezetag_Unfreeze(world);
+ PutClientInServer();
+ }
+ return 1;
+}
+
MUTATOR_HOOKFUNCTION(freezetag_GiveFragsForKill)
{
frag_score = 0; // no frags counted in Freeze Tag
return 1;
if(self.freezetag_frozen && !self.freezetag_revive_progress)
self.health = 1;
+ if(self.freezetag_frozen_timeout && time >= self.freezetag_frozen_timeout)
+ {
+ freezetag_Unfreeze(world);
+ freezetag_add_alive();
+ return 1;
+ }
if(next_round || (time > warmup - autocvar_g_freezetag_warmup && time < warmup))
return 1; // already waiting for next round to start
MUTATOR_HOOK(ClientDisconnect, freezetag_RemovePlayer, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerDies, freezetag_PlayerDies, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerSpawn, freezetag_PlayerSpawn, CBC_ORDER_ANY);
+ MUTATOR_HOOK(reset_map_global, freezetag_reset_map_global, CBC_ORDER_ANY);
+ MUTATOR_HOOK(reset_map_players, freezetag_reset_map_players, CBC_ORDER_ANY);
MUTATOR_HOOK(GiveFragsForKill, freezetag_GiveFragsForKill, CBC_ORDER_FIRST);
MUTATOR_HOOK(PlayerPreThink, freezetag_PlayerPreThink, CBC_ORDER_FIRST);
MUTATOR_HOOK(PlayerPhysics, freezetag_PlayerPhysics, CBC_ORDER_FIRST);