aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut63
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/openinvites.nut242
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut12
-rw-r--r--Northstar.Custom/mod.json19
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut48
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_hs.gnut1
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut3
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/sh_3psequence_to_1p_hacks.gnut20
-rw-r--r--Northstar.Custom/mod/scripts/vscripts/sh_northstar_custom_precache.gnut1
-rw-r--r--Northstar.CustomServers/mod.json8
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut39
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/_misc_stubs.gnut22
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/_ping.gnut8
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/_side_notifications.gnut2
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/_store.gnut39
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut76
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret.gnut6
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut21
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/faction_xp.gnut11
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_coliseum.nut20
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/item_inventory/sv_item_inventory.gnut38
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut22
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut3
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut73
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut1
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/pintelemetry.gnut70
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/sh_northstar_utils.gnut23
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/titan_xp.gnut15
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut27
29 files changed, 792 insertions, 141 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 29c1f81a..c288b3a8 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut
@@ -175,16 +175,17 @@ void function OnServerSelected( var button )
if ( NSIsRequestingServerList() || !NSMasterServerConnectionSuccessful() )
return
- int server = int( Hud_GetScriptID( button ) )
+ int serverIndex = file.page * BUTTONS_PER_PAGE + int ( Hud_GetScriptID( button ) )
+ file.lastSelectedServer = serverIndex
// check mods
- for ( int i = 0; i < NSGetServerRequiredModsCount( server ); i++ )
+ for ( int i = 0; i < NSGetServerRequiredModsCount( serverIndex ); i++ )
{
- if ( !NSGetModNames().contains( NSGetServerRequiredModName( server, i ) ) )
+ if ( !NSGetModNames().contains( NSGetServerRequiredModName( serverIndex, i ) ) )
{
DialogData dialogData
dialogData.header = "#ERROR"
- dialogData.message = "Missing mod \"" + NSGetServerRequiredModName( server, i ) + "\" v" + NSGetServerRequiredModVersion( server, i )
+ dialogData.message = "Missing mod \"" + NSGetServerRequiredModName( serverIndex, i ) + "\" v" + NSGetServerRequiredModVersion( serverIndex, i )
dialogData.image = $"ui/menu/common/dialog_error"
#if PC_PROG
@@ -200,16 +201,43 @@ void function OnServerSelected( var button )
}
else
{
- string modVersion = NSGetServerRequiredModVersion( server, i )
- // check this is sorta valid semver, d
+ // this uses semver https://semver.org
+ array<string> serverModVersion = split( NSGetServerRequiredModVersion( serverIndex, i ), "." )
+ array<string> clientModVersion = split( NSGetModVersionByModName( NSGetServerRequiredModName( serverIndex, i ) ), "." )
+
+ bool semverFail = false
+ // if server has invalid semver don't bother checking
+ if ( serverModVersion.len() == 3 )
+ {
+ // bad client semver
+ if ( clientModVersion.len() != serverModVersion.len() )
+ semverFail = true
+ // major version, don't think we should need to check other versions
+ else if ( clientModVersion[ 0 ] != serverModVersion[ 0 ] )
+ semverFail = true
+ }
+
+ if ( semverFail )
+ {
+ DialogData dialogData
+ dialogData.header = "#ERROR"
+ dialogData.message = "Server has mod \"" + NSGetServerRequiredModName( serverIndex, i ) + "\" v" + NSGetServerRequiredModVersion( serverIndex, i ) + " while we have v" + NSGetModVersionByModName( NSGetServerRequiredModName( serverIndex, i ) )
+ dialogData.image = $"ui/menu/common/dialog_error"
+
+ #if PC_PROG
+ AddDialogButton( dialogData, "#DISMISS" )
+
+ AddDialogFooter( dialogData, "#A_BUTTON_SELECT" )
+ #endif // PC_PROG
+ AddDialogFooter( dialogData, "#B_BUTTON_DISMISS_RUI" )
+
+ OpenDialog( dialogData )
+
+ return
+ }
}
}
- var menu = GetMenu( "ServerBrowserMenu" )
- int serverIndex = file.page * BUTTONS_PER_PAGE + int ( Hud_GetScriptID( button ) )
-
- file.lastSelectedServer = serverIndex
-
if ( NSServerRequiresPassword( serverIndex ) )
AdvanceMenu( GetMenu( "ConnectWithPasswordMenu" ) )
else
@@ -229,16 +257,25 @@ void function ThreadedAuthAndConnectToServer( string password = "" )
if ( NSWasAuthSuccessful() )
{
+ bool modsChanged
+
array<string> requiredMods
for ( int i = 0; i < NSGetServerRequiredModsCount( file.lastSelectedServer ); i++ )
requiredMods.append( NSGetServerRequiredModName( file.lastSelectedServer, i ) )
// unload mods we don't need, load necessary ones and reload mods before connecting
foreach ( string mod in NSGetModNames() )
+ {
if ( NSIsModRequiredOnClient( mod ) )
+ {
+ modsChanged = modsChanged || NSIsModEnabled( mod ) != requiredMods.contains( mod )
NSSetModEnabled( mod, requiredMods.contains( mod ) )
-
- ReloadMods()
+ }
+ }
+
+ // only actually reload if we need to since the uiscript reset on reload lags hard
+ if ( modsChanged )
+ ReloadMods()
NSConnectToAuthedServer()
}
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/openinvites.nut b/Northstar.Client/mod/scripts/vscripts/ui/openinvites.nut
new file mode 100644
index 00000000..4b3d0f55
--- /dev/null
+++ b/Northstar.Client/mod/scripts/vscripts/ui/openinvites.nut
@@ -0,0 +1,242 @@
+global function InitOpenInvitesMenu
+global function UICodeCallback_OpenInviteUpdated
+global function InPendingOpenInvite
+global function LeaveOpenInvite
+global function JoinOpenInvite
+global function JoinOpenInvite_OnClick
+global function CanJoinOpenInvite
+global function CanLeaveOpenInvite
+global function CanDestroyOpenInvite
+global function LeaveOpenInviteButton
+global function IsOpenInviteVisible
+
+struct
+{
+ bool openInviteJoinable
+ bool openInviteVisible
+} file
+
+bool function InPendingOpenInvite()
+{
+ if ( !file.openInviteVisible )
+ return false
+ OpenInvite openInvite = GetOpenInvite()
+ return openInvite.amIInThis
+}
+
+void function LeaveOpenInviteButton( var button )
+{
+ LeaveOpenInvite()
+}
+
+void function LeaveOpenInvite()
+{
+ EmitUISound( "UI_Networks_Invitation_Canceled" )
+ ClientCommand( "leaveopeninvite" )
+
+ // sort of HACK: revert lobby to non-FD mode when you cancel out of open invite
+ Lobby_SetFDMode( false )
+ Lobby_RefreshButtons()
+}
+
+void function JoinOpenInvite( var button )
+{
+ if ( CanJoinOpenInvite() )
+ {
+ EmitUISound( "UI_Networks_Invitation_Accepted" )
+ ClientCommand( "joinopeninvite" )
+ }
+ else if ( CanLeaveOpenInvite() )
+ {
+ LeaveOpenInvite()
+ }
+}
+
+void function JoinOpenInvite_OnClick( var button )
+{
+ // haaaack. Either join it or leave it here, depending on context
+ OpenInvite openInvite = GetOpenInvite()
+ if ( openInvite.amIInThis )
+ LeaveOpenInvite()
+ else
+ JoinOpenInvite( button )
+}
+
+bool function IsOpenInviteVisible()
+{
+ return file.openInviteVisible
+}
+
+bool function CanDestroyOpenInvite()
+{
+ OpenInvite openInvite = GetOpenInvite()
+ return file.openInviteVisible && openInvite.amILeader
+}
+
+bool function CanJoinOpenInvite()
+{
+ OpenInvite openInvite = GetOpenInvite()
+ int currentPartySize = GetPartySize()
+ return currentPartySize <= 1 && file.openInviteVisible && file.openInviteJoinable && !openInvite.amIInThis
+}
+
+bool function CanLeaveOpenInvite()
+{
+ OpenInvite openInvite = GetOpenInvite()
+ return file.openInviteVisible && file.openInviteJoinable && !openInvite.amILeader && openInvite.amIInThis
+}
+
+void function UpdateOpenInvite()
+{
+ OpenInvite openInvite = GetOpenInvite()
+
+ if ( openInvite.timeLeft <= -1 || openInvite.numFreeSlots == 0 )
+ {
+ HideOpenInvite()
+ if ( openInvite.amILeader )
+ ClientCommand( "openinvitelaunch" )
+ if ( openInvite.amIInThis )
+ {
+ CloseAllToTargetMenu( GetMenu( "LobbyMenu" ) )
+ AdvanceMenu( GetMenu( "SearchMenu" ) )
+ }
+ else
+ {
+ Lobby_SetFDMode( false )
+ Lobby_RefreshButtons()
+ }
+ file.openInviteVisible = false
+ file.openInviteJoinable = false
+ UpdateFooterOptions()
+ return
+ }
+
+ array<string> playlists = split( openInvite.playlistName, "," )
+
+ string message = ""
+ string param1 = ""
+ string ornull param2 = null
+ switch( openInvite.inviteType )
+ {
+ case "party":
+ if ( openInvite.amILeader )
+ message = "#OPENINVITE_SENDER_PARTY";
+ else
+ message = "#OPENINVITE_PARTY";
+ param1 = openInvite.originatorName
+ break;
+ case "playlist":
+ if ( playlists.len() > 1 )
+ {
+ if ( openInvite.amILeader )
+ message = "#OPENINVITE_SENDER_PLAYLIST_MANY"
+ else
+ message = "#OPENINVITE_PLAYLIST_MANY"
+ param1 = openInvite.originatorName
+ param2 = GetPlaylistDisplayName( openInvite.playlistName )
+ }
+ else
+ {
+ if ( openInvite.amILeader )
+ message = "#OPENINVITE_SENDER_PLAYLIST"
+ else
+ message = "#OPENINVITE_PLAYLIST"
+ param1 = openInvite.originatorName
+ param2 = GetPlaylistDisplayName( openInvite.playlistName )
+ }
+ break;
+ case "private_match":
+ if ( openInvite.amILeader )
+ message = "#OPENINVITE_SENDER_PRIVATEMATCH"
+ else
+ message = "#OPENINVITE_PRIVATEMATCH"
+ param1 = openInvite.originatorName
+ break;
+ default:
+ HideOpenInvite()
+ file.openInviteVisible = false
+ file.openInviteJoinable = false
+ UpdateFooterOptions()
+ return;
+ }
+ int timeLeft = int( openInvite.timeLeft ) + 1
+ if ( openInvite.timeLeft <= 0 || openInvite.numFreeSlots == 0 )
+ {
+ if ( file.openInviteJoinable )
+ {
+ file.openInviteJoinable = false
+ UpdateFooterOptions()
+ }
+ timeLeft = 0
+ }
+ else
+ {
+ if ( !file.openInviteJoinable )
+ {
+ file.openInviteJoinable = true
+ UpdateFooterOptions()
+ printt( "openinvite is joinable" )
+ }
+ }
+
+ UpdateOpenInvites( openInvite, message, param1, param2, timeLeft )
+}
+
+void function UpdateOpenInvite_Thread()
+{
+ while ( file.openInviteVisible )
+ {
+ if ( !IsConnected() || !IsLobby() )
+ {
+ HideOpenInvite()
+ file.openInviteVisible = false
+ file.openInviteJoinable = false
+ UpdateFooterOptions()
+ return
+ }
+
+ UpdateOpenInvite()
+ WaitFrame()
+ }
+}
+
+void function UICodeCallback_OpenInviteUpdated()
+{
+ if ( file.openInviteVisible || IsNorthstarServer() )
+ return
+
+ int currentPartySize = GetPartySize()
+ if ( currentPartySize > 1 )
+ {
+ HideOpenInvite()
+ file.openInviteVisible = false
+ return
+ }
+
+ if ( !IsConnected() )
+ {
+ HideOpenInvite()
+ file.openInviteVisible = false
+ return
+ }
+
+ entity player = GetUIPlayer()
+ if ( IsValid( player ) && Player_NextAvailableMatchmakingTime( player ) > 0 )
+ {
+ HideOpenInvite()
+ file.openInviteVisible = false
+ return
+ }
+
+ OpenInvite openInvite = GetOpenInvite()
+ ShowOpenInvite()
+ file.openInviteVisible = true
+ UpdateOpenInvite()
+ thread UpdateOpenInvite_Thread()
+}
+
+void function InitOpenInvitesMenu()
+{
+ file.openInviteVisible = false
+ file.openInviteJoinable = false
+}
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut
index 2eafa373..7528495f 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut
@@ -274,15 +274,15 @@ void function UpdatePlayButton( var button )
message = "#CONTACTING_RESPAWN_SERVERS"
file.mpButtonActivateFunc = null
}
- else if ( !isFullyInstalled )
+
+ bool hasNonVanillaMods = false
+ if ( hasNonVanillaMods )
{
- //message = "#INSTALL_IN_PROGRESS"
- file.mpButtonActivateFunc = LaunchMP
+ // todo: make this disable non-vanilla mods
}
else
- {
file.mpButtonActivateFunc = LaunchMP
- }
+
isLocked = file.mpButtonActivateFunc == null ? true : false
Hud_SetLocked( button, isLocked )
@@ -507,6 +507,7 @@ void function OnPlayFDButton_Activate( var button ) // repurposed for launching
//ClientCommand( "setplaylist tdm" )
//ClientCommand( "map mp_lobby" )
+ SetConVarBool( "ns_is_modded_server", true )
NSTryAuthWithLocalServer()
thread TryAuthWithLocalServer()
@@ -537,6 +538,7 @@ void function OnPlayMPButton_Activate( var button )
{
Lobby_SetAutoFDOpen( false )
// Lobby_SetFDMode( false )
+ SetConVarBool( "ns_is_modded_server", false )
thread file.mpButtonActivateFunc()
}
}
diff --git a/Northstar.Custom/mod.json b/Northstar.Custom/mod.json
index 62729854..cb0d24c4 100644
--- a/Northstar.Custom/mod.json
+++ b/Northstar.Custom/mod.json
@@ -3,6 +3,17 @@
"LoadPriority": 1,
"RequiredOnClient": true,
+ "ConVars": [
+ {
+ "Name": "ns_disallowed_weapons",
+ "DefaultValue": ""
+ },
+ {
+ "Name": "ns_disallowed_weapon_primary_replacement",
+ "DefaultValue": "mp_weapon_rspn101"
+ }
+ ],
+
"Scripts": [
{
"Path": "sh_northstar_custom_precache.gnut",
@@ -324,6 +335,14 @@
"After": "ClassicRodeo_InitPlaylistVars"
}
},
+
+ {
+ "Path": "_disallowed_weapons.gnut",
+ "RunOn": "SERVER && MP",
+ "ServerCallback": {
+ "After": "DisallowedWeapons_Init"
+ }
+ }
],
"Localisation": [
diff --git a/Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut b/Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut
new file mode 100644
index 00000000..8dc0300f
--- /dev/null
+++ b/Northstar.Custom/mod/scripts/vscripts/_disallowed_weapons.gnut
@@ -0,0 +1,48 @@
+global function DisallowedWeapons_Init
+
+struct {
+ array<string> disallowedWeapons
+ string disallowedWeaponsStringLastVal
+ string disallowedWeaponReplacement
+} file
+
+void function DisallowedWeapons_Init()
+{
+ UpdateDisallowedWeaponList()
+ AddCallback_OnPlayerRespawned( ReplacePlayerWeaponsForSpawn )
+}
+
+void function UpdateDisallowedWeaponList()
+{
+ string cvar = GetConVarString( "ns_disallowed_weapons" )
+ if ( file.disallowedWeaponsStringLastVal == cvar )
+ return
+
+ file.disallowedWeapons = split( cvar, "," )
+ foreach ( string weapon in file.disallowedWeapons )
+ StringReplace( weapon, " ", "" )
+
+ file.disallowedWeaponReplacement = GetConVarString( "ns_disallowed_weapon_primary_replacement" )
+}
+
+void function ReplacePlayerWeaponsForSpawn( entity player )
+{
+ UpdateDisallowedWeaponList()
+ if ( file.disallowedWeapons.len() == 0 )
+ return
+
+ bool hadDisallowedWeapon = false
+
+ foreach ( entity weapon in player.GetMainWeapons() )
+ {
+ if ( file.disallowedWeapons.contains( weapon.GetWeaponClassName() ) )
+ {
+ player.TakeWeaponNow( weapon.GetWeaponClassName() )
+ player.GiveWeapon( file.disallowedWeaponReplacement )
+ hadDisallowedWeapon = true
+ }
+ }
+
+ if ( hadDisallowedWeapon )
+ SendHudMessage( player, "Restricted weapons were removed", -1, 0.4, 255, 255, 255, 255, 0.15, 3.0, 0.5 )
+} \ No newline at end of file
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_hs.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_hs.gnut
index bc65e0b6..ccdd5b85 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_hs.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_hs.gnut
@@ -20,6 +20,7 @@ void function GamemodeHideAndSeek_Init()
SetTimeoutWinnerDecisionFunc( HideAndSeekDecideWinner )
ClassicMP_SetCustomIntro( GamemodeHideAndSeekIntroSetup, 0.0 )
+ ClassicMP_ForceDisableEpilogue( true )
AddCallback_OnPlayerRespawned( SetupHideAndSeekPlayer )
AddCallback_OnPlayerKilled( TryNotifyLastPlayerAlive )
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut
index cdf03edd..c2b2b021 100644
--- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut
@@ -12,6 +12,7 @@ void function GamemodeInfection_Init()
SetWeaponDropsEnabled( false )
Riff_ForceTitanAvailability( eTitanAvailability.Never )
Riff_ForceBoostAvailability( eBoostAvailability.Disabled )
+ ClassicMP_ForceDisableEpilogue( true )
SetShouldPlayerStartBleedoutFunc( InfectionShouldPlayerStartBleedout )
AddCallback_OnClientConnected( InfectionInitPlayer )
@@ -169,7 +170,7 @@ void function SetLastSurvivor( entity player )
Remote_CallFunction_NonReplay( otherPlayer, "ServerCallback_AnnounceLastSurvivor", player.GetEncodedEHandle() )
Highlight_SetEnemyHighlight( player, "enemy_sonar" )
- thread CreateTitanForPlayerAndHotdrop( player, GetTitanReplacementPoint( player, false ) )
+ //thread CreateTitanForPlayerAndHotdrop( player, GetTitanReplacementPoint( player, false ) )
if ( GameTime_TimeLeftSeconds() > 45 )
SetServerVar( "gameEndTime", Time() + 45.0 )
diff --git a/Northstar.Custom/mod/scripts/vscripts/sh_3psequence_to_1p_hacks.gnut b/Northstar.Custom/mod/scripts/vscripts/sh_3psequence_to_1p_hacks.gnut
index 8b50811a..202e199a 100644
--- a/Northstar.Custom/mod/scripts/vscripts/sh_3psequence_to_1p_hacks.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/sh_3psequence_to_1p_hacks.gnut
@@ -35,7 +35,6 @@ void function FirstPersonSequenceForce1P_Init()
void function FirstPersonSequenceForce1P_InitPlaylistVars()
{
- PrecacheModel( $"models/weapons/sentry_turret/sentry_turret.mdl" )
AddPrivateMatchModeSettingEnum( "#MODE_SETTING_CATEGORY_RIFF", "fp_embark_enabled", [ "Disabled", "Enabled" ], "0" )
}
@@ -86,6 +85,7 @@ Forced1PSequenceData function FirstPersonSequenceForce1P( FirstPersonSequenceStr
ownerProxy.SetModel( player.GetModelName() )
ownerProxy.SetValueForModelKey( player.GetModelName() )
ownerProxy.SetInvulnerable()
+ HideName( ownerProxy )
cleanupData.ownerProxy = ownerProxy
int bodygroupValue = 1
@@ -112,6 +112,7 @@ Forced1PSequenceData function FirstPersonSequenceForce1P( FirstPersonSequenceStr
thirdPersonProxy.SetModel( player.GetModelName() )
thirdPersonProxy.SetValueForModelKey( player.GetModelName() )
thirdPersonProxy.SetInvulnerable()
+ HideName( thirdPersonProxy )
cleanupData.thirdPersonProxy = thirdPersonProxy
if ( player.IsTitan() )
@@ -126,9 +127,14 @@ Forced1PSequenceData function FirstPersonSequenceForce1P( FirstPersonSequenceStr
camera.SetParent( ownerProxy, attachment )
camera.kv.spawnflags = 56
DispatchSpawn( camera )
- player.SetViewEntity( camera, false )
+ player.SetViewEntity( camera, true )
cleanupData.camera = camera
+ // note for potential thing that could be done
+ // entity e = CreatePropDynamic($"models/weapons/arms/pov_titan_light_cockpit.mdl"); e.SetParent(GetPlayerArray()[0].GetPetTitan(), "HATCH_HEAD"); e.SetOrigin(<0.75,0,-195>)
+ // this is so we get a cockpit in these anims, issue with it is that the cockpit seems to break alot of rendering stuff
+ // which really sucks since it'd be awesome to have a cockpit over these anims, really makes them better, even the client func to render through cockpits doesn't seem to work for it, just makes stuff rendering through the cockpit invisible rather than rendering in a broken way
+
Remote_CallFunction_NonReplay( player, "ServerCallback_HideHudForFPHackAnim" )
// play this anim now, so we can cleanup after it's done
thread CleanupForced1PSequenceAfterAnimDone( sequence, ownerProxy, other, cleanupData )
@@ -161,9 +167,13 @@ void function CleanupForced1PSequence( Forced1PSequenceData cleanupData )
#if CLIENT
void function ServerCallback_HideHudForFPHackAnim()
{
- thread MainHud_TurnOff_RUI( true )
- HidePermanentCockpitRui()
-
+ // these functions just set hud positions to infront of/behind the camera, manually set them up here so they'll be far enough away so we don't see them in these anims
+ // in an ideal world we wouldn't even have to turn off this rui stuff because it would be parented to our camera but unfortunately we do not live in an ideal world
+ //thread MainHud_TurnOff_RUI( true )
+ //HidePermanentCockpitRui()
+ RuiTopology_UpdatePos( clGlobal.topoCockpitHud, < -1000, -1000, -1000 >, < -1000, -1000, -1000 >, < -1000, -1000, -1000 > )
+ RuiTopology_UpdatePos( clGlobal.topoCockpitHudPermanent, < -1000, -1000, -1000 >, < -1000, -1000, -1000 >, < -1000, -1000, -1000 > )
+
thread EnableHudOnViewRestored()
}
diff --git a/Northstar.Custom/mod/scripts/vscripts/sh_northstar_custom_precache.gnut b/Northstar.Custom/mod/scripts/vscripts/sh_northstar_custom_precache.gnut
index 3e66b5ca..d5af4cde 100644
--- a/Northstar.Custom/mod/scripts/vscripts/sh_northstar_custom_precache.gnut
+++ b/Northstar.Custom/mod/scripts/vscripts/sh_northstar_custom_precache.gnut
@@ -7,5 +7,6 @@ void function NorthstarCustomPrecache()
PrecacheWeapon( "melee_pilot_kunai" )
// create kunai damage source so game won't crash when we hit smth with it
+ // just using the default melee one, easier than making a new one
getconsttable()[ "eDamageSourceId" ][ "melee_pilot_kunai" ] <- eDamageSourceId.melee_pilot_emptyhanded
} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod.json b/Northstar.CustomServers/mod.json
index ac826d1a..9cd7ebb4 100644
--- a/Northstar.CustomServers/mod.json
+++ b/Northstar.CustomServers/mod.json
@@ -8,6 +8,12 @@
},
{
+ "Name": "ns_is_modded_server",
+ "DefaultValue": "1",
+ "Flags": 8192 // FCVAR_REPLICATED
+ },
+
+ {
"Name": "ns_should_return_to_lobby",
"DefaultValue": "1"
},
@@ -25,7 +31,7 @@
"Scripts": [
{
- "Path": "_misc.gnut",
+ "Path": "_misc_stubs.gnut",
"RunOn": "SERVER && MP",
},
{
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut
index edb8d79d..e8deccb0 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut
@@ -3,14 +3,35 @@ global function MenuCallbacks_Init
void function MenuCallbacks_Init()
{
AddClientCommandCallback( "LeaveMatch", ClientCommandCallback_LeaveMatch )
+ AddClientCommandCallback( "GenUp", ClientCommandCallback_GenUp )
}
bool function ClientCommandCallback_LeaveMatch( entity player, array<string> args )
{
- thread WritePersistenceAndLeave( player )
+ // note: this is imperfect if we have multiple people of the same uid on a server, but that's only a thing in testing
+ if ( NSIsPlayerIndexLocalPlayer( player.GetPlayerIndex() ) )
+ {
+ foreach ( entity otherPlayer in GetPlayerArray() )
+ if ( otherPlayer != player )
+ thread WritePersistenceAndLeave( otherPlayer )
+
+ thread WritePersistenceAndLeaveForLocalPlayerOnly( player )
+ }
+ else
+ thread WritePersistenceAndLeave( player )
+
return true
}
+void function WritePersistenceAndLeaveForLocalPlayerOnly( entity player )
+{
+ float time = Time()
+ while ( GetPlayerArray().len() != 1 && Time() < time + 5.0 )
+ WaitFrame()
+
+ WritePersistenceAndLeave( player )
+}
+
void function WritePersistenceAndLeave( entity player )
{
// write player persistence before we leave, since leaving player might load local lobby before server writes persistence, so they won't get newest
@@ -21,4 +42,20 @@ void function WritePersistenceAndLeave( entity player )
// this is a custom concommand which can be called on clients, it causes them to leave and doesn't have issues if they're host
ClientCommand( player, "ns_start_reauth_and_leave_to_lobby" )
+}
+
+bool function ClientCommandCallback_GenUp( entity player, array<string> args )
+{
+ int gen = player.GetPersistentVarAsInt( "gen" )
+ if ( player.GetPersistentVarAsInt( "xp" ) == GetMaxPlayerXP() && gen < MAX_GEN )
+ {
+ player.SetPersistentVar( "xp", 0 )
+ player.SetPersistentVar( "gen", gen + 1 )
+
+ // ensure client updates properly
+ player.GenChanged()
+ player.XPChanged()
+ }
+
+ return true
} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_misc_stubs.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_misc_stubs.gnut
new file mode 100644
index 00000000..64e08923
--- /dev/null
+++ b/Northstar.CustomServers/mod/scripts/vscripts/_misc_stubs.gnut
@@ -0,0 +1,22 @@
+// todo figure out where these stub functions should be and move them to those places
+global function FW_Border_GlobalInit
+global function IsVDUTitan
+
+void function FW_Border_GlobalInit()
+{
+ AddSpawnCallbackEditorClass( "func_brush", "func_brush_fw_territory_border", RemoveFWBorder )
+}
+
+void function RemoveFWBorder( entity border )
+{
+ if ( GameModeRemove( border ) )
+ return
+
+ if ( !border.HasKey( "gamemode_" + GAMETYPE ) )
+ border.Destroy()
+}
+
+bool function IsVDUTitan( entity titan )
+{
+ return false
+} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_ping.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_ping.gnut
index 37b89169..7c8b5a4e 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/_ping.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/_ping.gnut
@@ -1 +1,7 @@
-//fuck \ No newline at end of file
+// as much as i'd like to restore this i've not been able to get any of this working
+global function Spotting_Init
+
+void function Spotting_Init()
+{
+
+} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_side_notifications.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_side_notifications.gnut
index 2b3d3993..9c4af587 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/_side_notifications.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/_side_notifications.gnut
@@ -1,6 +1,6 @@
global function PROTO_PlayLoadoutNotification
-void function PROTO_PlayLoadoutNotification(string weapon, entity player)
+void function PROTO_PlayLoadoutNotification( string weapon, entity player )
{
} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_store.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_store.gnut
index 5ebf090a..eb7cfc20 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/_store.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/_store.gnut
@@ -1,38 +1 @@
-//todo some of the stuff here should probably get moved to other scripts
-
-global function PIN_BuyItemWithRealMoney
-global function PIN_BuyItem
-global function PIN_GiveItem
-global function PIN_GiveCredits
-global function PIN_ConsumeItem
-global function PIN_AddToPlayerCountStat
-
-void function PIN_BuyItemWithRealMoney(entity player, bool _0, string name, int cost)
-{
-
-}
-
-void function PIN_BuyItem(entity player, bool _0, string name, int cost)
-{
-
-}
-
-void function PIN_GiveItem(entity player, bool _0, string name, int count)
-{
-
-}
-
-void function PIN_GiveCredits(entity player, int count)
-{
-
-}
-
-void function PIN_ConsumeItem(entity player, string name)
-{
-
-}
-
-void function PIN_AddToPlayerCountStat(entity player, string name)
-{
-
-} \ No newline at end of file
+//stub \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut
index 37b89169..150de8bb 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut
@@ -1 +1,75 @@
-//fuck \ No newline at end of file
+global function SvXP_Init
+global function PlayerProgressionAllowed
+global function HandleXPGainForScoreEvent
+
+void function SvXP_Init()
+{
+ AddCallback_OnClientConnected( SetupPlayerPreviousXPValues )
+}
+
+void function SetupPlayerPreviousXPValues( entity player )
+{
+ InitXP( player )
+
+ foreach ( string xpFaction in GetAllFactionRefs() )
+ player.SetPersistentVar( "previousFactionXP[" + xpFaction + "]", FactionGetXP( player, xpFaction ) )
+
+ foreach ( string xpTitan in shTitanXP.titanClasses )
+ player.SetPersistentVar( "previousTitanXP[" + xpTitan + "]", TitanGetXP( player, xpTitan ) )
+
+ foreach ( string xpWeapon in shWeaponXP.weaponClassNames )
+ player.SetPersistentVar( GetItemPersistenceStruct( xpWeapon ) + ".previousWeaponXP", WeaponGetXP( player, xpWeapon ) )
+}
+
+bool function PlayerProgressionAllowed( entity player )
+{
+ return true
+}
+
+void function HandleXPGainForScoreEvent( entity player, ScoreEvent event )
+{
+ // note: obviously all xp stuff can be cheated in if people want to on customs, this is mainly just here for fun for those who want it and feature completeness
+ // most score events don't have this, so we'll set this to the xp value of other categories later if needed
+ int xpValue = ScoreEvent_GetXPValue( event )
+
+ entity activeWeapon = player.GetActiveWeapon()
+ int weaponXp = ScoreEvent_GetXPValueWeapon( event )
+ if ( weaponXp != 0 && ShouldTrackXPForWeapon( activeWeapon.GetWeaponClassName() ) )
+ {
+ AddWeaponXP( player, ScoreEvent_GetXPValueWeapon( event ) )
+ if ( xpValue < weaponXp )
+ xpValue = weaponXp
+ }
+
+ int titanXp = ScoreEvent_GetXPValueTitan( event )
+ if ( titanXp != 0 && player.IsTitan() )
+ {
+ AddTitanXP( player, ScoreEvent_GetXPValueTitan( event ) )
+ if ( xpValue < titanXp )
+ xpValue = titanXp
+ }
+
+ // most events don't have faction xp but almost everything should give it
+ int factionXp = ScoreEvent_GetXPValueFaction( event )
+ if ( xpValue > factionXp )
+ factionXp = xpValue
+ else if ( xpValue < factionXp )
+ xpValue = factionXp
+
+ if ( factionXp != 0 )
+ AddFactionXP( player, factionXp )
+
+ if ( xpValue == 0 )
+ return
+
+ // global xp
+ int oldXp = player.GetPersistentVarAsInt( "xp" )
+ int oldLevel = GetLevelForXP( oldXp )
+ player.SetPersistentVar( "xp", min( oldXp + xpValue, PlayerGetMaxXPPerGen() ) )
+ player.XPChanged() // network xp change to client, gen can't change here
+
+ int newXp = player.GetPersistentVarAsInt( "xp" )
+ int newLevel = GetLevelForXP( newXp )
+ if ( newLevel != oldLevel )
+ Remote_CallFunction_NonReplay( player, "ServerCallback_PlayerLeveledUp", player.GetPersistentVarAsInt( "gen" ), newLevel )
+} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret.gnut b/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret.gnut
index eca5849b..73813385 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/ai/_ai_turret.gnut
@@ -8,17 +8,17 @@ void function AiTurret_Init()
}
-entity function GetMegaTurretLinkedToPanel(entity panel)
+entity function GetMegaTurretLinkedToPanel( entity panel )
{
return null
}
-string function MegaTurretUsabilityFunc(var turret, var panel)
+string function MegaTurretUsabilityFunc( var turret, var panel )
{
return "pilot"
}
-void function SetUsePromptForPanel(var panel, var turret)
+void function SetUsePromptForPanel( var panel, var turret )
{
} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut b/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut
index c0242cc1..712fa9de 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut
@@ -87,12 +87,17 @@ bool function IsEvacDropship( entity ent )
// evac epilogue
void function EvacEpilogueSetup()
{
+ // don't do much here because other scripts should be able to call evac stuff themselves
AddCallback_GameStateEnter( eGameState.Epilogue, EvacEpilogue )
}
void function EvacEpilogue()
{
- thread Evac( GetPlayerArray()[0].GetTeam(), EVAC_INITIAL_WAIT, EVAC_ARRIVAL_TIME, EVAC_WAIT_TIME, EvacEpiloguePlayerCanBoard, EvacEpilogueShouldLeaveEarly, EvacEpilogueCompleted )
+ // make sure we don't run this on ffa modes if no epilogue was specified, since evac is default epilogue
+ if ( GetCurrentPlaylistVarInt( "max_teams", 2 ) == 2 )
+ thread Evac( GetPlayerArray()[0].GetTeam(), EVAC_INITIAL_WAIT, EVAC_ARRIVAL_TIME, EVAC_WAIT_TIME, EvacEpiloguePlayerCanBoard, EvacEpilogueShouldLeaveEarly, EvacEpilogueCompleted )
+ else
+ thread EvacEpilogueCompleted( null ) // this is hacky but like, this also shouldn't really be hit in normal gameplay
}
bool function EvacEpiloguePlayerCanBoard( entity dropship, entity player )
@@ -123,14 +128,16 @@ bool function EvacEpilogueShouldLeaveEarly( entity dropship )
void function EvacEpilogueCompleted( entity dropship )
{
wait 5.0
- print( dropship )
- foreach ( entity player in dropship.s.evacSlots )
+ if ( IsValid( dropship ) )
{
- if ( !IsValid( player ) )
- continue
-
- ScreenFadeToBlackForever( player, 2.0 )
+ foreach ( entity player in dropship.s.evacSlots )
+ {
+ if ( !IsValid( player ) )
+ continue
+
+ ScreenFadeToBlackForever( player, 2.0 )
+ }
}
wait 2.0
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/faction_xp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/faction_xp.gnut
index 37b89169..5fd7d101 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/faction_xp.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/faction_xp.gnut
@@ -1 +1,10 @@
-//fuck \ No newline at end of file
+global function AddFactionXP
+
+void function AddFactionXP( entity player, int amount )
+{
+ string faction = GetFactionChoice( player )
+ // increment xp
+ player.SetPersistentVar( "factionXP[" + faction + "]", min( FactionGetXP( player, faction ) + amount, FactionGetMaxXP( faction ) ) )
+
+ // note: no notif for faction level up
+} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_coliseum.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_coliseum.nut
index 6198c5db..2f20d876 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_coliseum.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_coliseum.nut
@@ -52,7 +52,25 @@ void function ShowColiseumIntroScreenThreaded()
wait 5
foreach ( entity player in GetPlayerArray() )
- Remote_CallFunction_NonReplay( player, "ServerCallback_ColiseumIntro", 1, 1, 1 ) // stub numbers atm because lazy
+ {
+
+ array<entity> otherTeam = GetPlayerArrayOfTeam( GetOtherTeam( player.GetTeam() ) )
+
+ int winstreak = 0
+ int wins = 0
+ int losses = 0
+
+ if ( otherTeam.len() != 0 )
+ {
+ entity enemy = otherTeam[ 0 ]
+
+ winstreak = enemy.GetPersistentVarAsInt( "coliseumWinStreak" )
+ wins = enemy.GetPersistentVarAsInt( "coliseumTotalWins" )
+ losses = enemy.GetPersistentVarAsInt( "coliseumTotalLosses" )
+ }
+
+ Remote_CallFunction_NonReplay( player, "ServerCallback_ColiseumIntro", winstreak, wins, losses ) // stub numbers atm because lazy
+ }
}
void function GivePlayerColiseumLoadout( entity player )
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/item_inventory/sv_item_inventory.gnut b/Northstar.CustomServers/mod/scripts/vscripts/item_inventory/sv_item_inventory.gnut
index ff2a4c7c..6d8cf55c 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/item_inventory/sv_item_inventory.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/item_inventory/sv_item_inventory.gnut
@@ -1,60 +1,36 @@
global function Sv_ItemInventory_Init
-global function PIN_Init
global function SvPlayerInventory_ItemCount
-global function PlayerInventory_StartCriticalSection
-global function PlayerInventory_EndCriticalSectionForWeaponOnEndFrame
global function PlayerInventory_CountTurrets
-global function PIN_PlayerAbility
-global function PIN_PlayerAbilityReady
-global function PIN_DamageDone
global function PlayerInventory_RefreshEquippedState
+global function PlayerInventory_StartCriticalSection
+global function PlayerInventory_EndCriticalSectionForWeaponOnEndFrame
void function Sv_ItemInventory_Init()
{
}
-void function PIN_Init()
-{
-
-}
-
-int function SvPlayerInventory_ItemCount(entity player)
+int function SvPlayerInventory_ItemCount( entity player )
{
return 0
}
-void function PlayerInventory_StartCriticalSection(entity player)
-{
-
-}
-
-void function PlayerInventory_EndCriticalSectionForWeaponOnEndFrame(entity player)
-{
-
-}
-
-int function PlayerInventory_CountTurrets(entity owner)
+int function PlayerInventory_CountTurrets( entity player )
{
return 0
}
-void function PIN_PlayerAbility(entity player, string name, string action, /*no idea what this type is supposed to be*/ var _0, float duration = 0)
-{
-
-}
-
-void function PIN_PlayerAbilityReady(entity player, string action)
+void function PlayerInventory_RefreshEquippedState( entity player )
{
}
-void function PIN_DamageDone(entity player, entity victim, var damageInfo)
+void function PlayerInventory_StartCriticalSection( entity player )
{
}
-void function PlayerInventory_RefreshEquippedState( entity player )
+void function PlayerInventory_EndCriticalSectionForWeaponOnEndFrame( entity player )
{
} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut b/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut
index 63b2c81a..6dd04809 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut
@@ -11,7 +11,6 @@ struct {
void function PrivateLobby_Init()
{
print( "PrivateLobby_Init()" )
- //ClearPlaylistVarOverrides()
file.map = GetConVarString( "ns_private_match_last_map" )
file.mode = GetConVarString( "ns_private_match_last_mode" )
@@ -22,6 +21,7 @@ void function PrivateLobby_Init()
AddClientCommandCallback( "PrivateMatchSetMode", ClientCommandCallback_PrivateMatchSetMode )
AddClientCommandCallback( "SetCustomMap", ClientCommandCallback_SetCustomMap )
AddClientCommandCallback( "PrivateMatchSwitchTeams", ClientCommandCallback_PrivateMatchSwitchTeams )
+ AddClientCommandCallback( "PrivateMatchToggleSpectate", ClientCommandCallback_PrivateMatchToggleSpectate )
AddClientCommandCallback( "PrivateMatchSetPlaylistVarOverride", ClientCommandCallback_PrivateMatchSetPlaylistVarOverride )
AddClientCommandCallback( "ResetMatchSettingsToDefault", ClientCommandCallback_ResetMatchSettingsToDefault )
@@ -99,6 +99,12 @@ bool function ClientCommandCallback_PrivateMatchSwitchTeams( entity player, arra
return true
}
+bool function ClientCommandCallback_PrivateMatchToggleSpectate( entity player, array<string> args )
+{
+ // not currently working, gotta figure it out at some point
+ return true
+}
+
void function StartMatch()
{
// set starting uivar
@@ -112,16 +118,11 @@ void function StartMatch()
while ( Time() < countdownEndTime )
{
// stop if the countdown's been cancelled
- if ( file.startState != ePrivateMatchStartState.STARTING)
+ if ( file.startState != ePrivateMatchStartState.STARTING )
return
WaitFrame()
}
-
- if ( file.mode in GAMETYPE_TEXT )
- GameRules_SetGameMode( file.mode )
- else
- GameRules_SetGameMode( GetPlaylistGamemodeByIndex( file.mode, 0 ) )
try
{
@@ -144,8 +145,11 @@ void function StartMatch()
SetConVarString( "ns_private_match_last_mode", file.mode )
SetConVarBool( "ns_should_return_to_lobby", true ) // potentially temp?
- // TEMP for now: start game
- ServerCommand( "changelevel " + file.map )
+ string mode = file.mode
+ if ( !( mode in GAMETYPE_TEXT ) )
+ mode = GetPlaylistGamemodeByIndex( file.mode, 0 )
+
+ GameRules_ChangeMap( file.map, mode )
}
void function RefreshPlayerTeams()
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 c42899e3..cdefd8c8 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut
@@ -220,6 +220,9 @@ void function CodeCallback_OnPlayerRespawned( entity player )
Loadouts_TryGivePilotLoadout( player )
SetHumanRagdollImpactTable( player )
+
+ foreach ( entity weapon in player.GetMainWeapons() )
+ weapon.SetProScreenOwner( player )
foreach ( void functionref( entity ) callback in svGlobal.onPlayerRespawnedCallbacks )
callback( player )
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut
index 95d7492e..94fda4d7 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut
@@ -7,6 +7,9 @@ void function CodeCallback_MatchIsOver()
else
SetUIVar( level, "putPlayerInMatchmakingAfterDelay", false )
+ AddCreditsForXPGained()
+ PopulatePostgameData()
+
if ( ShouldReturnToLobby() )
{
SetCurrentPlaylist( "private_match" ) // needed for private lobby to load
@@ -22,3 +25,73 @@ void function CodeCallback_MatchIsOver()
GameRules_ChangeMap( "mp_lobby", GAMETYPE )
#endif // #if DEV
}
+
+void function PopulatePostgameData()
+{
+ // something's busted here because this isn't showing automatically on match end, ag
+ foreach ( entity player in GetPlayerArray() )
+ {
+ int teams = GetCurrentPlaylistVarInt( "max_teams", 2 )
+ bool standardTeams = teams != 2
+
+ int enumModeIndex = 0
+ int enumMapIndex = 0
+
+ try
+ {
+ enumModeIndex = PersistenceGetEnumIndexForItemName( "gamemodes", GAMETYPE )
+ enumMapIndex = PersistenceGetEnumIndexForItemName( "maps", GetMapName() )
+ }
+ catch( ex ) {}
+
+ player.SetPersistentVar( "postGameData.myTeam", player.GetTeam() )
+ player.SetPersistentVar( "postGameData.myXuid", player.GetUID() )
+ player.SetPersistentVar( "postGameData.gameMode", PersistenceGetEnumIndexForItemName( "gamemodes", GAMETYPE ) )
+ player.SetPersistentVar( "postGameData.map", PersistenceGetEnumIndexForItemName( "maps", GetMapName() ) )
+ player.SetPersistentVar( "postGameData.teams", standardTeams )
+ player.SetPersistentVar( "postGameData.maxTeamSize", teams )
+ player.SetPersistentVar( "postGameData.privateMatch", true )
+ player.SetPersistentVar( "postGameData.ranked", true )
+ player.SetPersistentVar( "postGameData.hadMatchLossProtection", false )
+
+ player.SetPersistentVar( "isFDPostGameScoreboardValid", GAMETYPE == FD )
+
+ if ( standardTeams )
+ {
+ if ( player.GetTeam() == TEAM_MILITIA )
+ {
+ player.SetPersistentVar( "postGameData.factionMCOR", GetFactionChoice( player ) )
+ player.SetPersistentVar( "postGameData.factionIMC", GetEnemyFaction( player ) )
+ }
+ else
+ {
+ player.SetPersistentVar( "postGameData.factionIMC", GetFactionChoice( player ) )
+ player.SetPersistentVar( "postGameData.factionMCOR", GetEnemyFaction( player ) )
+ }
+
+ player.SetPersistentVar( "postGameData.scoreMCOR", GameRules_GetTeamScore( TEAM_MILITIA ) )
+ player.SetPersistentVar( "postGameData.scoreIMC", GameRules_GetTeamScore( TEAM_IMC ) )
+ }
+ else
+ {
+ player.SetPersistentVar( "postGameData.factionMCOR", GetFactionChoice( player ) )
+ player.SetPersistentVar( "postGameData.scoreMCOR", GameRules_GetTeamScore( player.GetTeam() ) )
+ }
+
+ array<entity> otherPlayers = GetPlayerArray()
+ array<int> scoreTypes = GameMode_GetScoreboardColumnScoreTypes( GAMETYPE )
+ int persistenceArrayCount = PersistenceGetArrayCount( "postGameData.players" )
+ for ( int i = 0; i < min( otherPlayers.len(), persistenceArrayCount ); i++ )
+ {
+ player.SetPersistentVar( "postGameData.players[" + i + "].team", otherPlayers[ i ].GetTeam() )
+ player.SetPersistentVar( "postGameData.players[" + i + "].name", otherPlayers[ i ].GetPlayerName() )
+ player.SetPersistentVar( "postGameData.players[" + i + "].xuid", otherPlayers[ i ].GetUID() )
+ player.SetPersistentVar( "postGameData.players[" + i + "].callsignIconIndex", otherPlayers[ i ].GetPersistentVarAsInt( "activeCallsignIconIndex" ) )
+
+ for ( int j = 0; j < scoreTypes.len(); j++ )
+ player.SetPersistentVar( "postGameData.players[" + i + "].scores[" + j + "]", otherPlayers[ i ].GetPlayerGameStat( scoreTypes[ j ] ) )
+ }
+
+ player.SetPersistentVar( "isPostGameScoreboardValid", true )
+ }
+} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut
index 238eab1d..3421419c 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut
@@ -17,6 +17,7 @@ struct {
void function Score_Init()
{
+ SvXP_Init()
AddCallback_OnClientConnected( InitPlayerForScoreEvents )
}
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/pintelemetry.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/pintelemetry.gnut
index 37b89169..fd4808de 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/pintelemetry.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/pintelemetry.gnut
@@ -1 +1,69 @@
-//fuck \ No newline at end of file
+// all stubs because we don't really need this
+// if we actually ever want to mess with stats stuff, code already calls all this
+
+global function PIN_Init
+global function PIN_BuyItemWithRealMoney
+global function PIN_BuyItem
+global function PIN_GiveItem
+global function PIN_GiveCredits
+global function PIN_ConsumeItem
+global function PIN_AddToPlayerCountStat
+global function PIN_PlayerAbility
+global function PIN_PlayerAbilityReady
+global function PIN_DamageDone
+global function PIN_PlayerRodeoedEnemyTitanToCompletion
+
+void function PIN_Init()
+{
+
+}
+
+void function PIN_BuyItemWithRealMoney( entity player, bool _0, string name, int cost )
+{
+
+}
+
+void function PIN_BuyItem( entity player, bool _0, string name, int cost )
+{
+
+}
+
+void function PIN_GiveItem( entity player, bool _0, string name, int count )
+{
+
+}
+
+void function PIN_GiveCredits( entity player, int count )
+{
+
+}
+
+void function PIN_ConsumeItem( entity player, string name )
+{
+
+}
+
+void function PIN_AddToPlayerCountStat( entity player, string name )
+{
+
+}
+
+void function PIN_PlayerAbility( entity player, string name, string action, table args, float duration = 0 )
+{
+
+}
+
+void function PIN_PlayerAbilityReady( entity player, string action )
+{
+
+}
+
+void function PIN_DamageDone( entity player, entity victim, var damageInfo )
+{
+
+}
+
+void function PIN_PlayerRodeoedEnemyTitanToCompletion( entity player, entity titan, bool playerHadBattery )
+{
+
+} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/sh_northstar_utils.gnut b/Northstar.CustomServers/mod/scripts/vscripts/sh_northstar_utils.gnut
index 20d742d0..9fde28dd 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/sh_northstar_utils.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/sh_northstar_utils.gnut
@@ -1,23 +1,15 @@
globalize_all_functions
-enum eNorthstarLobbyType
+global enum eNorthstarLobbyType
{
PrivateMatchLobby, // normal vanilla private lobby
- IntermissionLobby, // similar to tf1's intermission lobby, chooses next map automatically
- CompetitiveLobby // similar to vanilla privates, but with ready up system
+ IntermissionLobby, // similar to tf1's intermission lobby, chooses next map automatically, can't change settings unless you're host
}
// whether the server is a modded, northstar server
bool function IsNorthstarServer()
{
- bool isModded = true // TEMP for testing
- try
- {
- // need this in a trycatch because the var might not exist atm
- isModded = GetConVarInt( "northstar_is_modded_server" ) == 1
- } catch ( ex ) {}
-
- return isModded
+ return GetConVarBool( "ns_is_modded_server" )
}
// whether the game should return to the lobby on GameRules_EndMatch()
@@ -30,13 +22,6 @@ int function GetNorthstarLobbyType()
{
if ( !IsNorthstarServer() )
return eNorthstarLobbyType.PrivateMatchLobby
-
- int lobbyType = eNorthstarLobbyType.PrivateMatchLobby
- try
- {
- // need this in a trycatch because the var might not exist atm
- lobbyType = GetConVarInt( "northstar_lobby_type" )
- } catch ( ex ) {}
- return lobbyType
+ return GetConVarInt( "ns_lobby_type" )
} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/titan_xp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/titan_xp.gnut
index 37b89169..4bfeb4f8 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/titan_xp.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/titan_xp.gnut
@@ -1 +1,14 @@
-//fuck \ No newline at end of file
+global function AddTitanXP
+
+void function AddTitanXP( entity player, int amount )
+{
+ string titan = GetActiveTitanLoadout( player ).titanClass
+ int oldLevel = TitanGetLevel( player, titan )
+
+ // increment xp
+ player.SetPersistentVar( "titanXP[" + titan + "]", min( TitanGetXP( player, titan ) + amount, TitanGetMaxXP( titan ) ) )
+
+ // level up notif
+ if ( TitanGetLevel( player, titan ) != oldLevel )
+ Remote_CallFunction_NonReplay( player, "ServerCallback_TitanLeveledUp", shTitanXP.titanClasses.find( titan ), TitanGetGen( player, titan ), TitanGetLevel( player, titan ) )
+} \ No newline at end of file
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut
index 37b89169..f495e587 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut
@@ -1 +1,26 @@
-//fuck \ No newline at end of file
+untyped
+global function AddWeaponXP
+
+void function AddWeaponXP( entity player, int amount )
+{
+ entity activeWeapon = player.GetActiveWeapon()
+ string weaponClassname = activeWeapon.GetWeaponClassName()
+ int oldLevel = WeaponGetLevel( player, weaponClassname )
+
+ // increment xp
+ player.SetPersistentVar( GetItemPersistenceStruct( weaponClassname ) + ".weaponXP", min( WeaponGetXP( player, weaponClassname ) + amount, WeaponGetMaxXP( weaponClassname ) ) )
+
+ // level up notif
+ if ( WeaponGetLevel( player, weaponClassname ) != oldLevel )
+ Remote_CallFunction_NonReplay( player, "ServerCallback_WeaponLeveledUp", shWeaponXP.weaponClassNames.find( weaponClassname ), WeaponGetGen( player, weaponClassname ), WeaponGetLevel( player, weaponClassname ) )
+
+ // proscreen
+ if ( player == activeWeapon.GetProScreenOwner() )
+ {
+ player.SetPersistentVar( GetItemPersistenceStruct( weaponClassname ) + ".proScreenKills", WeaponGetProScreenKills( player, weaponClassname ) + amount )
+
+ // not currently used rn, but adding a script var so scripts can handle proscreen values manually if wanted
+ if ( "manualProscreenControl" in activeWeapon.s && activeWeapon.s.manualProscreenControl )
+ activeWeapon.SetProScreenIntValForIndex( 0, WeaponGetProScreenKills( player, weaponClassname ) )
+ }
+} \ No newline at end of file