From 30bc58c9ab1563a1dcbbb671db9ee446dc7df37d Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Sat, 11 Dec 2021 22:28:45 +0000 Subject: more fixes --- .../mod/scripts/vscripts/ui/panel_mainmenu.nut | 68 ++++++++++++++++------ .../mod/scripts/vscripts/_powerup.gnut | 21 ++++--- .../scripts/vscripts/gamemodes/_gamemode_lts.nut | 2 + .../mod/scripts/vscripts/mp/_base_gametype_mp.gnut | 11 ++++ .../mod/scripts/vscripts/mp/_gamestate_mp.nut | 5 +- 5 files changed, 81 insertions(+), 26 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index ca7a1f7b..9a0850c0 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -128,6 +128,7 @@ void function InitMainMenuPanel() //AddPanelFooterOption( file.panel, BUTTON_BACK, "", "", ClosePostGameMenu ) thread TrackInstallProgress() + UpdateCustomMainMenuPromos() } void function OnShowMainMenuPanel() @@ -225,9 +226,6 @@ void function UpdatePlayButton( var button ) while ( GetTopNonDialogMenu() == file.menu ) { - bool isSpotlightReady = file.promoData.version != 0 ? true : false - Hud_SetVisible( file.spotlightPanel, isSpotlightReady ) - if ( !Hud_IsFocused( button ) ) { RuiSetBool( file.serviceStatus, "isVisible", false ) @@ -755,31 +753,63 @@ bool function HasLatestPatch() } #endif // PS4_PROG +// custom mainmenupromos stuff + +// nopping these void function UpdatePromoData() { - file.promoData = GetMainMenuPromos() - - UpdateWhatsNewData() - UpdateSpotlightData() } void function UICodeCallback_MainMenuPromosUpdated() { - printt( "MainMenuPromos updated" ) +} + +enum eMainMenuPromoDataProperty +{ + newInfoTitle1, + newInfoTitle2, + newInfoTitle3, + + largeButtonTitle, + largeButtonText, + largeButtonUrl, + largeButtonImageIndex, + + smallButton1Title, + smallButton1Url, + smallButton1ImageIndex, + + smallButton2Title, + smallButton2Url, + smallButton2ImageIndex +} + +void function UpdateCustomMainMenuPromos() +{ + NSRequestCustomMainMenuPromos() + + thread UpdateCustomMainMenuPromosThreaded() +} - UpdatePromoData() +void function UpdateCustomMainMenuPromosThreaded() +{ + while ( !NSHasCustomMainMenuPromoData() ) + WaitFrame() + + UpdateWhatsNewData() + UpdateSpotlightData() } void function UpdateWhatsNewData() { // file.promoData.newInfo_ImageIndex //RuiSetString( file.whatsNew, "line1Text", "`2%$rui/menu/main_menu/whats_new_bulletpoint%`0 Updated Live Fire Maps!\n`2%$rui/menu/main_menu/whats_new_bulletpoint%`0 Prime Titans`0 in the Store\n`2%$rui/menu/main_menu/whats_new_bulletpoint% DOUBLE XP`0 weekend!" )//file.promoData.newInfo_Title1 ) - RuiSetString( file.whatsNew, "line1Text", file.promoData.newInfo_Title1 ) - RuiSetString( file.whatsNew, "line2Text", file.promoData.newInfo_Title2 ) - RuiSetString( file.whatsNew, "line3Text", file.promoData.newInfo_Title3 ) + RuiSetString( file.whatsNew, "line1Text", expect string( NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.newInfoTitle1 ) ) ) + RuiSetString( file.whatsNew, "line2Text", expect string( NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.newInfoTitle2 ) ) ) + RuiSetString( file.whatsNew, "line3Text", expect string( NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.newInfoTitle3 ) ) ) bool isVisible = true - if ( file.promoData.newInfo_Title1 == "" && file.promoData.newInfo_Title2 == "" && file.promoData.newInfo_Title3 == "" ) + if ( NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.newInfoTitle1 ) == "" && NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.newInfoTitle2 ) == "" && NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.newInfoTitle3 ) == "" ) isVisible = false RuiSetBool( file.whatsNew, "isVisible", isVisible ) @@ -787,9 +817,9 @@ void function UpdateWhatsNewData() void function UpdateSpotlightData() { - SetSpotlightButtonData( file.spotlightButtons[0], file.promoData.largeButton_Url, file.promoData.largeButton_ImageIndex, file.promoData.largeButton_Title, file.promoData.largeButton_Text ) - SetSpotlightButtonData( file.spotlightButtons[1], file.promoData.smallButton1_Url, file.promoData.smallButton1_ImageIndex, file.promoData.smallButton1_Title ) - SetSpotlightButtonData( file.spotlightButtons[2], file.promoData.smallButton2_Url, file.promoData.smallButton2_ImageIndex, file.promoData.smallButton2_Title ) + SetSpotlightButtonData( file.spotlightButtons[0], expect string( NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.largeButtonUrl ) ), expect int( NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.largeButtonImageIndex ) ), expect string( NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.largeButtonTitle ) ), expect string( NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.largeButtonText ) ) ) + SetSpotlightButtonData( file.spotlightButtons[1], expect string( NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.smallButton1Url ) ), expect int( NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.smallButton1ImageIndex ) ), expect string( NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.smallButton1Title ) ) ) + SetSpotlightButtonData( file.spotlightButtons[2], expect string( NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.smallButton2Url ) ), expect int( NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.smallButton2ImageIndex ) ), expect string( NSGetCustomMainMenuPromoData( eMainMenuPromoDataProperty.smallButton2Title ) ) ) } void function SetSpotlightButtonData( var button, string link, int imageIndex, string title, string details = "skip" ) @@ -806,6 +836,7 @@ void function SetSpotlightButtonData( var button, string link, int imageIndex, s RuiSetString( rui, "detailsText", details ) button.s.link = link + Hud_SetVisible( file.spotlightPanel, true ) } void function SpotlightButton_Activate( var button ) @@ -847,6 +878,9 @@ void function SpotlightButton_Activate( var button ) } else { - LaunchExternalWebBrowser( link, WEBBROWSER_FLAG_MUTEGAME ) + if ( link.find( "https://discord.gg" ) == 0 ) + LaunchExternalWebBrowser( link, WEBBROWSER_FLAG_FORCEEXTERNAL ) + else + LaunchExternalWebBrowser( link, WEBBROWSER_FLAG_MUTEGAME ) } } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut index 60c4560f..5fb0778c 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut @@ -33,21 +33,17 @@ void function PowerupSpawnerThink( entity spawnpoint, PowerUp powerupDef ) svGlobal.levelEnt.EndSignal( "CleanUpEntitiesForRoundEnd" ) entity base = CreatePropDynamic( powerupDef.baseModel, spawnpoint.GetOrigin(), spawnpoint.GetAngles(), 2 ) - - entity powerup - OnThreadEnd( function() : ( base, powerup ) + OnThreadEnd( function() : ( base ) { base.Destroy() - if ( IsValid( powerup ) ) - powerup.Destroy() }) - + while ( true ) { if ( !powerupDef.spawnFunc() ) return - powerup = CreateEntity( "item_powerup" ) + entity powerup = CreateEntity( "item_powerup" ) powerup.SetOrigin( base.GetOrigin() + powerupDef.modelOffset ) powerup.SetAngles( base.GetAngles() + powerupDef.modelAngles ) @@ -66,11 +62,22 @@ void function PowerupSpawnerThink( entity spawnpoint, PowerUp powerupDef ) PickupGlow glow = CreatePickupGlow( powerup, powerupDef.glowColor.x.tointeger(), powerupDef.glowColor.y.tointeger(), powerupDef.glowColor.z.tointeger() ) glow.glowFX.SetOrigin( spawnpoint.GetOrigin() ) // want the glow to be parented to the powerup, but have the position of the spawnpoint + thread TrackPowerupCleanup( powerup ) + powerup.WaitSignal( "OnDestroy" ) wait powerupDef.respawnDelay } } +void function TrackPowerupCleanup( entity powerup ) +{ + powerup.EndSignal( "OnDestroy" ) + + svGlobal.levelEnt.WaitSignal( "CleanUpEntitiesForRoundEnd" ) + if ( IsValid( powerup ) ) + powerup.Destroy() +} + bool function OnPowerupCollected( entity player, entity healthpack ) { PowerUp powerup = GetPowerUpFromItemRef( expect string( healthpack.s.powerupRef ) ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut index 89f9c991..194db8a0 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut @@ -46,6 +46,8 @@ void function WaitForThirtySecondsLeftThreaded() // wait until 30sec left wait ( endTime - 30 ) - Time() + PlayMusicToAll( eMusicPieceID.LEVEL_LAST_MINUTE ) + foreach ( entity player in GetPlayerArray() ) { // warn there's 30 seconds left diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut index 5a0ec989..0425f1d7 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -40,6 +40,8 @@ void function BaseGametype_Init_MPSP() AddDamageCallback( "player", AddToTitanDamageStat ) AddDamageCallback( "npc_titan", AddToTitanDamageStat ) + + RegisterSignal( "PlayerRespawnStarted" ) } void function SetIntermissionCamera( entity camera ) @@ -394,6 +396,8 @@ void function RespawnAsPilot( entity player, bool manualPosition = false ) void function RespawnAsTitan( entity player, bool manualPosition = false ) { + player.Signal( "PlayerRespawnStarted" ) + player.isSpawning = true entity spawnpoint = FindSpawnPoint( player, true, ShouldStartSpawn( player ) && !IsFFAGame() ) @@ -459,9 +463,16 @@ void function PlayerBecomesSpectator( entity player ) player.EndSignal( "OnRespawned" ) player.EndSignal( "OnDestroy" ) + player.EndSignal( "PlayerRespawnStarted" ) int targetIndex = 0 + OnThreadEnd( function() : ( player ) + { + if ( IsValid( player ) ) + player.StopObserverMode() + }) + while ( true ) { table result = player.WaitSignal( "ObserverTargetChanged" ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut index 58c8bb9b..83d889dd 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut @@ -320,10 +320,11 @@ void function GameStateEnter_WinnerDetermined_Threaded() foreach( entity player in GetPlayerArray() ) { player.FreezeControlsOnServer() - ScreenFadeToBlackForever( player, 2.0 ) + ScreenFadeToBlackForever( player, 4.0 ) } - wait 2.5 + wait 6.5 + CleanUpEntitiesForRoundEnd() // fade should be done by this point, so cleanup stuff now when people won't see foreach( entity player in GetPlayerArray() ) player.UnfreezeControlsOnServer() -- cgit v1.2.3