aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Custom/mod/scripts/vscripts/gamemodes
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-10-14 21:01:40 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-10-14 21:01:40 +0100
commit9a2778eabc7ba968968e41dda9f03525d6c5383d (patch)
tree6d1c5dc64754d542d68a7f47742a701a4eec9308 /Northstar.Custom/mod/scripts/vscripts/gamemodes
parentc0a0c7e502f2bc99185d79a485b965f63de7a203 (diff)
downloadNorthstarMods-9a2778eabc7ba968968e41dda9f03525d6c5383d.tar.gz
NorthstarMods-9a2778eabc7ba968968e41dda9f03525d6c5383d.zip
oh fuck i forgot to commit for a while
Diffstat (limited to 'Northstar.Custom/mod/scripts/vscripts/gamemodes')
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut10
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut2
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_hs.gnut191
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut6
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_kr.gnut2
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_hs.gnut91
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_hs.gnut47
7 files changed, 337 insertions, 12 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut
index b59cd2dd..00c19310 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_fastball.gnut
@@ -27,7 +27,6 @@ void function GamemodeFastball_Init()
SetTimeoutWinnerDecisionFunc( FastballDecideWinner )
AddCallback_OnClientConnected( FastballInitPlayer )
- AddCallback_OnPlayerKilled( FastballOnPlayerKilled ) // move this to a system in _gamestate soon!!
// setup spawns
// first is a, second is b, third is c
@@ -164,15 +163,6 @@ function FastballOnPanelHacked( panel, player, success )
}
}
-void function FastballOnPlayerKilled( entity victim, entity attacker, var damageInfo )
-{
- if ( !victim.IsPlayer() || GetGameState() != eGameState.Playing )
- return
-
- if ( GetPlayerArrayOfTeam_Alive( victim.GetTeam() ).len() == 0 )
- SetWinner( GetOtherTeam( victim.GetTeam() ) )
-}
-
int function FastballDecideWinner()
{
int militiaPanels
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut
index b9ee40f1..e0178034 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut
@@ -5,7 +5,7 @@ void function GamemodeGG_Init()
SetSpawnpointGamemodeOverride( FFA )
SetShouldUseRoundWinningKillReplay( true )
- Evac_SetEnabled( false )
+ ClassicMP_ForceDisableEpilogue( true )
SetLoadoutGracePeriodEnabled( false ) // prevent modifying loadouts with grace period
SetWeaponDropsEnabled( false )
Riff_ForceTitanAvailability( eTitanAvailability.Never )
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_hs.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_hs.gnut
new file mode 100644
index 00000000..bc65e0b6
--- /dev/null
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_hs.gnut
@@ -0,0 +1,191 @@
+global function GamemodeHideAndSeek_Init
+
+struct {
+ entity intermissionCam
+ array<entity> droppodSpawns
+
+ float hidingTime
+ bool autobalance
+
+ float hidingStartTime
+} file
+
+void function GamemodeHideAndSeek_Init()
+{
+ SetSpawnpointGamemodeOverride( FFA )
+ Riff_ForceTitanAvailability( eTitanAvailability.Never )
+ Riff_ForceBoostAvailability( eBoostAvailability.Disabled )
+ SetRespawnsEnabled( false )
+ Riff_ForceSetEliminationMode( eEliminationMode.Pilots )
+
+ SetTimeoutWinnerDecisionFunc( HideAndSeekDecideWinner )
+ ClassicMP_SetCustomIntro( GamemodeHideAndSeekIntroSetup, 0.0 )
+
+ AddCallback_OnPlayerRespawned( SetupHideAndSeekPlayer )
+ AddCallback_OnPlayerKilled( TryNotifyLastPlayerAlive )
+ AddSpawnCallback( "info_intermission", SetIntermissionCam )
+ AddSpawnCallback( "info_spawnpoint_droppod_start", AddDroppodSpawn )
+
+ file.hidingTime = GetCurrentPlaylistVarFloat( "hideandseek_hiding_time", 60.0 )
+ file.autobalance = GetCurrentPlaylistVarInt( "hideandseek_balance_teams", 1 ) == 1
+}
+
+void function GamemodeHideAndSeekIntroSetup()
+{
+ AddCallback_GameStateEnter( eGameState.Prematch, HideAndSeekIntroPrematch )
+ AddCallback_OnClientConnected( AddPlayerToHideAndSeekIntro )
+}
+
+void function SetIntermissionCam( entity cam )
+{
+ file.intermissionCam = cam
+}
+
+void function AddDroppodSpawn( entity spawn )
+{
+ file.droppodSpawns.append( spawn )
+}
+
+void function AddPlayerToHideAndSeekIntro( entity player )
+{
+ if ( GetGameState() < eGameState.Prematch || Time() - file.hidingStartTime > file.hidingTime )
+ return
+
+ // seeker/hider autobalance
+ // try to have 1/6 of players be seekers
+ if ( file.autobalance )
+ {
+ int wantedSeekers = int( max( 1, GetPlayerArray().len() / 6 ) )
+
+ if ( GetPlayerArrayOfTeam( HIDEANDSEEK_TEAM_SEEKER ).len() < wantedSeekers )
+ SetTeam( player, HIDEANDSEEK_TEAM_SEEKER )
+ }
+
+ ScreenFadeFromBlack( player, 1.0, 0.75 )
+ Remote_CallFunction_NonReplay( player, "ServerCallback_ShowHideAndSeekCountdown", file.hidingStartTime + file.hidingTime )
+
+ if ( player.GetTeam() == HIDEANDSEEK_TEAM_HIDER )
+ {
+ player.kv.visibilityFlags = ENTITY_VISIBLE_TO_FRIENDLY
+ Highlight_ClearEnemyHighlight( player )
+
+ thread HiderIntroThread( player )
+ }
+ else
+ thread SeekerIntroThread( player )
+
+ thread DelayedRoleAnnounce( player )
+}
+
+void function HideAndSeekIntroPrematch()
+{
+ ClassicMP_OnIntroStarted()
+
+ file.hidingStartTime = Time()
+
+ foreach ( entity player in GetPlayerArray() )
+ AddPlayerToHideAndSeekIntro( player )
+
+ // this intro is mostly done in playing, so just finish the intro up now and we can do fully custom logic from here
+ WaitFrame()
+ ClassicMP_OnIntroFinished()
+
+ thread GlobalSeekerIntroThread()
+}
+
+void function HiderIntroThread( entity player )
+{
+ RespawnAsPilot( player )
+
+ wait ( file.hidingStartTime + file.hidingTime ) - Time()
+
+ player.kv.visibilityFlags = ENTITY_VISIBLE_TO_EVERYONE // make sure everyone can see us again
+}
+
+void function SeekerIntroThread( entity player )
+{
+ MuteHalfTime( player )
+
+ player.SetObserverModeStaticPosition( file.intermissionCam.GetOrigin() )
+ player.SetObserverModeStaticAngles( file.intermissionCam.GetAngles() )
+ player.StartObserverMode( OBS_MODE_STATIC_LOCKED )
+
+ wait ( file.hidingStartTime + file.hidingTime ) - Time()
+ UnMuteAll( player )
+}
+
+void function DelayedRoleAnnounce( entity player )
+{
+ wait 1.75
+ Remote_CallFunction_NonReplay( player, "ServerCallback_AnnounceHideAndSeekRole" )
+}
+
+void function GlobalSeekerIntroThread()
+{
+ wait file.hidingTime
+
+
+ PlayMusicToAll( eMusicPieceID.GAMEMODE_1 )
+ foreach ( entity hider in GetPlayerArrayOfTeam( HIDEANDSEEK_TEAM_HIDER ) )
+ Remote_CallFunction_NonReplay( hider, "ServerCallback_SeekersIncoming" )
+
+ array<entity> seekers = GetPlayerArrayOfTeam( HIDEANDSEEK_TEAM_SEEKER )
+ entity podSpawn = file.droppodSpawns.getrandom()
+ SpawnPlayersInDropPod( seekers, podSpawn.GetOrigin(), podSpawn.GetAngles() )
+
+ foreach ( entity seeker in seekers )
+ if ( IsValid( seeker ) )
+ Highlight_SetEnemyHighlight( seeker, "enemy_sonar" )
+}
+
+void function SetupHideAndSeekPlayer( entity player )
+{
+ foreach ( entity weapon in player.GetMainWeapons() )
+ player.TakeWeapon( weapon.GetWeaponClassName() )
+
+ player.TakeWeapon( player.GetOffhandWeapon( OFFHAND_ORDNANCE ).GetWeaponClassName() )
+
+ player.GiveWeapon( "mp_weapon_rocket_launcher" )
+ player.SetActiveWeaponByName( "mp_weapon_rocket_launcher" )
+
+ Highlight_SetFriendlyHighlight( player, "sp_friendly_pilot" )
+
+ if ( player.GetTeam() == HIDEANDSEEK_TEAM_HIDER )
+ {
+ player.TakeWeapon( player.GetMeleeWeapon().GetWeaponClassName() )
+
+ // set visibility flags if we're hiding, so seekers can't see us on intermission cam
+ if ( Time() - file.hidingStartTime < file.hidingTime )
+ player.kv.visiblityFlags = ENTITY_VISIBLE_TO_FRIENDLY
+
+ // remove red outline, ideally should work tm
+ Highlight_ClearEnemyHighlight( player )
+ }
+ else
+ player.TakeWeapon( "mp_weapon_grenade_sonar" ) // seekers should not have pulse blade
+}
+
+void function TryNotifyLastPlayerAlive( entity victim, entity attacker, var damageInfo )
+{
+ if ( victim.GetTeam() == HIDEANDSEEK_TEAM_HIDER )
+ {
+ array<entity> hiders = GetPlayerArrayOfTeam( HIDEANDSEEK_TEAM_HIDER )
+ if ( hiders.len() == 1 )
+ {
+ PlayMusicToAll( eMusicPieceID.GAMEMODE_2 )
+
+ // let them know they're the last hider
+ Remote_CallFunction_NonReplay( hiders[ 0 ], "ServerCallback_LastHiderAlive" )
+ StimPlayer( hiders[ 0 ], 9999.9 ) // can't do endless since we don't get the visual effect in endless
+
+ // tell seekers
+ foreach ( entity player in GetPlayerArrayOfTeam( HIDEANDSEEK_TEAM_SEEKER ) )
+ Remote_CallFunction_NonReplay( player, "ServerCallback_LastHiderAlive" )
+ }
+ }
+}
+
+int function HideAndSeekDecideWinner()
+{
+ return HIDEANDSEEK_TEAM_HIDER // on timeout, hiders always win
+} \ No newline at end of file
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut
index 8706d53b..b2e76aaf 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut
@@ -13,6 +13,7 @@ void function GamemodeInfection_Init()
Riff_ForceTitanAvailability( eTitanAvailability.Never )
Riff_ForceBoostAvailability( eBoostAvailability.Disabled )
+ SetShouldPlayerStartBleedoutFunc( InfectionShouldPlayerStartBleedout )
AddCallback_OnClientConnected( InfectionInitPlayer )
AddCallback_OnPlayerKilled( InfectionOnPlayerKilled )
AddCallback_OnPlayerRespawned( RespawnInfected )
@@ -176,4 +177,9 @@ int function TimeoutCheckSurvivors()
return INFECTION_TEAM_SURVIVOR
return INFECTION_TEAM_INFECTED
+}
+
+bool function InfectionShouldPlayerStartBleedout( entity player, var damageInfo )
+{
+ return player.GetTeam() != INFECTION_TEAM_INFECTED
} \ No newline at end of file
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_kr.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_kr.gnut
index cf9d6bc5..7a226e21 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_kr.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_kr.gnut
@@ -13,7 +13,7 @@ void function GamemodeKR_Init()
SetSpawnpointGamemodeOverride( FFA )
- Evac_SetEnabled( false )
+ ClassicMP_ForceDisableEpilogue( true )
Riff_ForceTitanAvailability( eTitanAvailability.Never )
Riff_ForceBoostAvailability( eBoostAvailability.Disabled )
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_hs.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_hs.gnut
new file mode 100644
index 00000000..8bfbb10e
--- /dev/null
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_hs.gnut
@@ -0,0 +1,91 @@
+global function ClGamemodeHideAndSeek_Init
+global function ServerCallback_ShowHideAndSeekCountdown
+global function ServerCallback_AnnounceHideAndSeekRole
+global function ServerCallback_SeekersIncoming
+global function ServerCallback_LastHiderAlive
+
+struct {
+ var countdownRui
+} file
+
+void function ClGamemodeHideAndSeek_Init()
+{
+ ClGameState_RegisterGameStateAsset( $"ui/gamestate_info_lts.rpak" )
+
+ RegisterLevelMusicForTeam( eMusicPieceID.GAMEMODE_1, "music_mp_fd_midwave", HIDEANDSEEK_TEAM_SEEKER )
+ RegisterLevelMusicForTeam( eMusicPieceID.GAMEMODE_1, "music_skyway_01_intro", HIDEANDSEEK_TEAM_HIDER )
+
+ RegisterLevelMusicForTeam( eMusicPieceID.GAMEMODE_2, "music_skyway_04_smartpistolrun", TEAM_IMC )
+ RegisterLevelMusicForTeam( eMusicPieceID.GAMEMODE_2, "music_skyway_04_smartpistolrun", TEAM_MILITIA )
+}
+
+void function ServerCallback_ShowHideAndSeekCountdown( float endTime )
+{
+ file.countdownRui = CreateCockpitRui( $"ui/dropship_intro_countdown.rpak", 0 )
+ RuiSetResolutionToScreenSize( file.countdownRui )
+ RuiSetGameTime( file.countdownRui, "gameStartTime", endTime )
+}
+
+void function ServerCallback_AnnounceHideAndSeekRole()
+{
+ if ( GetLocalViewPlayer().GetTeam() == HIDEANDSEEK_TEAM_SEEKER )
+ {
+ AnnouncementData announcement = Announcement_Create( "#HIDEANDSEEK_YOU_ARE_SEEKER" )
+ Announcement_SetSubText( announcement, Localize( "#HIDEANDSEEK_SEEKER_DESC", GetCurrentPlaylistVarFloat( "hideandseek_hiding_time", 60.0 ).tostring() ) )
+ Announcement_SetTitleColor( announcement, <0,0,1> )
+ Announcement_SetPurge( announcement, true )
+ Announcement_SetPriority( announcement, 200 ) //Be higher priority than Titanfall ready indicator etc
+ Announcement_SetSoundAlias( announcement, SFX_HUD_ANNOUNCE_QUICK )
+ Announcement_SetStyle( announcement, ANNOUNCEMENT_STYLE_QUICK )
+ AnnouncementFromClass( GetLocalViewPlayer(), announcement )
+ }
+ else
+ {
+ AnnouncementData announcement = Announcement_Create( "#HIDEANDSEEK_YOU_ARE_HIDER" )
+ Announcement_SetSubText( announcement, "#HIDEANDSEEK_HIDER_DESC" )
+ Announcement_SetTitleColor( announcement, <0,0,1> )
+ Announcement_SetPurge( announcement, true )
+ Announcement_SetPriority( announcement, 200 ) //Be higher priority than Titanfall ready indicator etc
+ Announcement_SetSoundAlias( announcement, SFX_HUD_ANNOUNCE_QUICK )
+ Announcement_SetStyle( announcement, ANNOUNCEMENT_STYLE_QUICK )
+ AnnouncementFromClass( GetLocalViewPlayer(), announcement )
+ }
+}
+
+void function ServerCallback_SeekersIncoming()
+{
+ AnnouncementData announcement = Announcement_Create( "#HIDEANDSEEK_SEEKERS_INCOMING" )
+ Announcement_SetSubText( announcement, "#HIDEANDSEEK_DONT_GET_FOUND" )
+ Announcement_SetTitleColor( announcement, <1,0,0> )
+ Announcement_SetPurge( announcement, true )
+ Announcement_SetPriority( announcement, 200 ) //Be higher priority than Titanfall ready indicator etc
+ Announcement_SetSoundAlias( announcement, SFX_HUD_ANNOUNCE_QUICK )
+ Announcement_SetStyle( announcement, ANNOUNCEMENT_STYLE_QUICK )
+ AnnouncementFromClass( GetLocalViewPlayer(), announcement )
+}
+
+void function ServerCallback_LastHiderAlive()
+{
+ if ( GetLocalViewPlayer().GetTeam() == HIDEANDSEEK_TEAM_SEEKER )
+ {
+ AnnouncementData announcement = Announcement_Create( Localize( "#HIDEANDSEEK_GET_LAST_HIDER", GetPlayerArrayOfTeam_Alive( HIDEANDSEEK_TEAM_HIDER )[ 0 ].GetPlayerName() ) )
+ Announcement_SetTitleColor( announcement, <1,0,0> )
+ Announcement_SetPurge( announcement, true )
+ Announcement_SetPriority( announcement, 200 ) //Be higher priority than Titanfall ready indicator etc
+ Announcement_SetSoundAlias( announcement, SFX_HUD_ANNOUNCE_QUICK )
+ Announcement_SetStyle( announcement, ANNOUNCEMENT_STYLE_QUICK )
+ AnnouncementFromClass( GetLocalViewPlayer(), announcement )
+ }
+ else
+ {
+ AnnouncementData announcement = Announcement_Create( "#HIDEANDSEEK_YOU_ARE_LAST_HIDER" )
+ Announcement_SetSubText( announcement, "#HIDEANDSEEK_GOT_STIM" )
+ Announcement_SetTitleColor( announcement, <1,0,0> )
+ Announcement_SetPurge( announcement, true )
+ Announcement_SetPriority( announcement, 200 ) //Be higher priority than Titanfall ready indicator etc
+ Announcement_SetSoundAlias( announcement, SFX_HUD_ANNOUNCE_QUICK )
+ Announcement_SetStyle( announcement, ANNOUNCEMENT_STYLE_QUICK )
+ AnnouncementFromClass( GetLocalViewPlayer(), announcement )
+ }
+}
+
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_hs.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_hs.gnut
new file mode 100644
index 00000000..f4269ac4
--- /dev/null
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_hs.gnut
@@ -0,0 +1,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" )
+} \ No newline at end of file