]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_client.qc
Merge remote branch 'origin/master' into samual/flyingspectators
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_client.qc
index c5312469a892864b6dc231f92fc76831a4813da9..cb92b0711fa7fd878243677453d7adf380153b64 100644 (file)
@@ -132,9 +132,9 @@ vector Spawn_Score(entity spot, entity playerlist, float teamcheck, float anypoi
        prio = 0;
 
        // filter out spots for the wrong team
-       if(teamcheck)
-       if(spot.team != teamcheck)
-               return '-1 0 0';
+       if(teamcheck >= 0)
+               if(spot.team != teamcheck)
+                       return '-1 0 0';
 
        if(race_spawns)
                if(spot.target == "")
@@ -269,7 +269,7 @@ entity Spawn_FilterOutBadSpots(entity firstspot, entity playerlist, float mindis
                                        spotlist = spot;
 
                                /*
-                               if(teamcheck)
+                               if(teamcheck >= 0)
                                if(spot.team != teamcheck)
                                        error("invalid spawn added");
 
@@ -283,7 +283,7 @@ entity Spawn_FilterOutBadSpots(entity firstspot, entity playerlist, float mindis
 
        /*
                entity e;
-               if(teamcheck)
+               if(teamcheck >= 0)
                        for(e = spotlist; e; e = e.chain)
                        {
                                print("seen ", etos(e), "\n");
@@ -325,10 +325,15 @@ entity SelectSpawnPoint (float anypoint)
        if (spot)
                return spot;
 
-       teamcheck = 0;
-
-       if(!anypoint && have_team_spawns > 0)
-               teamcheck = self.team;
+       if(anypoint)
+               teamcheck = -1;
+       else if(have_team_spawns > 0)
+               teamcheck = self.team; // MUST be team
+       else if(have_team_spawns == 0 && have_noteam_spawns)
+               teamcheck = 0; // MUST be noteam
+       else
+               teamcheck = -1;
+               // if we get here, we either require team spawns but have none, or we require non-team spawns and have none; use any spawn then
 
        // get the list of players
        playerlist = findchain(classname, "player");
@@ -368,7 +373,7 @@ entity SelectSpawnPoint (float anypoint)
                print("spot mindistance: ", vtos(spot.spawnpoint_score), "\n");
 
                entity e;
-               if(teamcheck)
+               if(teamcheck >= 0)
                        for(e = firstspot; e; e = e.chain)
                                if(e.team != teamcheck)
                                        error("invalid spawn found");
@@ -638,8 +643,8 @@ void PutObserverInServer (void)
        self.iscreature = FALSE;
        self.health = -666;
        self.takedamage = DAMAGE_NO;
-       self.solid = SOLID_NOT;
-       self.movetype = MOVETYPE_NOCLIP;
+       self.solid = SOLID_TRIGGER; // FIXME: SOLID_TRIGGER doesn't work for doors, and SOLID_NOT doesn't work for teleporters... can we do what warpzones do to fix this?
+       self.movetype = MOVETYPE_FLY;
        self.flags = FL_CLIENT | FL_NOTARGET;
        self.armorvalue = 666;
        self.effects = 0;
@@ -668,9 +673,9 @@ void PutObserverInServer (void)
        self.fixangle = TRUE;
        self.crouch = FALSE;
 
-       self.view_ofs = PL_VIEW_OFS;
+       self.view_ofs = '0 0 0'; // so that you can't go inside walls with MOVETYPE_FLY, previously "PL_VIEW_OFS" - for some reason this is diff from normal players
        setorigin (self, spot.origin);
-       setsize (self, '0 0 0', '0 0 0');
+       setsize (self, '-16 -16 -24', '16 16 24'); // so that you can't go inside walls with MOVETYPE_FLY
        self.prevorigin = self.origin;
        self.items = 0;
        self.weapons = 0;
@@ -1115,6 +1120,7 @@ float ClientInit_SendEntity(entity to, float sf)
        WriteByte(MSG_ENTITY, autocvar_g_balance_nex_secondary); // client has to know if it should zoom or not
        WriteByte(MSG_ENTITY, autocvar_g_balance_sniperrifle_secondary); // client has to know if it should zoom or not
        WriteByte(MSG_ENTITY, serverflags); // client has to know if it should zoom or not
+       WriteByte(MSG_ENTITY, autocvar_g_balance_minelayer_limit); // minelayer max mines
        WriteCoord(MSG_ENTITY, autocvar_g_trueaim_minrange);
        return TRUE;
 }
@@ -2361,6 +2367,9 @@ void SpectateCopy(entity spectatee) {
        self.weapons = spectatee.weapons;
        self.switchweapon = spectatee.switchweapon;
        self.weapon = spectatee.weapon;
+       self.nex_charge = spectatee.nex_charge;
+       self.nex_chargepool_ammo = spectatee.nex_chargepool_ammo;
+       self.minelayer_mines = spectatee.minelayer_mines;
        self.punchangle = spectatee.punchangle;
        self.view_ofs = spectatee.view_ofs;
        self.v_angle = spectatee.v_angle;