1 #using scripts\codescripts\struct;
3 #using scripts\shared\callbacks_shared;
4 #using scripts\shared\system_shared;
6 #insert scripts\shared\shared.gsh;
19 foreach( team
in level.teams )
21 level.spectateOverride[team] = spawnstruct();
36 self endon(
"disconnect");
43 self endon(
"disconnect");
50 self endon(
"disconnect");
57 level endon (
"game_ended" );
59 for ( index = 0; index < level.players.size; index++ )
66 for ( index = 0; index < level.players.size; index++ )
68 if ( !isdefined(level.players[index]) )
71 if ( level.players[index] ==
self )
74 if ( !(
self IsPlayerOnSameMachine( level.players[index] )) )
77 team = level.players[index].sessionteam;
80 if ( team !=
"spectator" )
84 return self.sessionteam;
89 for ( index = 0 ; index < level.players.size ; index++ )
91 if ( !isdefined( level.players[index] ) )
94 if ( level.players[index] ==
self )
97 if ( !(
self IsPlayerOnSameMachine( level.players[index] ) ) )
100 if ( IsAlive( level.players[index] ) )
109 foreach( team
in level.teams )
111 self allowSpectateTeam( team, allow );
117 foreach( team
in level.teams )
119 if ( team == skip_team )
121 self allowSpectateTeam( team, allow );
127 team =
self.sessionteam;
129 if ( team ==
"spectator" )
133 if (
self IsSplitScreen() && !level.splitscreen )
138 if ( team ==
"spectator" )
141 self allowSpectateTeam(
"freelook",
false );
142 self allowSpectateTeam(
"none",
true );
143 self allowSpectateTeam(
"localplayers",
true );
148 spectateType = level.spectateType;
150 switch( spectateType )
154 self allowSpectateTeam(
"freelook",
false );
155 self allowSpectateTeam(
"none",
true );
156 self allowSpectateTeam(
"localplayers",
false );
163 self allowSpectateTeam(
"none",
false );
164 self allowSpectateTeam(
"freelook",
false );
165 self allowSpectateTeam(
"localplayers",
true );
170 if ( !level.teamBased )
173 self allowSpectateTeam(
"none",
true );
174 self allowSpectateTeam(
"freelook",
false );
175 self allowSpectateTeam(
"localplayers",
true );
177 else if ( isdefined( team ) && isdefined( level.teams[team] ) )
179 self allowSpectateTeam( team,
true );
181 self allowSpectateTeam(
"freelook",
false );
182 self allowSpectateTeam(
"none",
false );
183 self allowSpectateTeam(
"localplayers",
true );
188 self allowSpectateTeam(
"freelook",
false );
189 self allowSpectateTeam(
"none",
false );
190 self allowSpectateTeam(
"localplayers",
true );
195 self allowSpectateTeam(
"freelook",
true );
196 self allowSpectateTeam(
"none",
true );
197 self allowSpectateTeam(
"localplayers",
true );
201 if ( isdefined( team ) && isdefined( level.teams[team] ) )
203 if ( isdefined(level.spectateOverride[team].allowFreeSpectate) )
204 self allowSpectateTeam(
"freelook",
true );
206 if (isdefined(level.spectateOverride[team].allowEnemySpectate))
217 if ( !
self IsSplitScreen() )
220 for ( index = 0; index < level.players.size; index++ )
222 if ( !isdefined(level.players[index]) )
225 if ( level.players[index] ==
self )
228 if ( !(
self IsPlayerOnSameMachine( level.players[index] )) )