]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/client.qc
Merge branch 'terencehill/gameover_stuff' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / client.qc
index b563f354f972c6d568f4469dc0458ff6c6ec28b6..9583118ceacae67335fc8ff8612e17d3b4bd97e5 100644 (file)
@@ -36,6 +36,7 @@
 #include "weapons/weaponsystem.qh"
 
 #include "../common/net_notice.qh"
+#include "../common/net_linked.qh"
 #include "../common/physics/player.qh"
 
 #include "../common/items/_mod.qh"
@@ -283,8 +284,8 @@ void PutObserverInServer(entity this)
        if (this.killcount != FRAGS_SPECTATOR)
        {
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_SPECTATE, this.netname);
-               if(!intermission_running)
-               if(autocvar_g_chat_nospectators == 1 || (!(warmup_stage || gameover) && autocvar_g_chat_nospectators == 2))
+               if(!gameover)
+               if(autocvar_g_chat_nospectators == 1 || (!warmup_stage && autocvar_g_chat_nospectators == 2))
                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CHAT_NOSPECTATORS);
 
                if(this.just_joined == false) {
@@ -338,6 +339,7 @@ void PutObserverInServer(entity this)
        this.hook_time = 0;
        this.deadflag = DEAD_NO;
        this.crouch = false;
+       this.revive_progress = 0;
        this.revival_time = 0;
 
        this.items = 0;
@@ -615,6 +617,7 @@ void PutClientInServer(entity this)
                this.strength_finished = 0;
                this.invincible_finished = 0;
                this.fire_endtime = -1;
+               this.revive_progress = 0;
                this.revival_time = 0;
                this.air_finished = time + 12;
 
@@ -1049,8 +1052,8 @@ ClientPreConnect
 Called once (not at each match start) when a client begins a connection to the server
 =============
 */
-void ClientPreConnect ()
-{ENGINE_EVENT();
+void ClientPreConnect(entity this)
+{
        if(autocvar_sv_eventlog)
        {
                GameLogEcho(sprintf(":connect:%d:%d:%s",
@@ -1189,12 +1192,6 @@ void ClientConnect(entity this)
 
        if (IS_REAL_CLIENT(this))
        {
-               if (!autocvar_g_campaign)
-               {
-                       this.motd_actived_time = -1;
-                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage(this));
-               }
-
                if (g_weaponarena_weapons == WEPSET(TUBA))
                        stuffcmd(this, "cl_cmd settemp chase_active 1\n");
        }
@@ -1221,6 +1218,15 @@ void ClientConnect(entity this)
        });
 
        MUTATOR_CALLHOOK(ClientConnect, this);
+
+       if (IS_REAL_CLIENT(this))
+       {
+               if (!autocvar_g_campaign && !IS_PLAYER(this))
+               {
+                       this.motd_actived_time = -1;
+                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage(this));
+               }
+       }
 }
 /*
 =============
@@ -1604,11 +1610,11 @@ void player_regen(entity this)
 }
 
 bool zoomstate_set;
-void SetZoomState(entity this, float z)
+void SetZoomState(entity this, float newzoom)
 {
-       if(z != this.zoomstate)
+       if(newzoom != this.zoomstate)
        {
-               this.zoomstate = z;
+               this.zoomstate = newzoom;
                ClientData_Touch(this);
        }
        zoomstate_set = true;
@@ -2314,8 +2320,9 @@ void PlayerPreThink (entity this)
        if (IS_PLAYER(this)) {
                CheckRules_Player(this);
 
-               if (intermission_running) {
-                       IntermissionThink(this);
+               if (gameover || intermission_running) {
+                       if(intermission_running)
+                               IntermissionThink(this);
                        return;
                }
 
@@ -2466,8 +2473,9 @@ void PlayerPreThink (entity this)
 
                this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
        }
-       else if (gameover) {
-               if (intermission_running) IntermissionThink(this);
+       else if (gameover || intermission_running) {
+               if(intermission_running)
+                       IntermissionThink(this);
                return;
        }
        else if (IS_OBSERVER(this)) {
@@ -2609,13 +2617,23 @@ void PlayerPostThink (entity this)
        CheatFrame(this);
 
        //CheckPlayerJump();
+       if (gameover)
+       {
+               this.solid = SOLID_NOT;
+               this.takedamage = DAMAGE_NO;
+               set_movetype(this, MOVETYPE_NONE);
+       }
 
        if (IS_PLAYER(this)) {
                DrownPlayer(this);
                CheckRules_Player(this);
                UpdateChatBubble(this);
                if (this.impulse) ImpulseCommands(this);
-               if (intermission_running) return; // intermission or finale
+               if (gameover)
+               {
+                       CSQCMODEL_AUTOUPDATE(this);
+                       return;
+               }
                GetPressedKeys(this);
        }