Partial Vanilla Compatibility (#950)

This commit is contained in:
Jack 2025-12-11 00:02:50 +00:00 committed by GitHub
parent 24b0abb60e
commit 7d9a3e983f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 212 additions and 87 deletions

View file

@ -21,6 +21,7 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a
"DIALOG_AUTHENTICATING_MASTERSERVER" "Authenticating to master server."
"AUTHENTICATIONAGREEMENT_NO" "You have chosen not to authenticate with Northstar. You can view the agreement in the Mods menu."
"HAS_NON_VANILLA_MODS" "You currently have mods enabled (marked with a \"!\") that break vanilla compatibility. You can disable them in the Mods menu."
"MENU_TITLE_SERVER_BROWSER" "Server Browser"
"NS_SERVERBROWSER_NOSERVERS" "No servers found"
@ -373,6 +374,8 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a
"TOGGLE_PROGRESSION" "Toggle Progression"
"Y_BUTTON_TOGGLE_PROGRESSION" "%[Y_BUTTON|]% Toggle Progression"
"PROGRESSION_TOGGLE_VANILLA" "Progression cannot be disabled on vanilla servers."
"PROGRESSION_TOGGLE_ENABLED_HEADER" "Disable Progression?"
"PROGRESSION_TOGGLE_ENABLED_BODY" "Titans, Weapons, Factions, Skins, etc. will all be unlocked and usable at any time.\n\nThis can be changed at any time in the multiplayer lobby."

View file

@ -85,9 +85,11 @@ void function InitInGameMPMenu()
var gameHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_HEADER_GAME" )
var leaveButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#LEAVE_MATCH" )
Hud_AddEventHandler( leaveButton, UIE_CLICK, OnLeaveButton_Activate )
var teamChangeButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#SWITCH_TEAMS" )
Hud_AddEventHandler( teamChangeButton, UIE_CLICK, OnRequestTeamSwitch )
thread UpdateTeamSwitchButton_Threaded( teamChangeButton )
#if !VANILLA
var teamChangeButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#SWITCH_TEAMS" )
Hud_AddEventHandler( teamChangeButton, UIE_CLICK, OnRequestTeamSwitch )
thread UpdateTeamSwitchButton_Threaded( teamChangeButton )
#endif
#if DEV
var devButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "Dev" )
Hud_AddEventHandler( devButton, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "DevMenu" ) ) )

View file

