aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'Northstar.CustomServers/mod/scripts')
-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
19 files changed, 400 insertions, 116 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut
index edb8d79d5..e8deccb02 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 000000000..64e089239
--- /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 37b891699..7c8b5a4ef 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 2b3d39931..9c4af5870 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 5ebf090ab..eb7cfc20b 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 37b891699..150de8bbe 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 eca5849bf..738133856 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 c0242cc19..712fa9de2 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 37b891699..5fd7d1014 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 6198c5db0..2f20d8767 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 ff2a4c7cf..6d8cf55cb 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 63b2c81ac..6dd048092 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 c42899e3f..cdefd8c88 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 95d7492ed..94fda4d70 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 238eab1d1..3421419ca 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 37b891699..fd4808dea 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 20d742d06..9fde28ddc 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 37b891699..4bfeb4f8f 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 37b891699..f495e5879 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