]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/client.qc
Fix string length checks in world.qc and add VM_TEMPSTRING_MAXSIZE
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / client.qc
index 1f61b18aa2729221c2d4be3d7e5bd5b9fd74d8d0..00063bba214fae3ba064a144ec18bf2983db2eae 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>
@@ -981,7 +982,7 @@ bool findinlist_abbrev(string tofind, string list)
                return false; // empty list or search, just return
 
        // this function allows abbreviated strings!
-       FOREACH_WORD(list, it == substring(tofind, 0, strlen(it)),
+       FOREACH_WORD(list, it != "" && it == substring(tofind, 0, strlen(it)),
        {
                return true;
        });
@@ -1009,6 +1010,8 @@ bool PlayerInIDList(entity p, string idlist)
 
 bool PlayerInList(entity player, string list)
 {
+       if (list == "")
+               return false;
        return boolean(PlayerInIDList(player, list) || PlayerInIPList(player, list));
 }
 
@@ -1041,9 +1044,7 @@ void SendWelcomeMessage(entity this, int msg_type)
        WriteByte(msg_type, boolean(autocvar_g_campaign));
        if (boolean(autocvar_g_campaign))
        {
-               WriteString(msg_type, Campaign_GetTitle());
                WriteByte(msg_type, Campaign_GetLevelNum());
-               WriteString(msg_type, Campaign_GetMessage());
                return;
        }
        WriteString(msg_type, autocvar_hostname);
@@ -1191,7 +1192,7 @@ void ClientConnect(entity this)
        if (PlayerInList(this, autocvar_g_playban_list))
                TRANSMUTE(Observer, this);
 
-       if (PlayerInList(this, autocvar_g_muteban_list)) // muteban
+       if (PlayerInList(this, autocvar_g_chatban_list)) // chatban
                CS(this).muted = true;
 
        MUTATOR_CALLHOOK(ClientConnect, this);
@@ -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,11 +2291,18 @@ 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;
                TRANSMUTE(Player, this);
                PutClientInServer(this);
+
+               .entity weaponentity = weaponentities[0];
+               if(this.(weaponentity).m_weapon == WEP_Null)
+                       W_NextWeapon(this, 0, weaponentity);
+
                return;
        }