Closed lancehilliard closed 11 years ago
As far as i know shine and vanilla have no "tournament mode". Only NS2Stats has a tournament mode atm. To get if NS2Stats TM is enabled use RBPS.RBPSconfig.tournamentMode
BTW im writting a "tournament mode" plugin for shine atm,so why exactly do you need to check this?
We play scrims/pickups on the public TGNS server, and we use tournament mode to play them. We call them "captains games", wherein one person on each team picks the rest of the team. We turn tournament mode on and off depending on whether or not we're playing "captains games". I guess DAK is what's made tournament mode possible for us so far (we don't run NS2Stats). I thought that was stock NS the whole time. I'm surprised.
More pointedly to your question: I guess the only feature of tournament mode that we really need is the ability to not start the game until both teams type ready. More precisely: until the captain on each team types ready (my mod could manage who's captain and make sure only /they/ had rights to the command.
Come to think of it, setting tournament mode aside...
Is there a way in Shine that I can prevent the start of the game until I manually (programmatically, triggered by logic) start it? I don't mind writing code to make that happen. I'm just not sure what I'd manipulate to pull that off.
One idea: no one can enter the chair in "captains games" pre-game until the captain(s) allow it. Therefore, the game can't start until the captains "ready up".
Look at my pregame extension (though it's quite messy), it essentially blocks the CheckGameStart
event and the UpdatePregame
event until its conditions for starting are met.
Basically,
function Plugin:CheckGameStart( Gamerules )
--Do all your game start checking here...
return false
end
function Plugin:UpdatePregame( Gamerules )
--If the game state is kGameState.PreGame, you should return false here too.
end
--Call this to start the game, passing in Gamerules.
function Plugin:StartGame( Gamerules )
Gamerules:ResetGame()
Gamerules:SetGameState( kGameState.Countdown )
Gamerules.countdownTime = kCountDownLength
Gamerules.lastCountdownPlayed = nil
for _, Player in ientitylist( Shared.GetEntitiesWithClassname( "Player" ) ) do
if Player.ResetScores then
Player:ResetScores()
end
end
end
It's a bit silly that the NS2 Gamerules class doesn't provide a way to start the game by itself.
Delicious. Thank you. On Aug 18, 2013 8:14 AM, "Person8880" notifications@github.com wrote:
Look at my pregame extension, it essentially blocks the CheckGameStartevent and the UpdatePregame event until its conditions for starting are met.
Basically,
function Plugin:CheckGameStart( Gamerules ) --Do all your game start checking here...
return falseend
function Plugin:UpdatePregame( Gamerules ) --If the game state is kGameState.PreGame, you should return false here too.end --Call this to start the game, passing in Gamerules.function Plugin:StartGame( Gamerules ) Gamerules:ResetGame() Gamerules:SetGameState( kGameState.Countdown ) Gamerules.countdownTime = kCountDownLength Gamerules.lastCountdownPlayed = nil
for _, Player in ientitylist( Shared.GetEntitiesWithClassname( "Player" ) ) do if Player.ResetScores then Player:ResetScores() end endend
— Reply to this email directly or view it on GitHubhttps://github.com/Person8880/Shine/issues/177#issuecomment-22830261 .
For denying ppl access to commchair Plugin:CommLoginPlayer(Building, Player) should do that job.
BTW here is my current state of work on the tournament mode: https://github.com/BrightPaul/Shine/blob/tornamentmode/lua/shine/extensions/tournamentmode.lua
How can I use Shine's API (or NS2's stock API, if that applies) to determine if tournament mode is enabled on the server?