aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_hs.gnut
blob: f4269ac42eb81f2802ef481a414bf3b8eebc7ec7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
global function Sh_GamemodeHideAndSeek_Init

global const string GAMEMODE_HIDEANDSEEK = "hs"
global const int HIDEANDSEEK_TEAM_SEEKER = TEAM_IMC
global const int HIDEANDSEEK_TEAM_HIDER = TEAM_MILITIA

void function Sh_GamemodeHideAndSeek_Init()
{
	// create custom gamemode
	AddCallback_OnCustomGamemodesInit( CreateGamemodeHideAndSeek )
	AddCallback_OnRegisteringCustomNetworkVars( HideAndSeekRegisterNetworkVars )
}

void function CreateGamemodeHideAndSeek()
{
	GameMode_Create( GAMEMODE_HIDEANDSEEK )
	GameMode_SetName( GAMEMODE_HIDEANDSEEK, "#GAMEMODE_hs" )
	GameMode_SetDesc( GAMEMODE_HIDEANDSEEK, "#PL_hs_desc" )
	GameMode_SetGameModeAnnouncement( GAMEMODE_HIDEANDSEEK, "ffa_modeDesc" )
	GameMode_SetColor( GAMEMODE_HIDEANDSEEK, [147, 204, 57, 255] )
	
	AddPrivateMatchMode( GAMEMODE_HIDEANDSEEK ) // add to private lobby modes
	AddPrivateMatchModeSettingEnum( "#GAMEMODE_hs", "hideandseek_balance_teams", [ "Disabled", "Enabled" ], "1" )
	AddPrivateMatchModeSettingArbitrary( "#GAMEMODE_hs", "hideandseek_hiding_time", "60" )
	
	#if SERVER
		GameMode_AddServerInit( GAMEMODE_HIDEANDSEEK, GamemodeHideAndSeek_Init )
		GameMode_SetPilotSpawnpointsRatingFunc( GAMEMODE_HIDEANDSEEK, RateSpawnpoints_Generic )
		GameMode_SetTitanSpawnpointsRatingFunc( GAMEMODE_HIDEANDSEEK, RateSpawnpoints_Generic )
	#elseif CLIENT
		GameMode_AddClientInit( GAMEMODE_HIDEANDSEEK, ClGamemodeHideAndSeek_Init )
	#endif
	#if !UI
		GameMode_SetScoreCompareFunc( GAMEMODE_HIDEANDSEEK, CompareAssaultScore )
	#endif
}

void function HideAndSeekRegisterNetworkVars()
{
	if ( GAMETYPE != GAMEMODE_HIDEANDSEEK )
		return
		
	Remote_RegisterFunction( "ServerCallback_ShowHideAndSeekCountdown" )
	Remote_RegisterFunction( "ServerCallback_SeekersIncoming" )
	Remote_RegisterFunction( "ServerCallback_LastHiderAlive" )
	Remote_RegisterFunction( "ServerCallback_AnnounceHideAndSeekRole" )
}