X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=ed3027a194d1fee080b12c663e37301da8729b9a;hb=27089876c134e7ce9b93655efa313f380705db86;hp=71584d350379869717ce8e3cd1ca6a2a3ce47f24;hpb=3f0620ef10b0c142cfb2f64d87af78c1243766c6;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 71584d350..ed3027a19 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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,30 @@ entity SelectSpawnPoint (float anypoint) if (spot) return spot; - teamcheck = 0; + if(anypoint) + teamcheck = -1; + else if(have_team_spawns > 0) + { + if(have_team_spawns_forteam[self.team] == 0) + { + // we request a spawn for a team, and we have team + // spawns, but that team has no spawns? + if(have_team_spawns[0]) + // try noteam spawns + teamcheck = 0; + else + // if not, any spawn has to do + teamcheck = -1; + } + else + teamcheck = self.team; // MUST be team + } + else if(have_team_spawns == 0 && have_team_spawns[0]) + 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 - if(!anypoint && have_team_spawns > 0) - teamcheck = self.team; // get the list of players playerlist = findchain(classname, "player"); @@ -368,7 +388,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"); @@ -603,7 +623,7 @@ void PutObserverInServer (void) } if(self.flagcarried) - DropFlag(self.flagcarried, world, world); + ctf_Handle_Drop(self); // FIXCTF if(self.ballcarried && g_nexball) DropBall(self.ballcarried, self.origin + self.ballcarried.origin, self.velocity); @@ -1050,8 +1070,16 @@ void PutClientInServer (void) // reset fields the weapons may use for (j = WEP_FIRST; j <= WEP_LAST; ++j) + { weapon_action(j, WR_RESETPLAYER); + // all weapons must be fully loaded when we spawn + entity e; + e = get_weaponinfo(j); + if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars + self.weapon_load[j] = cvar(strcat("g_balance_", e.netname, "_reload_ammo")); + } + oldself = self; self = spot; activator = oldself; @@ -1065,8 +1093,6 @@ void PutClientInServer (void) self.cnt = self.switchweapon; self.weapon = 0; - self.wish_reload = 0; - if(!self.alivetime) self.alivetime = time; } else if(self.classname == "observer" || (g_ca && !allowed_to_spawn)) { @@ -1109,7 +1135,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_sniperrifle_magazinecapacity); // rifle max bullets + WriteByte(MSG_ENTITY, autocvar_g_balance_minelayer_limit); // minelayer max mines WriteCoord(MSG_ENTITY, autocvar_g_trueaim_minrange); return TRUE; } @@ -1794,7 +1820,7 @@ void ClientDisconnect (void) Portal_ClearAll(self); if(self.flagcarried) - DropFlag(self.flagcarried, world, world); + ctf_Handle_Drop(self); // FIXCTF if(self.ballcarried && g_nexball) DropBall(self.ballcarried, self.origin + self.ballcarried.origin, self.velocity); @@ -2341,6 +2367,8 @@ void SpectateCopy(entity spectatee) { self.ammo_nails = spectatee.ammo_nails; self.ammo_rockets = spectatee.ammo_rockets; self.ammo_fuel = spectatee.ammo_fuel; + self.clip_load = spectatee.clip_load; + self.clip_size = spectatee.clip_size; self.effects = spectatee.effects & EFMASK_CHEAP; // eat performance self.health = spectatee.health; self.impulse = 0; @@ -2354,6 +2382,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; @@ -2593,7 +2624,7 @@ PlayerPreThink Called every frame for each client before the physics are run ============= */ -void() ctf_setstatus; +//void() ctf_setstatus; void() nexball_setstatus; .float items_added; void PlayerPreThink (void) @@ -2682,13 +2713,6 @@ void PlayerPreThink (void) return; // the think tics } - if(self.teleport_time) - if(time > self.teleport_time) - { - self.teleport_time = 0; - self.effects = self.effects - (self.effects & EF_NODRAW); - } - if(frametime > 0) // don't do this in cl_movement frames, just in server ticks UpdateSelectedPlayer(); @@ -2882,8 +2906,8 @@ void PlayerPreThink (void) if (g_minstagib) minstagib_ammocheck(); - if(g_ctf) - ctf_setstatus(); + //if(g_ctf) + // ctf_setstatus(); if(g_nexball) nexball_setstatus(); @@ -2943,6 +2967,10 @@ void PlayerPreThink (void) } target_voicescript_next(self); + + // if a player goes unarmed after holding a loaded weapon, empty his clip size and remove the crosshair ammo ring + if(!self.weapon) + self.clip_load = self.clip_size = 0; } float isInvisibleString(string s)