X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcommand%2Fcommon.qc;h=ca59aba6012c7a1d092692bc379609fe616b46f8;hb=5c4ae3ec7458cf4e8d07f6eed4fe24fceea13b70;hp=516c6aa5d8fab4148aee264e7f4d9c63569e77f1;hpb=b9cede9d0dad5c70fb3d3248d27d625bac7fbf2b;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 516c6aa5d..ca59aba60 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -24,11 +24,11 @@ string GetCallerName(entity caller) // verify that the client provided is acceptable for use float VerifyClientEntity(entity client, float must_be_real, float must_be_bots) { - if not(client.flags & FL_CLIENT) + if not(IS_CLIENT(client)) return CLIENT_DOESNT_EXIST; - else if(must_be_real && (clienttype(client) != CLIENTTYPE_REAL)) + else if(must_be_real && !IS_REAL_CLIENT(client)) return CLIENT_NOT_REAL; - else if(must_be_bots && (clienttype(client) != CLIENTTYPE_BOT)) + else if(must_be_bots && !IS_BOT_CLIENT(client)) return CLIENT_NOT_BOT; return CLIENT_ACCEPTABLE; @@ -162,14 +162,9 @@ void print_to(entity to, string input) // used by CommonCommand_timeout() and CommonCommand_timein() to handle game pausing and messaging and such. void timeout_handler_reset() { - entity tmp_player; - timeout_caller = world; timeout_time = 0; timeout_leadtime = 0; - - FOR_EACH_REALPLAYER(tmp_player) - Send_CSQC_Centerprint_Generic_Expire(tmp_player, CPID_TIMEOUT_COUNTDOWN); remove(self); } @@ -184,11 +179,10 @@ void timeout_handler_think() { if(timeout_time > 0) // countdown is still going { - FOR_EACH_REALPLAYER(tmp_player) - Send_CSQC_Centerprint_Generic(tmp_player, CPID_TIMEOUT_COUNTDOWN, "Timeout ends in %d seconds!", 1, timeout_time); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_TIMEOUT_ENDING, timeout_time); if(timeout_time == autocvar_sv_timeout_resumetime) // play a warning sound when only seconds are left - Announce("prepareforbattle"); + Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_PREPARE); self.nextthink = time + TIMEOUT_SLOWMO_VALUE; // think again in one second timeout_time -= 1; // decrease the time counter @@ -214,9 +208,7 @@ void timeout_handler_think() { if(timeout_leadtime > 0) // countdown is still going { - // centerprint the information to every player - FOR_EACH_REALPLAYER(tmp_player) - Send_CSQC_Centerprint_Generic(tmp_player, CPID_TIMEOUT_COUNTDOWN, "Timeout begins in %d seconds!", 1, timeout_leadtime); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_TIMEOUT_BEGINNING, timeout_leadtime); self.nextthink = time + 1; // think again in one second timeout_leadtime -= 1; // decrease the time counter @@ -368,26 +360,6 @@ void CommonCommand_lsmaps(float request, entity caller) } } -void CommonCommand_lsnewmaps(float request, entity caller) -{ - switch(request) - { - case CMD_REQUEST_COMMAND: - { - print_to(caller, lsnewmaps_reply); - return; // never fall through to usage - } - - default: - case CMD_REQUEST_USAGE: - { - print_to(caller, strcat("\nUsage:^3 ", GetCommandPrefix(caller), " lsnewmaps")); - print_to(caller, " No arguments required."); - return; - } - } -} - void CommonCommand_printmaplist(float request, entity caller) { switch(request) @@ -562,10 +534,10 @@ void CommonCommand_timeout(float request, entity caller) // DEAR GOD THIS COMMAN if(timeout_status) { print_to(caller, "^7Error: A timeout is already active."); } else if(vote_called) { print_to(caller, "^7Error: You can not call a timeout while a vote is active."); } - else if(inWarmupStage && !g_warmup_allow_timeout) { print_to(caller, "^7Error: You can not call a timeout in warmup-stage."); } + else if(warmup_stage && !g_warmup_allow_timeout) { print_to(caller, "^7Error: You can not call a timeout in warmup-stage."); } else if(time < game_starttime) { print_to(caller, "^7Error: You can not call a timeout while the map is being restarted."); } else if(caller && (caller.allowed_timeouts < 1)) { print_to(caller, "^7Error: You already used all your timeout calls for this map."); } - else if(caller && (caller.classname != "player")) { print_to(caller, "^7Error: You must be a player to call a timeout."); } + else if(caller && !IS_PLAYER(caller)) { print_to(caller, "^7Error: You must be a player to call a timeout."); } else if((autocvar_timelimit) && (last_possible_timeout < time - game_starttime)) { print_to(caller, "^7Error: It is too late to call a timeout now!"); } else // everything should be okay, proceed with starting the timeout @@ -583,7 +555,7 @@ void CommonCommand_timeout(float request, entity caller) // DEAR GOD THIS COMMAN timeout_handler.think = timeout_handler_think; timeout_handler.nextthink = time; // always let the entity think asap - Announce("timeoutcalled"); + Send_Notification(NOTIF_ALL, world, MSG_ANNCE, ANNCE_TIMEOUT); } } else { print_to(caller, "^1Timeouts are not allowed to be called, enable them with sv_timeout 1.\n"); } @@ -621,7 +593,7 @@ void CommonCommand_who(float request, entity caller, float argc) total_listed_players = 0; FOR_EACH_CLIENT(tmp_player) { - is_bot = (clienttype(tmp_player) == CLIENTTYPE_BOT); + is_bot = (IS_BOT_CLIENT(tmp_player)); if(is_bot) { @@ -644,7 +616,7 @@ void CommonCommand_who(float request, entity caller, float argc) tmp_player.netname, tmp_player.ping, tmp_player.ping_packetloss, - process_time("%02d:%02d:%02d", time - tmp_player.jointime), + process_time(1, time - tmp_player.jointime), tmp_netaddress, tmp_crypto_idfp)); @@ -701,7 +673,6 @@ void CommonCommand_(float request, entity caller) COMMON_COMMAND("info", CommonCommand_info(request, caller, arguments), "Request for unique server information set up by admin") \ COMMON_COMMAND("ladder", CommonCommand_ladder(request, caller), "Get information about top players if supported") \ COMMON_COMMAND("lsmaps", CommonCommand_lsmaps(request, caller), "List maps which can be used with the current game mode") \ - COMMON_COMMAND("lsnewmaps", CommonCommand_lsnewmaps(request, caller), "List maps which have no records or are seemingly unplayed yet") \ COMMON_COMMAND("printmaplist", CommonCommand_printmaplist(request, caller), "Display full server maplist reply") \ COMMON_COMMAND("rankings", CommonCommand_rankings(request, caller), "Print information about rankings") \ COMMON_COMMAND("records", CommonCommand_records(request, caller), "List top 10 records for the current map") \