]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/client.qc
Merge branch 'master' into Mario/wepent_experimental
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / client.qc
index ec35ccb616baa4835bcde47ef5b576fb790f7896..6ce1cd62f9234f5fcc91aed550c75863215b66b3 100644 (file)
@@ -37,6 +37,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"
@@ -298,6 +299,8 @@ void PutObserverInServer(entity this)
        TRANSMUTE(Observer, this);
        this.iscreature = false;
        this.teleportable = TELEPORT_SIMPLE;
+       if(this.damagedbycontents)
+               IL_REMOVE(g_damagedbycontents, this);
        this.damagedbycontents = false;
        this.health = FRAGS_SPECTATOR;
        SetSpectatee_status(this, etof(this));
@@ -517,6 +520,8 @@ void PutClientInServer(entity this)
                this.wasplayer = true;
                this.iscreature = true;
                this.teleportable = TELEPORT_NORMAL;
+               if(!this.damagedbycontents)
+                       IL_PUSH(g_damagedbycontents, this);
                this.damagedbycontents = true;
                set_movetype(this, MOVETYPE_WALK);
                this.solid = SOLID_SLIDEBOX;
@@ -618,6 +623,8 @@ void PutClientInServer(entity this)
                FixPlayermodel(this);
                this.drawonlytoclient = NULL;
 
+               this.viewloc = NULL;
+
                this.crouch = false;
                this.view_ofs = STAT(PL_VIEW_OFS, this);
                setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
@@ -711,7 +718,6 @@ void PutClientInServer(entity this)
 
 void ClientInit_misc(entity this);
 
-.float ebouncefactor, ebouncestop; // electro's values
 // TODO do we need all these fields, or should we stop autodetecting runtime
 // changes and just have a console command to update this?
 bool ClientInit_SendEntity(entity this, entity to, int sf)
@@ -1213,6 +1219,9 @@ void ClientConnect(entity this)
        if (IS_REAL_CLIENT(this))
                sv_notice_join(this);
 
+       // update physics stats (players can spawn before physics runs)
+       Physics_UpdateStats(this, PHYS_HIGHSPEED(this));
+
        IL_EACH(g_initforplayer, it.init_for_player, {
                it.init_for_player(it, this);
        });
@@ -1273,6 +1282,8 @@ void ClientDisconnect(entity this)
        this.playerid = 0;
        ReadyCount();
        if (vote_called && IS_REAL_CLIENT(this)) VoteCount(false);
+
+       ONREMOVE(this);
 }
 
 void ChatBubbleThink(entity this)
@@ -1674,12 +1685,19 @@ void SpectateCopy(entity this, entity spectatee)
        this.angles = spectatee.v_angle;
        STAT(FROZEN, this) = STAT(FROZEN, spectatee);
        this.revive_progress = spectatee.revive_progress;
+       this.viewloc = spectatee.viewloc;
        if(!PHYS_INPUT_BUTTON_USE(this) && STAT(CAMERA_SPECTATOR, this) != 2)
                this.fixangle = true;
        setorigin(this, spectatee.origin);
        setsize(this, spectatee.mins, spectatee.maxs);
        SetZoomState(this, spectatee.zoomstate);
 
+       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+       {
+               .entity weaponentity = weaponentities[slot];
+               this.(weaponentity) = spectatee.(weaponentity);
+       }
+
     anticheat_spectatecopy(this, spectatee);
        this.hud = spectatee.hud;
        if(spectatee.vehicle)