self.fixangle = TRUE;
self.crouch = FALSE;
- 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
+ self.view_ofs = '0 0 0'; // so that your view doesn't go into the ceiling with MOVETYPE_FLY_WORLDONLY, previously "PL_VIEW_OFS"
setorigin (self, spot.origin);
- setsize (self, '-16 -16 -24', '16 16 24'); // so that you can't go inside walls with MOVETYPE_FLY
+ setsize (self, PL_CROUCH_MIN, PL_CROUCH_MAX); // give the spectator some space between walls for MOVETYPE_FLY_WORLDONLY
self.prevorigin = self.origin;
self.items = 0;
self.weapons = 0;
else
self.frags = FRAGS_LMS_LOSER;
}
+ else if(g_ca)
+ {
+ if(self.caplayer)
+ self.frags = FRAGS_LMS_LOSER;
+ else
+ self.frags = FRAGS_SPECTATOR;
+ }
else
self.frags = FRAGS_SPECTATOR;
}
if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
self.weapon_load[j] = cvar(strcat("g_balance_", e.netname, "_reload_ammo"));
}
- self.weapon_forbidchange = FALSE;
oldself = self;
self = spot;
self.dmg_save = spectatee.dmg_save;
self.dmg_inflictor = spectatee.dmg_inflictor;
self.angles = spectatee.v_angle;
- self.fixangle = TRUE;
+ if(!self.BUTTON_USE)
+ self.fixangle = TRUE;
setorigin(self, spectatee.origin);
setsize(self, spectatee.mins, spectatee.maxs);
SetZoomState(spectatee.zoomstate);
return 1;
}
-float SpectateNext() {
- other = find(self.enemy, classname, "player");
- if (!other)
+// Returns next available player to spectate if g_ca_spectate_enemies == 0
+entity CA_SpectateNext(entity start) {
+ if (start.team == self.team) {
+ return start;
+ }
+
+ other = start;
+ // continue from current player
+ while(other && other.team != self.team) {
+ other = find(other, classname, "player");
+ }
+
+ if (!other) {
+ // restart from begining
other = find(other, classname, "player");
+ while(other && other.team != self.team) {
+ other = find(other, classname, "player");
+ }
+ }
+
+ return other;
+}
+float SpectateNext() {
+ other = find(self.enemy, classname, "player");
+ if (g_ca && !autocvar_g_ca_spectate_enemies && self.caplayer) {
+ // CA and ca players when spectating enemies is forbidden
+ other = CA_SpectateNext(other);
+ } else {
+ // other modes and ca spectators or spectating enemies is allowed
+ if (!other)
+ other = find(other, classname, "player");
+ }
+
if (other)
self.enemy = other;