Skip to content

Rounds Module

George Petrou edited this page Aug 3, 2018 · 4 revisions

About this module

This module handles the rounds system in the game mode.

Enumerations:

Round States

  • ROUND_WAITING = 0
  • ROUND_PREP = 1
  • ROUND_ACTIVE = 2
  • ROUND_POST = 3

Win States

  • WIN_NONE = 0
  • WIN_TIME = 1
  • WIN_INNOCENT = 2
  • WIN_TRAITOR = 3

Console Variables:

ConVar Default Value Flags/Realm Description
ttt_roundtime_seconds 600 Replicated, Archived How long does the round last in seconds.
ttt_rounds_per_map 7 Replicated, Archived How many rounds per map
ttt_dev_preventwin 0 Server Should we allow rounds to end.
ttt_dev_preventstart 0 Server Should we allow rounds to start.
ttt_post_time 30 Server, Archived How long post time lasts in seconds.
ttt_prep_time_initial 60 Server, Archived How much prep time is there for the first round in seconds.
ttt_prep_time 30 Server, Archived How much prep time is there in seconds for any round but the first.

Console Commands

ttt_roundrestart - Restarts the current round. Must be super admin or server console to run this command.

Hooks:

TTT.Rounds.Initialize - Shared

  • Desc: Called when the rounds system is being initialized.

TTT.Rounds.StateChanged - Shared

  • Desc: Called when the round state changed.
  • Arg One: WIN_ enum, the win type.

TTT.Rounds.RoundEnded - Shared

  • Desc: Called when the round ended.
  • Arg One: WIN_ enum, the win type.

TTT.Rounds.MapEnded - Shared

  • Desc: Called when enough rounds have passed that the map should change.
  • Arg One: WIN_ enum, the win type.

TTT.Rounds.ShouldStart - Server

  • Desc: Called when we want to see if we should start a new round.
  • Returns: Boolean, should we start a round.

TTT.Rounds.RoundStarted - Server

  • Desc: Called when we just started a round.

TTT.Rounds.ShouldEnd - Server

  • Desc: Called when we want to see if we should end the current round.
  • Returns: Boolean, should we end the round.

TTT.Rounds.RoundEnded - Server

  • Desc: Called when the round ends.
  • Arg One: WIN_ enum, the round win type.

TTT.Rounds.EnteredPrep - Server

  • Desc: Called when the round entered preparation.

TTT.Rounds.EnteredPost - Server

  • Desc: Called when the round entered post round.

Functions

TTT.Rounds.GetState - Shared

  • Returns: ROUND_ enum, current round state.

TTT.Rounds.IsWaiting - Shared

  • Returns: Boolean, are we in a ROUND_WAITING state.

TTT.Rounds.IsPrep - Shared

  • Returns: Boolean, are we in a ROUND_PREP state.

TTT.Rounds.IsActive - Shared

  • Returns: Boolean, are we in a ROUND_ACTIVE state.

TTT.Rounds.IsPost - Shared

  • Returns: Boolean, are we in a ROUND_POST state.

TTT.Rounds.Initialize - Shared

  • Desc: Call to initialize or re-initialize the round system incase you made any changes you wanted to load on the fly.

TTT.Rounds.GetRoundsLeft - Shared

  • Desc: Gets the number of rounds left before there should be a map change.
  • Returns: Number, of rounds left.

TTT.Rounds.GetEndTime - Shared

  • Desc: Gets the time the round will end relative to CurTime.
  • Returns: Number, when the round will end relative to CurTime.

TTT.Rounds.GetRemainingTime - Shared

  • Desc: Gets the time remaining in the round.
  • Returns: Number, time left in the round.

TTT.Rounds.GetFormattedRemainingTime - Shared

  • Desc: Gets the time remaining in a formatted string like "07:15".
  • Returns: String, formatted time remaining.

TTT.Rounds.GetFormattedState - Shared

  • Desc: Gets a translated name of the current round state.
  • Returns: String, translated current round.

TTT.Rounds.SetState - Server

  • Desc: Sets the current round state.
  • Arg One: ROUND_ enum, to set the state to.
  • Note: Simply changing states won't properly handle all the in-between that happens between round states. Instead use TTT.Rounds.Start/End/EnterPrep/EnterPost.

TTT.Rounds.ShouldStart - Server

  • Desc: Should we start a new round.
  • Returns: Boolean, should we start a new round.

TTT.Rounds.Start - Server

  • Desc: Starts a new round.

TTT.Rounds.ShouldEnd - Server

  • Desc: Should we end the current round.
  • Returns: Boolean, should the current round end.

TTT.Rounds.End - Server

  • Desc: End the round with a given WIN_ enum type.
  • Arg One: WIN_ enum, type of win to consider that round.

TTT.Rounds.CheckForRoundEnd - Server

  • Desc: Checks to see if the round should end and then ends the round with the appropriate WIN_ enum if it should. Use this function after doing something that could potentially warrant a round end.

TTT.Rounds.EnterPrep - Server

  • Desc: Puts the game into preperation mode before a new round begins.

TTT.Rounds.EnterPost - Server

  • Desc: Puts the game into post round mode, after a round ends.

TTT.Rounds.Waiting - Server

  • Desc: Puts the game into waiting mode.

TTT.Rounds.RestartRound - Server

  • Desc: Puts the game back into prep so that a new round can start.

TTT.Rounds.SetEndTime - Server

  • Desc: Sets at what time, relative to CurTime should the round end.
  • Arg One: Number, when the round should end.

TTT.Rounds.AddTime - Server

  • Desc: Adds more time to the current round.
  • Arg One: Number, how much time to add.

TTT.Rounds.RemoveTime - Server

  • Desc: Removes time from the current round.
  • Arg One: Number, how much time to remove from the current round.

Home

Modules

Clone this wiki locally