@ -230,16 +230,24 @@ void function InitLobbyMenu()
void function ShowToggleProgressionDialog( var button )
{
bool enabled = Progression_GetPreference()
#if VANILLA
DialogData dialogData
dialogData.menu = GetMenu( "AnnouncementDialog" )
dialogData.header = "#PROGRESSION_TOGGLE_ENABLED_HEADER"
dialogData.message = "#PROGRESSION_TOGGLE_VANILLA"
dialogData.image = $"ui/menu/common/dialog_announcement_1"
#else
bool enabled = Progression_GetPreference()
DialogData dialogData
dialogData.menu = GetMenu( "AnnouncementDialog" )
dialogData.header = enabled ? "#PROGRESSION_TOGGLE_ENABLED_HEADER" : "#PROGRESSION_TOGGLE_DISABLED_HEADER"
dialogData.message = enabled ? "#PROGRESSION_TOGGLE_ENABLED_BODY" : "#PROGRESSION_TOGGLE_DISABLED_BODY"
dialogData.image = $"ui/menu/common/dialog_announcement_1"
DialogData dialogData
dialogData.menu = GetMenu( "AnnouncementDialog" )
dialogData.header = enabled ? "#PROGRESSION_TOGGLE_ENABLED_HEADER" : "#PROGRESSION_TOGGLE_DISABLED_HEADER"
dialogData.message = enabled ? "#PROGRESSION_TOGGLE_ENABLED_BODY" : "#PROGRESSION_TOGGLE_DISABLED_BODY"
dialogData.image = $"ui/menu/common/dialog_announcement_1"
AddDialogButton( dialogData, "#NO" )
AddDialogButton( dialogData, "#YES", enabled ? DisableProgression : EnableProgression )
AddDialogButton( dialogData, "#NO" )
AddDialogButton( dialogData, "#YES", enabled ? DisableProgression : EnableProgression )
#endif
OpenDialog( dialogData )
}
@ -288,21 +296,32 @@ void function SetupComboButtonTest( var menu )
int buttonIndex = 0
file.playHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_HEADER_PLAY" )
// server browser
file.findGameButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_SERVER_BROWSER" )
file.lobbyButtons.append( file.findGameButton )
Hud_SetLocked( file.findGameButton, true )
Hud_AddEventHandler( file.findGameButton, UIE_CLICK, OpenServerBrowser )
#if VANILLA
file.findGameButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_FIND_GAME" )
file.lobbyButtons.append( file.findGameButton )
Hud_AddEventHandler( file.findGameButton, UIE_CLICK, BigPlayButton1_Activate )
// private match
file.inviteRoomButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#PRIVATE_MATCH" )
Hud_AddEventHandler( file.inviteRoomButton, UIE_CLICK, StartPrivateMatch )
file.inviteRoomButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_ROOM" )
Hud_AddEventHandler( file.inviteRoomButton, UIE_CLICK, DoRoomInviteIfAllowed )
#else
// server browser
file.findGameButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_SERVER_BROWSER" )
file.lobbyButtons.append( file.findGameButton )
Hud_SetLocked( file.findGameButton, true )
Hud_AddEventHandler( file.findGameButton, UIE_CLICK, OpenServerBrowser )
// private match
file.inviteRoomButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#PRIVATE_MATCH" )
Hud_AddEventHandler( file.inviteRoomButton, UIE_CLICK, StartPrivateMatch )
#endif
file.inviteFriendsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_FRIENDS" )
Hud_AddEventHandler( file.inviteFriendsButton, UIE_CLICK, InviteFriendsIfAllowed )
Hud_SetEnabled( file.inviteFriendsButton, false )
Hud_SetVisible( file.inviteFriendsButton, false )
#if !VANILLA
Hud_SetEnabled( file.inviteFriendsButton, false )
Hud_SetVisible( file.inviteFriendsButton, false )
#endif
// file.toggleMenuModeButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_LOBBY_SWITCH_FD" )
// Hud_AddEventHandler( file.toggleMenuModeButton, UIE_CLICK, ToggleLobbyMode )
@ -1268,7 +1287,9 @@ function UpdateLobbyUI()
thread UpdateLobbyType()
thread UpdateMatchmakingStatus()
thread UpdateChatroomThread()
//thread UpdateInviteJoinButton()
#if VANILLA
thread UpdateInviteJoinButton()
#endif
thread UpdateInviteFriendsToNetworkButton()
thread UpdatePlayerInfo()

View file

@ -75,7 +75,9 @@ void function OnMainMenu_Open()
Signal( uiGlobal.signalDummy, "EndOnMainMenu_Open" )
EndSignal( uiGlobal.signalDummy, "EndOnMainMenu_Open" )
#if !VANILLA
SetConVarString( "communities_hostname", "" ) // disable communities due to crash exploits that are still possible through it
#endif
UpdatePromoData() // On script restarts this gives us the last data until the new request is complete
RequestMainMenuPromos() // This will be ignored if there was a recent request. "infoblock_requestInterval"

View file

@ -17,6 +17,9 @@ global enum eModeMenuModeCategory
}
// List of blocked modes due to them being unfinished
#if VANILLA
const array<string> blockedModes = []
#else
const array<string> blockedModes =
[
"fd_easy",
@ -25,6 +28,7 @@ const array<string> blockedModes =
"fd_master",
"fd_insane"
]
#endif
struct ListEntry_t {
string mode

View file

@ -1,6 +1,12 @@
global function AddNorthstarCustomMatchSettingsMenu
global function SetNextMatchSettingsCategory
#if VANILLA
const string OVERRIDE_COMMAND = "setplaylistvaroverrides"
#else
const string OVERRIDE_COMMAND = "PrivateMatchSetPlaylistVarOverride"
#endif
const string SETTING_ITEM_TEXT = " " // this is long enough to be the same size as the textentry field
struct {
@ -120,7 +126,7 @@ void function OnSettingButtonPressed( var button )
file.enumRealValues[ int( Hud_GetScriptID( button ) ) ] = enumVal
Hud_SetText( textPanel, setting.enumNames[ enumVal ] )
ClientCommand( "PrivateMatchSetPlaylistVarOverride " + setting.playlistVar + " " + setting.enumValues[ enumVal ] )
ClientCommand( OVERRIDE_COMMAND + " " + setting.playlistVar + " " + setting.enumValues[ enumVal ] )
}
else
{
@ -137,5 +143,7 @@ void function SendTextPanelChanges( var textPanel )
// enums don't need to do this
if ( !setting.isEnumSetting )
ClientCommand( "PrivateMatchSetPlaylistVarOverride " + setting.playlistVar + " " + Hud_GetUTF8Text( textPanel ) )
}
{
ClientCommand( OVERRIDE_COMMAND + " " + setting.playlistVar + " " + Hud_GetUTF8Text( textPanel ) )
}
}

