]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Alternative way of making auxiliary crosshairs spectatable
authorMario <mario@smbclan.net>
Thu, 8 Feb 2018 13:24:16 +0000 (23:24 +1000)
committerMario <mario@smbclan.net>
Thu, 8 Feb 2018 13:24:16 +0000 (23:24 +1000)
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/server/client.qc

index 1fbd80210475debd33e63fc5823ca4dd114214bb..0cd864c382451af7d335aca6c6c7939268b0798e 100644 (file)
@@ -26,8 +26,8 @@ bool SendAuxiliaryXhair(entity this, entity to, int sf)
 
 bool AuxiliaryXhair_customize(entity this, entity client)
 {
-       //entity e = WaypointSprite_getviewentity(client);
-       entity axh = client.(AuxiliaryXhair[this.cnt]);
+       entity e = WaypointSprite_getviewentity(client);
+       entity axh = e.(AuxiliaryXhair[this.cnt]);
        return axh.owner == this.owner; // cheaply check if the client's axh owner is the same as our real owner
 }
 
index 749e59f142f8c5105523fefbd4e3dad850638ab0..c460f9ddedf086a59071c14600bef18e6dc0b8e5 100644 (file)
@@ -357,14 +357,6 @@ void PutObserverInServer(entity this)
 
        //this.spawnpoint_targ = NULL; // keep it so they can return to where they were?
 
-       for(int slot = 0; slot < MAX_AXH; ++slot)
-       {
-               entity axh = this.(AuxiliaryXhair[slot]);
-               this.(AuxiliaryXhair[slot]) = NULL;
-               if(axh && axh.owner == this)
-                       delete(axh);
-       }
-
        this.weaponmodel = "";
        for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
@@ -649,16 +641,17 @@ void PutPlayerInServer(entity this)
 
        this.viewloc = NULL;
 
-       this.spawnpoint_targ = NULL;
-
        for(int slot = 0; slot < MAX_AXH; ++slot)
        {
                entity axh = this.(AuxiliaryXhair[slot]);
                this.(AuxiliaryXhair[slot]) = NULL;
-               if(axh && axh.owner == this)
+
+               if(axh.owner == this && axh != NULL && !wasfreed(axh))
                        delete(axh);
        }
 
+       this.spawnpoint_targ = NULL;
+
        this.crouch = false;
        this.view_ofs = STAT(PL_VIEW_OFS, this);
        setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
@@ -1811,11 +1804,6 @@ void SpectateCopy(entity this, entity spectatee)
                this.(weaponentity) = spectatee.(weaponentity);
        }
 
-       for(int slot = 0; slot < MAX_AXH; ++slot)
-       {
-               this.(AuxiliaryXhair[slot]) = spectatee.(AuxiliaryXhair[slot]);
-       }
-
     anticheat_spectatecopy(this, spectatee);
        this.hud = spectatee.hud;
        if(spectatee.vehicle)