X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fgamemode_keyhunt.qc;h=d6413d33fab9d1500219fbd0e934d6357aa27507;hb=fbb2508f740a7458edb2517369241b40cc02b744;hp=decada0312d4536537d9ab519b5b46cb822a04c8;hpb=dc3538ad5afba59f36a79011ec6997553c851c25;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc index decada031..d6413d33f 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; } @@ -404,6 +412,13 @@ void kh_Key_Damage(entity inflictor, entity attacker, float damage, float deatht { if(self.owner) return; + if(ITEM_DAMAGE_NEEDKILL(deathtype)) + { + // touching lava, or hurt trigger + // what shall we do? + // immediately return is bad + // maybe start a shorter countdown? + } if(vlen(force) <= 0) return; if(time > self.pushltime) @@ -433,6 +448,15 @@ void kh_Key_Touch() // runs many, many times when a key has been dropped and ca if(self.owner) // already carried return; + + if(ITEM_TOUCH_NEEDKILL()) + { + // touching sky, or nodrop + // what shall we do? + // immediately return is bad + // maybe start a shorter countdown? + } + if(other.classname != "player") return; if(other.deadflag != DEAD_NO) @@ -486,7 +510,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 @@ -521,6 +545,8 @@ void kh_WinnerTeam(float teem) // runs when a team wins first = TRUE; midpoint = '0 0 0'; + firstorigin = '0 0 0'; + lastorigin = '0 0 0'; FOR_EACH_KH_KEY(key) { vector thisorigin; @@ -685,11 +711,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 +888,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 +905,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,26 +918,26 @@ 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) { teem = kh_Team_ByID(i); players = 0; - entity my_player; + entity my_player = world; FOR_EACH_PLAYER(player) if(player.deadflag == DEAD_NO) if(!player.BUTTON_CHAT) @@ -925,7 +951,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 +1003,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;