/**
 * Chase UI
 */
#Const Version    "2017-04-28"
#Const ScriptName "ManiaApps/Nadeo/TrackMania/Chase_Server.Script.txt"

// ---------------------------------- //
// Functions
// ---------------------------------- //
// ---------------------------------- //
// Public
// ---------------------------------- //
// ---------------------------------- //
/** Return the version number of the script
 *
 *  @return                           The version number of the script
 */
Text GetScriptVersion() {
  return Version;
}

// ---------------------------------- //
/** Return the name of the script
 *
 *  @return                           The name of the script
 */
Text GetScriptName() {
  return ScriptName;
}

// ---------------------------------- //
/** Send the login of the next relay
 *  player to the UI
 *
 *  @param  _Login                    The login of the next relay player
 */
Void SetRelayPlayer(CTeam _Team, Text _Login) {
  if (_Team == Null) return;

  declare netwrite Net_MAChase_NextRelayLogin for _Team = "";
  Net_MAChase_NextRelayLogin = _Login;
}

// ---------------------------------- //
/** Enable or disable the display of the header
 *
 *	@param	_Enable										True to display
 *																		False to hide
 */
Void SetHeaderVisibility(Boolean _Enable) {
	declare netwrite Net_MAChase_HeaderIsVisible for Teams[0] = True;
	Net_MAChase_HeaderIsVisible = _Enable;
}

// ---------------------------------- //
/// Unload the library
Void Unload() {
	SetHeaderVisibility(True);
	
  foreach (Team in Teams) {
    SetRelayPlayer(Team, "");
  }
}

// ---------------------------------- //
/// Load the library
Void Load() {
  Unload();
}