]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/sv_cmd.qc
Merged master
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / sv_cmd.qc
index 8c9d915a213a80e31c35fd2c1fcbfb065921c7c1..dba41cc9cee11d5897f58d569ff60695000b3878 100644 (file)
@@ -134,12 +134,12 @@ void GameCommand_adminmsg(float request, float argc)
                                        }
                                        else
                                        {
-                                               centerprint(client, strcat("^3", admin_name(), ":\n^7", admin_message));
-                                               sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: ", admin_message, "\n"));
+                                               centerprint(client, strcat("^3", GetCallerName(NULL), ":\n^7", admin_message));
+                                               sprint(client, strcat("\{1}\{13}^3", GetCallerName(NULL), "^7: ", admin_message, "\n"));
                                        }
 
-                                       successful = strcat(successful, (successful ? ", " : ""), client.netname);
-                                       LOG_TRACE("Message sent to ", client.netname);
+                                       successful = strcat(successful, (successful ? ", " : ""), playername(client, false));
+                                       LOG_TRACE("Message sent to ", playername(client, false));
                                        continue;
                                }
 
@@ -251,20 +251,15 @@ void GameCommand_bbox(float request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       LOG_INFO("Original size: ", ftos(world.absmin.x), " ", ftos(world.absmin.y), " ", ftos(world.absmin.z));
-                       LOG_INFO(" ", ftos(world.absmax.x), " ", ftos(world.absmax.y), " ", ftos(world.absmax.z), "\n");
-                       LOG_INFO("Currently set size: ", ftos(world.mins.x), " ", ftos(world.mins.y), " ", ftos(world.mins.z));
-                       LOG_INFO(" ", ftos(world.maxs.x), " ", ftos(world.maxs.y), " ", ftos(world.maxs.z), "\n");
-                       LOG_INFO("Solid bounding box size:");
-
+                       vector size_min = '0 0 0';
+                       vector size_max = '0 0 0';
                        tracebox('1 0 0' * world.absmin.x,
                                '0 1 0' * world.absmin.y + '0 0 1' * world.absmin.z,
                                '0 1 0' * world.absmax.y + '0 0 1' * world.absmax.z,
                                '1 0 0' * world.absmax.x,
                                MOVE_WORLDONLY,
                                NULL);
-                       if (trace_startsolid) LOG_INFO(" ", ftos(world.absmin.x));
-                       else LOG_INFO(" ", ftos(trace_endpos.x));
+                       size_min.x = (trace_startsolid) ? world.absmin.x : trace_endpos.x;
 
                        tracebox('0 1 0' * world.absmin.y,
                                '1 0 0' * world.absmin.x + '0 0 1' * world.absmin.z,
@@ -272,8 +267,7 @@ void GameCommand_bbox(float request)
                                '0 1 0' * world.absmax.y,
                                MOVE_WORLDONLY,
                                NULL);
-                       if (trace_startsolid) LOG_INFO(" ", ftos(world.absmin.y));
-                       else LOG_INFO(" ", ftos(trace_endpos.y));
+                       size_min.y = (trace_startsolid) ? world.absmin.y : trace_endpos.y;
 
                        tracebox('0 0 1' * world.absmin.z,
                                '1 0 0' * world.absmin.x + '0 1 0' * world.absmin.y,
@@ -281,8 +275,7 @@ void GameCommand_bbox(float request)
                                '0 0 1' * world.absmax.z,
                                MOVE_WORLDONLY,
                                NULL);
-                       if (trace_startsolid) LOG_INFO(" ", ftos(world.absmin.z));
-                       else LOG_INFO(" ", ftos(trace_endpos.z));
+                       size_min.z = (trace_startsolid) ? world.absmin.z : trace_endpos.z;
 
                        tracebox('1 0 0' * world.absmax.x,
                                '0 1 0' * world.absmin.y + '0 0 1' * world.absmin.z,
@@ -290,8 +283,7 @@ void GameCommand_bbox(float request)
                                '1 0 0' * world.absmin.x,
                                MOVE_WORLDONLY,
                                NULL);
-                       if (trace_startsolid) LOG_INFO(" ", ftos(world.absmax.x));
-                       else LOG_INFO(" ", ftos(trace_endpos.x));
+                       size_max.x = (trace_startsolid) ? world.absmax.x : trace_endpos.x;
 
                        tracebox('0 1 0' * world.absmax.y,
                                '1 0 0' * world.absmin.x + '0 0 1' * world.absmin.z,
@@ -299,8 +291,7 @@ void GameCommand_bbox(float request)
                                '0 1 0' * world.absmin.y,
                                MOVE_WORLDONLY,
                                NULL);
-                       if (trace_startsolid) LOG_INFO(" ", ftos(world.absmax.y));
-                       else LOG_INFO(" ", ftos(trace_endpos.y));
+                       size_max.y = (trace_startsolid) ? world.absmax.y : trace_endpos.y;
 
                        tracebox('0 0 1' * world.absmax.z,
                                '1 0 0' * world.absmin.x + '0 1 0' * world.absmin.y,
@@ -308,10 +299,11 @@ void GameCommand_bbox(float request)
                                '0 0 1' * world.absmin.z,
                                MOVE_WORLDONLY,
                                NULL);
-                       if (trace_startsolid) LOG_INFO(" ", ftos(world.absmax.z));
-                       else LOG_INFO(" ", ftos(trace_endpos.z));
+                       size_max.z = (trace_startsolid) ? world.absmax.z : trace_endpos.z;
 
-                       LOG_INFO("\n");
+                       LOG_INFOF("Original size: %v %v\n", world.absmin, world.absmax);
+                       LOG_INFOF("Currently set size: %v %v\n", world.mins, world.maxs);
+                       LOG_INFOF("Solid bounding box size: %v %v\n", size_min, size_max);
                        return;
                }
 