View file

@ -271,6 +271,12 @@ void function SetupComboButtons( var menu, var navUpButton, var navDownButton )
file.matchSettingsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_MATCH_SETTINGS" )
Hud_AddEventHandler( file.matchSettingsButton, UIE_CLICK, OnSelectMatchSettings_Activate )
#if VANILLA
var friendsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_FRIENDS" )
file.inviteFriendsButton = friendsButton
Hud_AddEventHandler( friendsButton, UIE_CLICK, InviteFriendsIfAllowed )
#endif
headerIndex++
buttonIndex = 0
file.customizeHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_HEADER_LOADOUTS" )
@ -565,12 +571,18 @@ function UpdatePrivateMatchButtons()
Hud_SetLocked( file.selectMapButton, true )
Hud_SetLocked( file.selectModeButton, true )
Hud_SetLocked( file.matchSettingsButton, true )
#if VANILLA
Hud_SetLocked( file.inviteFriendsButton, true )
#endif
}
else
{
RHud_SetText( file.startMatchButton, "#START_MATCH" )
Hud_SetLocked( file.selectMapButton, false )
Hud_SetLocked( file.selectModeButton, false )
#if VANILLA
Hud_SetLocked( file.inviteFriendsButton, false )
#endif
string modeName = PrivateMatch_GetSelectedMode()
bool settingsLocked = IsFDMode( modeName )

View file

@ -202,8 +202,10 @@ void function UpdateOpenInvite_Thread()
void function UICodeCallback_OpenInviteUpdated()
{
// don't support on northstar
return
#if !VANILLA
// don't support on northstar
return
#endif
if ( file.openInviteVisible )
return

View file

@ -81,12 +81,19 @@ void function InitMainMenuPanel()
headerIndex++
buttonIndex = 0
var multiplayerHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MULTIPLAYER_ALLCAPS" )
// "Launch Multiplayer" button removed because we don't support vanilla yet :clueless:
//file.mpButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MULTIPLAYER_LAUNCH" )
//Hud_AddEventHandler( file.mpButton, UIE_CLICK, OnPlayMPButton_Activate )
file.fdButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_LAUNCH_NORTHSTAR" )
Hud_AddEventHandler( file.fdButton, UIE_CLICK, OnPlayFDButton_Activate )
Hud_SetLocked( file.fdButton, true )
#if VANILLA
file.mpButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MULTIPLAYER_LAUNCH" )
Hud_AddEventHandler( file.mpButton, UIE_CLICK, OnPlayMPButton_Activate )
file.fdButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#GAMEMODE_COOP" )
Hud_AddEventHandler( file.fdButton, UIE_CLICK, OnPlayFDButton_Activate )
#else
// "Launch Multiplayer" button removed because we don't support vanilla yet :clueless:
//file.mpButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MULTIPLAYER_LAUNCH" )
//Hud_AddEventHandler( file.mpButton, UIE_CLICK, OnPlayMPButton_Activate )
file.fdButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_LAUNCH_NORTHSTAR" )
Hud_AddEventHandler( file.fdButton, UIE_CLICK, OnPlayNSButton_Activate )
Hud_SetLocked( file.fdButton, true )
#endif
headerIndex++
buttonIndex = 0
@ -137,7 +144,7 @@ void function InitMainMenuPanel()
//AddPanelFooterOption( file.panel, BUTTON_BACK, "", "", ClosePostGameMenu )
thread TrackInstallProgress()
UpdateCustomMainMenuPromos()
thread UpdateCustomMainMenuPromos()
}
void function OnShowMainMenuPanel()
@ -170,9 +177,11 @@ void function OnShowMainMenuPanel()
#endif // PS4_PROG
UpdateSPButtons()
// dont try and update the launch multiplayer button, because it doesn't exist
//thread UpdatePlayButton( file.mpButton )
#if VANILLA
thread UpdatePlayButton( file.mpButton )
#else
thread UpdatePlayButton( file.fdButton )
#endif
thread MonitorTrialVersionChange()
#if DURANGO_PROG
@ -402,55 +411,68 @@ void function UpdatePlayButton( var button )
buttonText = "#MULTIPLAYER_LAUNCH"
message = ""
if ( !isOriginConnected )
{
message = "#ORIGIN_IS_OFFLINE"
file.mpButtonActivateFunc = null
}
else if ( !isStryderAuthenticated )
{
message = "#CONTACTING_RESPAWN_SERVERS"
file.mpButtonActivateFunc = null
}
else if ( button == file.mpButton && !isMPAllowed )
{
message = "#MULTIPLAYER_NOT_AVAILABLE"
file.mpButtonActivateFunc = null
}
else if ( button == file.mpButton && !hasLatestPatch )
{
message = "#ORIGIN_UPDATE_AVAILABLE"
file.mpButtonActivateFunc = null
}
else if ( button == file.fdButton && GetConVarInt( "ns_has_agreed_to_send_token" ) != NS_AGREED_TO_SEND_TOKEN )
{
message = "#AUTHENTICATIONAGREEMENT_NO"
file.mpButtonActivateFunc = null
}
else if ( button == file.mpButton )
{
// restrict non-vanilla players from accessing official servers
bool hasNonVanillaMods = false
foreach ( ModInfo mod in NSGetModsInformation() )
#if VANILLA
if ( !isOriginConnected )
{
if ( mod.enabled && mod.requiredOnClient )
message = "#ORIGIN_IS_OFFLINE"
file.mpButtonActivateFunc = null
}
else if ( !isStryderAuthenticated )
{
message = "#CONTACTING_RESPAWN_SERVERS"
file.mpButtonActivateFunc = null
}
else if ( !isMPAllowed )
{
message = "#MULTIPLAYER_NOT_AVAILABLE"
file.mpButtonActivateFunc = null
}
else if ( !hasLatestPatch )
{
message = "#ORIGIN_UPDATE_AVAILABLE"
file.mpButtonActivateFunc = null
}
else
{
// restrict non-vanilla players from accessing official servers
bool hasNonVanillaMods = false
foreach ( ModInfo mod in NSGetModsInformation() )
{
hasNonVanillaMods = true
break
if ( mod.enabled && mod.requiredOnClient )
{
hasNonVanillaMods = true
break
}
}
if ( hasNonVanillaMods )
{
message = "#HAS_NON_VANILLA_MODS"
file.mpButtonActivateFunc = null
}
else
{
file.mpButtonActivateFunc = LaunchMP
}
}
if ( hasNonVanillaMods )
#else
if ( GetConVarInt( "ns_has_agreed_to_send_token" ) != NS_AGREED_TO_SEND_TOKEN )
{
message = "#AUTHENTICATIONAGREEMENT_NO"
file.mpButtonActivateFunc = null
}
else
{
file.mpButtonActivateFunc = LaunchMP
}
}
#endif
isLocked = file.mpButtonActivateFunc == null ? true : false
if( button == file.fdButton )
#if !VANILLA
thread TryUnlockNorthstarButton()
else
#else
Hud_SetLocked( button, isLocked )
#endif
#endif
if ( Script_IsRunningTrialVersion() && !IsTrialPeriodActive() && file.mpButtonActivateFunc != LaunchGamePurchase )
@ -461,11 +483,26 @@ void function UpdatePlayButton( var button )
message = ""
}
// dont try and update the launch multiplayer button, because it doesn't exist
//ComboButton_SetText( file.mpButton, buttonText )
#if VANILLA
ComboButton_SetText( file.mpButton, buttonText )
ComboButton_SetText( file.fdButton, "#MENU_LAUNCH_NORTHSTAR" )
//Hud_SetEnabled( file.fdButton, false )
if ( Hud_IsLocked( button ) || buttonText == "#MENU_GET_THE_FULL_GAME" )
{
ComboButton_SetText( file.fdButton, "" )
Hud_SetEnabled( file.fdButton, false )
}
else
{
ComboButton_SetText( file.fdButton, "#MULTIPLAYER_LAUNCH_FD" )
Hud_SetEnabled( file.fdButton, true )
}
#else
// dont try and update the launch multiplayer button, because it doesn't exist
//ComboButton_SetText( file.mpButton, buttonText )
ComboButton_SetText( file.fdButton, "#MENU_LAUNCH_NORTHSTAR" )
//Hud_SetEnabled( file.fdButton, false )
#endif
if ( file.installing )
message = ""
@ -530,7 +567,20 @@ void function TryUnlockNorthstarButton()
Hud_SetLocked( file.fdButton, false )
}
void function OnPlayFDButton_Activate( var button ) // repurposed for launching northstar lobby
void function OnPlayFDButton_Activate( var button )
{
if ( file.mpButtonActivateFunc == null )
printt( "file.mpButtonActivateFunc is null" )
if ( !Hud_IsLocked( button ) && file.mpButtonActivateFunc != null )
{
Lobby_SetAutoFDOpen( true )
// Lobby_SetFDMode( true )
thread file.mpButtonActivateFunc()
}
}
void function OnPlayNSButton_Activate( var button )
{
if ( !Hud_IsLocked( button ) )
{
@ -796,9 +846,12 @@ void function TrackInstallProgress()
bool function IsStryderAuthenticated()
{
// We don't actually need to wait for Stryder response, because we don't care about it anyway
return true
//return GetConVarInt( "mp_allowed" ) != -1
#if VANILLA
return GetConVarInt( "mp_allowed" ) != -1
#else
// We don't actually need to wait for Stryder response, because we don't care about it anyway
return true
#endif
}
bool function IsStryderAllowingMP()
@ -851,6 +904,8 @@ enum eMainMenuPromoDataProperty
void function UpdateCustomMainMenuPromos()
{
// HACK: wait a frame, so that autoexec_ns_client.cfg has taken effect and changed the masterserver hostname
WaitFrame()
NSRequestCustomMainMenuPromos()
thread UpdateCustomMainMenuPromosThreaded()

View file

@ -5703,11 +5703,13 @@ bool function IsSubItemLocked( entity player, string ref, string parentRef )
if ( DevEverythingUnlocked( player ) )
return false
#if !VANILLA
if ( IsItemPurchasableEntitlement( ref, parentRef ) )
return false
if ( GetItemType( ref ) == eItemTypes.PRIME_TITAN || GetSubitemType( parentRef, ref ) == eItemTypes.PRIME_TITAN )
return false
#endif
if ( IsItemInEntitlementUnlock( ref, parentRef ) )
{
@ -5828,11 +5830,13 @@ bool function IsItemLocked( entity player, string ref )
if ( DevEverythingUnlocked( player ) )
return false
#if !VANILLA
if ( IsItemPurchasableEntitlement( ref ) )
return false
if ( GetItemType( ref ) == eItemTypes.PRIME_TITAN )
return false
#endif
if ( IsItemInEntitlementUnlock( ref ) )
{
@ -10096,7 +10100,11 @@ void function InitUnlockAsEntitlement( string itemRef, string parentRef, int ent
unlock = file.entitlementUnlocks[fullRef]
}
#if VANILLA
unlock.entitlementIds.append( entitlementId )
#else
unlock.entitlementIds.append( 1 ) // Using `1` here instead of the huge DLC check I did previously. Having the `1` seems to keep all paid cosmetics unlocked with progression enabled.
#endif
}
array<int> function GetEntitlementIds( string itemRef, string parentRef = "" )

View file

@ -60,7 +60,9 @@ bool function ProgressionEnabledForPlayer( entity player )
#if SERVER
void function OnPlaying()
{
SetUIVar( level, "penalizeDisconnect", false ) // dont show the "you will lose merits thing"
#if !VANILLA
SetUIVar( level, "penalizeDisconnect", false ) // dont show the "you will lose merits thing"
#endif
}
void function OnClientDisconnected( entity player )
@ -132,16 +134,22 @@ void function Progression_SetPreference( bool enabled )
{
SetConVarBool( "ns_progression_enabled", enabled )
#if CLIENT
GetLocalClientPlayer().ClientCommand( "ns_progression " + enabled.tointeger() )
#else // UI
ClientCommand( "ns_progression " + enabled.tointeger() )
#if !VANILLA
#if CLIENT
GetLocalClientPlayer().ClientCommand( "ns_progression " + enabled.tointeger() )
#else // UI
ClientCommand( "ns_progression " + enabled.tointeger() )
#endif
#endif
}
bool function Progression_GetPreference()
{
#if VANILLA
return true
#else
return GetConVarBool( "ns_progression_enabled" )
#endif
}
void function UpdateCachedLoadouts_Delayed()