diff options
3 files changed, 59 insertions, 25 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut index bca14f05..3afadc4e 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -91,6 +91,36 @@ void function AddNorthstarServerBrowserMenu() AddMenu( "ServerBrowserMenu", $"resource/ui/menus/server_browser.menu", InitServerBrowserMenu, "#MENU_SERVER_BROWSER" ) } +void function UpdatePrivateMatchModesAndMaps() +{ + array<string> realMaps = [ "mp_lobby" ] + realMaps.extend( GetPrivateMatchMaps() ) + + foreach ( int enum_, string map in realMaps ) + { + if ( filterArguments.filterMaps.find( map ) != -1 ) + continue + + filterArguments.filterMaps.append( map ) + + string localized = GetMapDisplayName( map ) + Hud_DialogList_AddListItem( Hud_GetChild( file.menu, "SwtBtnSelectMap" ) , localized, string( enum_ + 1 ) ) + } + + array<string> realModes = [ "private_match" ] + realModes.extend( GetPrivateMatchModes() ) + + foreach( int enum_, string mode in realModes ) + { + string localized = GetGameModeDisplayName( mode ) + if ( filterArguments.filterGamemodes.find( localized ) != -1 ) + continue + + filterArguments.filterGamemodes.append( localized ) + Hud_DialogList_AddListItem( Hud_GetChild( file.menu, "SwtBtnSelectGamemode" ) , localized, string( enum_ + 1 ) ) + } +} + void function InitServerBrowserMenu() { file.menu = GetMenu( "ServerBrowserMenu" ) @@ -104,28 +134,14 @@ void function InitServerBrowserMenu() file.serversGamemode = GetElementsByClassname( file.menu, "ServerGamemode" ) file.serversLatency = GetElementsByClassname( file.menu, "ServerLatency" ) - // Create filter arrays - filterArguments.filterMaps.extend(GetPrivateMatchMaps()) - filterArguments.filterMaps.insert(0, "SWITCH_ANY") - filterArguments.filterMaps.append("mp_lobby") - - foreach ( int enum_, string map in filterArguments.filterMaps ) - Hud_DialogList_AddListItem( Hud_GetChild( file.menu, "SwtBtnSelectMap" ) , map, string( enum_ ) ) - - - filterArguments.filterGamemodes = clone GetPrivateMatchModes() - filterArguments.filterGamemodes.insert(0, "SWITCH_ANY") - - // GetGameModeDisplayName( mode ) requires server talk even if it can be entirely client side - foreach ( int enum_, string mode in filterArguments.filterGamemodes ) - Hud_DialogList_AddListItem( Hud_GetChild( file.menu, "SwtBtnSelectGamemode" ) , mode, string( enum_ ) ) - + filterArguments.filterMaps = [ "SWITCH_ANY" ] + Hud_DialogList_AddListItem( Hud_GetChild( file.menu, "SwtBtnSelectMap" ), "SWITCH_ANY", "0" ) + + filterArguments.filterGamemodes = [ "SWITCH_ANY" ] + Hud_DialogList_AddListItem( Hud_GetChild( file.menu, "SwtBtnSelectGamemode" ), "SWITCH_ANY", "0" ) // Event handlers AddMenuEventHandler( file.menu, eUIEvent.MENU_CLOSE, OnCloseServerBrowserMenu ) - - - AddMenuEventHandler( file.menu, eUIEvent.MENU_OPEN, OnServerBrowserMenuOpened ) AddMenuFooterOption( file.menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) AddMenuFooterOption( file.menu, BUTTON_Y, "#Y_REFRESH_SERVERS", "#REFRESH_SERVERS", RefreshServers ) @@ -375,6 +391,7 @@ void function OnCloseServerBrowserMenu() void function OnServerBrowserMenuOpened() { + UpdatePrivateMatchModesAndMaps() Hud_SetText( Hud_GetChild( file.menu, "Title" ), "#MENU_TITLE_SERVER_BROWSER" ) UI_SetPresentationType( ePresentationType.KNOWLEDGEBASE_MAIN ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut index 3bc11c3a..974481c1 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut @@ -21,6 +21,7 @@ void function GamemodeSpeedball_Init() AddSpawnCallbackEditorClass( "script_ref", "info_speedball_flag", CreateFlag ) + AddCallback_GameStateEnter( eGameState.Prematch, CreateFlagIfNoFlagSpawnpoint ) AddCallback_GameStateEnter( eGameState.Playing, ResetFlag ) AddCallback_OnTouchHealthKit( "item_flag", OnFlagCollected ) AddCallback_OnPlayerKilled( OnPlayerKilled ) @@ -114,6 +115,21 @@ void function DropFlag() file.flagCarrier = null } +void function CreateFlagIfNoFlagSpawnpoint() +{ + if ( IsValid( file.flag ) ) + return + + foreach ( entity hardpoint in GetEntArrayByClass_Expensive( "info_hardpoint" ) ) + { + if ( hardpoint.kv.hardpointGroup == "B" ) + { + CreateFlag( hardpoint ) + return + } + } +} + void function ResetFlag() { file.flag.ClearParent() diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut index d0d625b4..11587947 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut @@ -104,7 +104,8 @@ void function OnPrematchStart() entity militiaIon = CreatePropDynamic( $"models/titans/medium/titan_medium_ajax.mdl", < -1809.98, 2790.39, -1409 >, < 0, 80, 0 > ) thread PlayAnim( militiaIon, "at_titan_activation_wargames_intro" ) - + militiaIon.Anim_SetInitialTime( 4.5 ) + entity militiaPilot = CreateElitePilot( TEAM_UNASSIGNED, < 0, 0, 0 >, < 0, 0, 0 > ) DispatchSpawn( militiaPilot ) militiaPilot.SetParent( militiaIon, "HIJACK" ) @@ -228,12 +229,12 @@ void function PlayerWatchesWargamesIntro( entity player ) player.MovementDisable() player.SetInvulnerable() - // spawn faction leader - // no clue why client subtracts 4.5 from the time we give this, so just add it here instead - if ( factionTeam == TEAM_IMC ) - Remote_CallFunction_NonReplay( player, "ServerCallback_SpawnIMCFactionLeaderForIntro", file.introStartTime + 4.5, playerPod.GetEncodedEHandle() ) + if ( factionTeam == TEAM_MILITIA && GetFactionChoice( player ) == "faction_marvin" ) + Remote_CallFunction_NonReplay( player, "ServerCallback_SpawnMilitiaFactionLeaderForIntro", file.introStartTime, playerPod.GetEncodedEHandle() ) + else if ( factionTeam == TEAM_MILITIA ) + Remote_CallFunction_NonReplay( player, "ServerCallback_SpawnMilitiaFactionLeaderForIntro", file.introStartTime + 1.75, playerPod.GetEncodedEHandle() ) else - Remote_CallFunction_NonReplay( player, "ServerCallback_SpawnMilitiaFactionLeaderForIntro", file.introStartTime + 4.5, playerPod.GetEncodedEHandle() ) + Remote_CallFunction_NonReplay( player, "ServerCallback_SpawnIMCFactionLeaderForIntro", file.introStartTime + 4.5, playerPod.GetEncodedEHandle() ) // idle pod sequence FirstPersonSequenceStruct podIdleSequence |