@@ -542,7 +534,7 @@ void GameCommand_defer_clear(float request, float argc)
                                if (accepted > 0)
                                {
                                        stuffcmd(client, "defer clear\n");
-                                       LOG_INFO("defer clear stuffed to ", client.netname, "\n");
+                                       LOG_INFO("defer clear stuffed to ", playername(client, false), "\n");
                                }
                                else { LOG_INFO("defer_clear: ", GetClientErrorString(accepted, argv(1)), ".\n"); }
 
@@ -1047,11 +1039,11 @@ void GameCommand_moveplayer(float request, float argc)
                                                        if (client.caplayer) client.caplayer = 0;
                                                        PutObserverInServer(client);
 
-                                                       successful = strcat(successful, (successful ? ", " : ""), client.netname);
+                                                       successful = strcat(successful, (successful ? ", " : ""), playername(client, false));
                                                }
                                                else
                                                {
-                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") is already spectating.\n");
+                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") is already spectating.\n");
                                                }
                                                continue;
                                        }
@@ -1071,7 +1063,7 @@ void GameCommand_moveplayer(float request, float argc)
                                                                if (team_id == client.team)  // already on the destination team
                                                                {
                                                                        // keep the forcing undone
-                                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7.\n"));
+                                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7.\n"));
                                                                        continue;
                                                                }
                                                                else if (team_id == 0)  // auto team
@@ -1099,9 +1091,15 @@ void GameCommand_moveplayer(float request, float argc)
 
                                                                // If so, lets continue and finally move the player
                                                                client.team_forced = 0;
-                                                               MoveToTeam(client, team_id, 6);
-                                                               successful = strcat(successful, (successful ? ", " : ""), client.netname);
-                                                               LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") has been moved to the ", Team_ColoredFullName(team_id), "^7.\n");
+                                                               if (MoveToTeam(client, team_id, 6))
+                                                               {
+                                                                       successful = strcat(successful, (successful ? ", " : ""), playername(client, false));
+                                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") has been moved to the ", Team_ColoredFullName(team_id), "^7.\n");
+                                                               }
+                                                               else
+                                                               {
+                                                                       LOG_INFO("Unable to move player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ")");
+                                                               }
                                                                continue;
                                                        }
                                                        else
@@ -1152,7 +1150,7 @@ void GameCommand_nospectators(float request)
                        FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_SPEC(it) || IS_OBSERVER(it)) && !it.caplayer, LAMBDA(
                                if(!it.caplayer)
                                {
-                                       it.spectatortime = time;
+                                       CS(it).spectatortime = time;
                                        Send_Notification(NOTIF_ONE_ONLY, it, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
                                }
                        ));