]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/client.qc
Merge branch 'terencehill/misc_stuff' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / client.qc
index 1f61b18aa2729221c2d4be3d7e5bd5b9fd74d8d0..c037662846bb66e28b2649e221282ec018f3ee5d 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <common/csqcmodel_settings.qh>
 #include <common/deathtypes/all.qh>
+#include <common/debug.qh>
 #include <common/effects/all.qh>
 #include <common/effects/qc/globalsound.qh>
 #include <common/ent_cs.qh>
@@ -2097,6 +2098,32 @@ bool joinAllowed(entity this)
        return true;
 }
 
+void show_entnum(entity this)
+{
+       // waypoint editor implements a similar feature for waypoints
+       if (waypointeditor_enabled)
+               return;
+
+       if (wasfreed(this.wp_aimed))
+               this.wp_aimed = NULL;
+
+       WarpZone_crosshair_trace_plusvisibletriggers(this);
+       entity ent = NULL;
+       if (trace_ent)
+       {
+               ent = trace_ent;
+               if (ent != this.wp_aimed)
+               {
+                       string str = sprintf(
+                               "^7ent #%d\n^8 netname: ^3%s\n^8 classname: ^5%s\n^8 origin: ^2'%s'",
+                               etof(ent), ent.netname, ent.classname, vtos(ent.origin));
+                       debug_text_3d((ent.absmin + ent.absmax) * 0.5, str, 0, 7, '0 0 0');
+               }
+       }
+       if (this.wp_aimed != ent)
+               this.wp_aimed = ent;
+}
+
 .string shootfromfixedorigin;
 .bool dualwielding_prev;
 bool PlayerThink(entity this)
@@ -2118,6 +2145,8 @@ bool PlayerThink(entity this)
 
        if (frametime) player_powerups(this);
 
+       if (frametime && autocvar_sv_show_entnum) show_entnum(this);
+
        if (IS_DEAD(this)) {
                if (this.personal && g_race_qualifying) {
                        if (time > this.respawn_time) {
@@ -2262,6 +2291,8 @@ void ObserverOrSpectatorThink(entity this)
                }
        }
 
+       if (frametime && autocvar_sv_show_entnum) show_entnum(this);
+
        if (IS_BOT_CLIENT(this) && !CS(this).autojoin_checked)
        {
                CS(this).autojoin_checked = true;