X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fserver%2Fmutators%2Fgamemode_keyhunt.qc;h=d3f4fdc87e8fa328bfc87dd000f79c6ccbe1e38d;hb=42b501c5da481b2598db9bfc1b93b06fede3657a;hp=decada0312d4536537d9ab519b5b46cb822a04c8;hpb=4a6069480c3e18c35fc90ed231aff2e1f07f954d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc index decada031..d3f4fdc87 100644 --- a/qcsrc/server/mutators/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/gamemode_keyhunt.qc @@ -58,6 +58,7 @@ float kh_interferemsg_time, kh_interferemsg_team; .float kh_dropperteam; .entity kh_previous_owner; .float kh_previous_owner_playerid; +.float kh_cp_duration; string kh_sound_capture = "kh/capture.wav"; string kh_sound_destroy = "kh/destroy.wav"; @@ -121,7 +122,7 @@ void kh_update_state() var kh_Think_t kh_Controller_Thinkfunc; -void kh_Controller_SetThink(float t, string msg, kh_Think_t func) // runs occasionaly +void kh_Controller_SetThink(float t, string msg, float centerprint_duration, kh_Think_t func) // runs occasionaly { kh_Controller_Thinkfunc = func; kh_controller.cnt = ceil(t); @@ -130,10 +131,17 @@ void kh_Controller_SetThink(float t, string msg, kh_Think_t func) // runs occas if(msg == "") kh_Controller_Waitmsg = ""; else + { + kh_controller.kh_cp_duration = centerprint_duration; kh_Controller_Waitmsg = strzone(msg); + } if(t == 0) kh_controller.nextthink = time; // force } +void kh_Controller_SetThink_NoMsg(float t, kh_Think_t func) // runs occasionaly +{ + kh_Controller_SetThink(t, "", 0, func); +} void kh_Controller_Think() // called a lot { @@ -154,7 +162,7 @@ void kh_Controller_Think() // called a lot FOR_EACH_PLAYER(e) if(clienttype(e) == CLIENTTYPE_REAL) - centerprint_atprio(e, CENTERPRIO_SPAM, s); + Send_CSQC_Centerprint_Generic(e, CPID_KH_MSG, s, self.kh_cp_duration, 0); } self.cnt -= 1; } @@ -486,7 +494,7 @@ void kh_FinishRound() // runs when a team captures the keys kh_Key_Remove(key); kh_no_radar_circles = FALSE; - kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round, "Round starts in ", kh_StartRound); + kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round, "Round starts in ", 1, kh_StartRound); } void kh_WinnerTeam(float teem) // runs when a team wins @@ -685,11 +693,11 @@ void kh_Key_Think() // runs all the time { if(head.team == kh_interferemsg_team) if(head.kh_next) - centerprint(head, "All keys are in your team's hands!\n\nMeet the other key carriers ^1NOW^7!"); + Send_CSQC_Centerprint_Generic(head, CPID_KH_MSG, "All keys are in your team's hands!\n\nMeet the other key carriers ^1NOW^7!", 0, 0); else - centerprint(head, "All keys are in your team's hands!\n\nHelp the key carriers to meet!"); + Send_CSQC_Centerprint_Generic(head, CPID_KH_MSG, "All keys are in your team's hands!\n\nHelp the key carriers to meet!", 0, 0); else - centerprint(head, strcat("All keys are in the ", ColoredTeamName(kh_interferemsg_team), "^7's hands!\n\nInterfere ^1NOW^7!")); + Send_CSQC_Centerprint_Generic(head, CPID_KH_MSG, strcat("All keys are in the ", ColoredTeamName(kh_interferemsg_team), "^7's hands!\n\nInterfere ^1NOW^7!"), 0, 0); } } @@ -862,15 +870,15 @@ void kh_WaitForPlayers() // delay start of the round until enough players are p if(time < game_starttime) { - kh_Controller_SetThink(game_starttime - time + 0.1, "", kh_WaitForPlayers); + kh_Controller_SetThink_NoMsg(game_starttime - time + 0.1, kh_WaitForPlayers); return; } teams_missing = kh_CheckEnoughPlayers(); if(teams_missing == "") - kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round, "Round starts in ", kh_StartRound); + kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round, "Round starts in ", 1, kh_StartRound); else - kh_Controller_SetThink(1, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), kh_WaitForPlayers); + kh_Controller_SetThink(1, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), -1, kh_WaitForPlayers); } void kh_EnableTrackingDevice() // runs after each round @@ -879,7 +887,7 @@ void kh_EnableTrackingDevice() // runs after each round FOR_EACH_PLAYER(player) if(clienttype(player) == CLIENTTYPE_REAL) - centerprint_expire(player, CENTERPRIO_SPAM); + Send_CSQC_Centerprint_Generic_Expire(player, CPID_KH_MSG); kh_tracking_enabled = TRUE; } @@ -892,20 +900,20 @@ void kh_StartRound() // runs at the start of each round if(time < game_starttime) { - kh_Controller_SetThink(game_starttime - time + 0.1, "", kh_WaitForPlayers); + kh_Controller_SetThink_NoMsg(game_starttime - time + 0.1, kh_WaitForPlayers); return; } teams_missing = kh_CheckEnoughPlayers(); if(teams_missing != "") { - kh_Controller_SetThink(1, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), kh_WaitForPlayers); + kh_Controller_SetThink(1, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), -1, kh_WaitForPlayers); return; } FOR_EACH_PLAYER(player) if(clienttype(player) == CLIENTTYPE_REAL) - centerprint_expire(player, CENTERPRIO_SPAM); + Send_CSQC_Centerprint_Generic_Expire(player, CPID_KH_MSG); for(i = 0; i < kh_teams; ++i) { @@ -925,7 +933,7 @@ void kh_StartRound() // runs at the start of each round } kh_tracking_enabled = FALSE; - kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_tracking, "Scanning frequency range...", kh_EnableTrackingDevice); + kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_tracking, "Scanning frequency range...", -1, kh_EnableTrackingDevice); } float kh_HandleFrags(entity attacker, entity targ, float f) // adds to the player score @@ -977,7 +985,7 @@ void kh_Initialize() // sets up th KH environment // make a KH entity for controlling the game kh_controller = spawn(); kh_controller.think = kh_Controller_Think; - kh_Controller_SetThink(0, "", kh_WaitForPlayers); + kh_Controller_SetThink_NoMsg(0, kh_WaitForPlayers); setmodel(kh_controller, "models/keyhunt/key.md3"); kh_key_dropped = kh_controller.modelindex;