From 1b6e5af70bf442c684b891003e516329b190c130 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Tue, 14 Dec 2021 02:20:10 +0000 Subject: various fixes --- .../scripts/vscripts/_northstar_devcommands.gnut | 9 ++++++ .../scripts/vscripts/gamemodes/_gamemode_gg.gnut | 10 +++++-- .../lobby/sh_private_lobby_custom_modes_init.gnut | 14 ---------- .../vscripts/melee/_melee_synced_human.gnut | 10 +++++++ .../vscripts/melee/_melee_synced_titan.gnut | 6 ++++ .../mod/scripts/vscripts/rodeo/_rodeo_titan.gnut | 4 ++- .../scripts/vscripts/titan/sh_titan_embark.gnut | 2 ++ .../mod/cfg/autoexec_ns_server.cfg | 1 + .../mod/scripts/vscripts/_xp.gnut | 27 ++++++++---------- .../mod/scripts/vscripts/mp/_changemap.nut | 32 ++++++++++++++++++++-- .../mod/scripts/vscripts/mp/_playlist.gnut | 3 ++ .../mod/scripts/vscripts/mp/_score.nut | 2 ++ .../mod/scripts/vscripts/weapon_xp.gnut | 2 +- 13 files changed, 86 insertions(+), 36 deletions(-) delete mode 100644 Northstar.Custom/mod/scripts/vscripts/lobby/sh_private_lobby_custom_modes_init.gnut diff --git a/Northstar.Custom/mod/scripts/vscripts/_northstar_devcommands.gnut b/Northstar.Custom/mod/scripts/vscripts/_northstar_devcommands.gnut index 960e619e6..ac08c7b55 100644 --- a/Northstar.Custom/mod/scripts/vscripts/_northstar_devcommands.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/_northstar_devcommands.gnut @@ -6,6 +6,7 @@ void function NorthstarDevCommands_Init() AddClientCommandCallback( "noclip", ClientCommandCallbackToggleNoclip ) AddClientCommandCallback( "script", ClientCommandCallbackEvalScript ) AddClientCommandCallback( "kill", ClientCommandCallbackKill ) + AddClientCommandCallback( "explode", ClientCommandCallbackExplode ) } bool function ClientCommandCallbackToggleNoclip( entity player, array args ) @@ -50,5 +51,13 @@ bool function ClientCommandCallbackKill( entity player, array args ) if ( IsAlive( player ) && GetConVarInt( "sv_cheats" ) == 1 ) player.Die() + return true +} + +bool function ClientCommandCallbackExplode( entity player, array args ) +{ + if ( IsAlive( player ) && GetConVarInt( "sv_cheats" ) == 1 ) + player.Die( null, null, { scriptType = DF_GIB } ) + return true } \ No newline at end of file diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut index 8c68f5543..5794260b8 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_gg.gnut @@ -16,9 +16,13 @@ void function GamemodeGG_Init() AddCallback_GameStateEnter( eGameState.WinnerDetermined, OnWinnerDetermined ) - // set scorelimit if it's wrongm sort of a jank way to do it but best i've got rn - if ( GetCurrentPlaylistVarInt( "scorelimit", GetGunGameWeapons().len() ) != GetGunGameWeapons().len() ) - SetPlaylistVarOverride( "scorelimit", GetGunGameWeapons().len().tostring() ) + // set scorelimit if it's wrong, sort of a jank way to do it but best i've got rn + try + { + if ( GetCurrentPlaylistVarInt( "scorelimit", GetGunGameWeapons().len() ) != GetGunGameWeapons().len() ) + SetPlaylistVarOverride( "scorelimit", GetGunGameWeapons().len().tostring() ) + } + catch ( ex ) {} } void function OnPlayerRespawned( entity player ) diff --git a/Northstar.Custom/mod/scripts/vscripts/lobby/sh_private_lobby_custom_modes_init.gnut b/Northstar.Custom/mod/scripts/vscripts/lobby/sh_private_lobby_custom_modes_init.gnut deleted file mode 100644 index f67a274b9..000000000 --- a/Northstar.Custom/mod/scripts/vscripts/lobby/sh_private_lobby_custom_modes_init.gnut +++ /dev/null @@ -1,14 +0,0 @@ -global function CustomPrivateMatchModesInit - -void function CustomPrivateMatchModesInit() -{ - // modes - AddPrivateMatchMode( "gg" ) - AddPrivateMatchMode( "inf" ) - AddPrivateMatchMode( "kr" ) - AddPrivateMatchMode( "tt" ) - AddPrivateMatchMode( "ctf_comp" ) - - // this is nonfunctional for some reason - AddPrivateMatchMap( "mp_skyway_v1" ) -} \ No newline at end of file diff --git a/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_human.gnut b/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_human.gnut index 068ffcfd0..2f94e7599 100644 --- a/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_human.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_human.gnut @@ -258,14 +258,20 @@ void function MeleeThread_PilotVsEnemy_Attacker( SyncedMelee action, entity atta if ( isAttackerRef ) { + #if MP if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) FirstPersonSequenceForce1P( attackerSequence, attacker ) + #endif + thread FirstPersonSequence( attackerSequence, attacker ) } else { + #if MP if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) FirstPersonSequenceForce1P( attackerSequence, attacker, target ) + #endif + thread FirstPersonSequence( attackerSequence, attacker, target ) } @@ -403,15 +409,19 @@ void function MeleeThread_PilotVsEnemy_Target( SyncedMelee action, entity attack if ( isAttackerRef ) { + #if MP if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) FirstPersonSequenceForce1P( targetSequence, target, attacker ) + #endif waitthread FirstPersonSequence( targetSequence, target, attacker ) } else { + #if MP if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) FirstPersonSequenceForce1P( targetSequence, target ) + #endif waitthread FirstPersonSequence( targetSequence, target ) } diff --git a/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_titan.gnut b/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_titan.gnut index be2e512ec..d9e995f7a 100644 --- a/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_titan.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/melee/_melee_synced_titan.gnut @@ -1330,6 +1330,7 @@ void function TitanVsTitan_3p( SyncedMelee action, entity attacker, entity targe attackerBodySequence.useAnimatedRefAttachment = true + #if MP // could use FirstPersonSequenceForce1P here, but since this uses a propdynamic rather than a player, easier to do it manually if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) { @@ -1356,6 +1357,7 @@ void function TitanVsTitan_3p( SyncedMelee action, entity attacker, entity targe ScreenFadeFromBlack( attacker, 1.0, 0.5 ) thread Forced1PAttackerViewBodySequence( attackerBodySequence, attackerViewBodyProxy, attacker, camera ) } + #endif thread FirstPersonSequence( attackerBodySequence, attackerViewBody, attacker ) } @@ -1369,6 +1371,7 @@ void function TitanVsTitan_3p( SyncedMelee action, entity attacker, entity targe if ( isAttackerRef ) { + #if MP if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) { if ( attacker.IsPlayer() && !attackerDoing1PViewbodyAnim ) @@ -1377,12 +1380,14 @@ void function TitanVsTitan_3p( SyncedMelee action, entity attacker, entity targe if ( target.IsPlayer() ) FirstPersonSequenceForce1P( targetSequence, target, attacker ) } + #endif thread FirstPersonSequence( attackerSequence, attacker ) waitthread FirstPersonSequence( targetSequence, target, attacker ) } else { + #if MP if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 ) { if ( target.IsPlayer() ) @@ -1391,6 +1396,7 @@ void function TitanVsTitan_3p( SyncedMelee action, entity attacker, entity targe if ( attacker.IsPlayer() && !attackerDoing1PViewbodyAnim ) FirstPersonSequenceForce1P( attackerSequence, attacker, target ) } + #endif thread FirstPersonSequence( targetSequence, target ) waitthread FirstPersonSequence( attackerSequence, attacker, target ) diff --git a/Northstar.Custom/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut b/Northstar.Custom/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut index a2ff31aec..499ca0b7d 100644 --- a/Northstar.Custom/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut @@ -834,7 +834,7 @@ void function TryBatteryStyleRodeo( entity rodeoPilot, entity rodeoTitan, entity } #endif - bool classicRodeo = GetCurrentPlaylistVarInt( "classic_rodeo", 0 ) == 1 + bool classicRodeo = MP && GetCurrentPlaylistVarInt( "classic_rodeo", 0 ) == 1 if ( ShouldThrowGrenadeInHatch( rodeoPilot ) ) { @@ -846,6 +846,7 @@ void function TryBatteryStyleRodeo( entity rodeoPilot, entity rodeoTitan, entity waitthread PlayerRemovesBatteryPack( rodeoPilot, rodeoTitan, titanSoul, rodeoPackage ) //This ends rodeo at the end of the sequence } + #if MP if ( classicRodeo ) { RodeoBatteryRemoval_ShowBattery( rodeoPilot ) // hide battery, will be shown at the end of a battery removal rodeo @@ -876,6 +877,7 @@ void function TryBatteryStyleRodeo( entity rodeoPilot, entity rodeoTitan, entity WaitFrame() } } + #endif } struct RodeoRiderSequenceStruct diff --git a/Northstar.Custom/mod/scripts/vscripts/titan/sh_titan_embark.gnut b/Northstar.Custom/mod/scripts/vscripts/titan/sh_titan_embark.gnut index 5a1ecd8fa..4fd4d0c67 100644 --- a/Northstar.Custom/mod/scripts/vscripts/titan/sh_titan_embark.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/titan/sh_titan_embark.gnut @@ -951,8 +951,10 @@ function TitanEmbark_PlayerEmbarks( entity player, entity titan, table e ) } ) + #if MP if ( GetCurrentPlaylistVarInt( "fp_embark_enabled", 0 ) == 1 && !doFirstPersonAnim ) FirstPersonSequenceForce1P( sequence, player, titan ) + #endif thread FirstPersonSequence( sequence, player, titan ) // EmitDifferentSoundsOnEntityForPlayerAndWorld( firstPersonAudio, thirdPersonAudio, titan, player ) diff --git a/Northstar.CustomServers/mod/cfg/autoexec_ns_server.cfg b/Northstar.CustomServers/mod/cfg/autoexec_ns_server.cfg index dbf4e388d..3103f3e74 100644 --- a/Northstar.CustomServers/mod/cfg/autoexec_ns_server.cfg +++ b/Northstar.CustomServers/mod/cfg/autoexec_ns_server.cfg @@ -8,4 +8,5 @@ ns_auth_allow_insecure 0 // keep this to 0 unless you want to allow people to jo ns_erase_auth_info 1 // keep this to 1 unless you're testing and crashing alot, so you don't have to go through the northstar lobby to reauth ns_player_auth_port 8081 // this can be whatever, make sure it's portforwarded over tcp +ns_masterserver_hostname "192.248.160.3" // masterserver hostname everything_unlocked 1 // unlock everything \ 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 150de8bbe..0be171d12 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut @@ -31,23 +31,20 @@ 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 - } + + if ( xpValue < weaponXp ) + xpValue = weaponXp + else if ( xpValue < titanXp ) + xpValue = titanXp + + if ( ShouldTrackXPForWeapon( player.GetActiveWeapon().GetWeaponClassName() ) ) + AddWeaponXP( player, xpValue ) + + // if we specifically gain titan xp, then give titan xp no matter what, otherwise only give it when we're in a titan + if ( titanXp != 0 || player.IsTitan() ) + AddTitanXP( player, xpValue ) // most events don't have faction xp but almost everything should give it int factionXp = ScoreEvent_GetXPValueFaction( event ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut index a2e95e082..470fa6a41 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut @@ -6,9 +6,11 @@ void function CodeCallback_MatchIsOver() SetUIVar( level, "putPlayerInMatchmakingAfterDelay", true ) else SetUIVar( level, "putPlayerInMatchmakingAfterDelay", false ) - + + #if MP AddCreditsForXPGained() PopulatePostgameData() + #endif if ( ShouldReturnToLobby() ) { @@ -19,6 +21,30 @@ void function CodeCallback_MatchIsOver() else GameRules_ChangeMap( "mp_lobby", GAMETYPE ) } + else + { + // iterate over all gamemodes/maps in current playlist, choose map/mode combination that's directly after our current one + // if we reach the end, go back to the first map/mode + bool changeOnNextIteration = false + + for ( int i = 0; i < GetCurrentPlaylistGamemodesCount(); i++ ) + { + if ( GetCurrentPlaylistGamemodeByIndex( i ) == GAMETYPE ) + { + for ( int j = 0; j < GetCurrentPlaylistGamemodeByIndexMapsCount( i ); j++ ) + { + if ( changeOnNextIteration ) + GameRules_ChangeMap( GetCurrentPlaylistGamemodeByIndexMapByIndex( i, j ), GetCurrentPlaylistGamemodeByIndex( i ) ) + + if ( GetCurrentPlaylistGamemodeByIndexMapByIndex( i, j ) == GetMapName() ) + changeOnNextIteration = true // change to next map/mode we iterate over + } + } + } + + // go back to first map/mode + GameRules_ChangeMap( GetCurrentPlaylistGamemodeByIndexMapByIndex( 0, 0 ), GetCurrentPlaylistGamemodeByIndex( 0 ) ) + } #if DEV if ( !IsMatchmakingServer() ) @@ -26,6 +52,7 @@ void function CodeCallback_MatchIsOver() #endif // #if DEV } +#if MP void function PopulatePostgameData() { // something's busted here because this isn't showing automatically on match end, ag @@ -94,4 +121,5 @@ void function PopulatePostgameData() player.SetPersistentVar( "isPostGameScoreboardValid", true ) } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_playlist.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_playlist.gnut index 0d610e37b..8db52b118 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_playlist.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_playlist.gnut @@ -61,8 +61,10 @@ void function FeaturedModeSettingsSetupPilotLoadouts( entity player ) shouldChangeLoadout = true + // have to set attachments too, otherwise we could give invalid mods for this weapon modifiedLoadout.primary = "mp_weapon_epg" modifiedLoadout.primaryMods = [ "rocket_arena" ] + modifiedLoadout.primaryAttachments = [ "" ] // set secondary to whatever one is pistol if ( GetWeaponInfoFileKeyField_Global( player.GetMainWeapons()[ 1 ].GetWeaponClassName(), "menu_category" ) == "at" ) @@ -87,6 +89,7 @@ void function FeaturedModeSettingsSetupPilotLoadouts( entity player ) // this one was never released, assuming it just gives you a mastiff and a kraber with quick swap modifiedLoadout.primary = "mp_weapon_sniper" modifiedLoadout.primaryMods = [ "pas_fast_swap", "pas_fast_ads" ] + modifiedLoadout.primaryAttachments = [ "" ] // set secondary to whatever one is pistol if ( GetWeaponInfoFileKeyField_Global( player.GetMainWeapons()[ 1 ].GetWeaponClassName(), "menu_category" ) == "at" ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut index 399407694..ac64af37c 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_score.nut @@ -79,6 +79,8 @@ void function AddPlayerScore( entity targetPlayer, string scoreEventName, entity if ( ScoreEvent_HasConversation( event ) ) PlayFactionDialogueToPlayer( event.conversation, targetPlayer ) + + HandleXPGainForScoreEvent( targetPlayer, event ) } void function ScoreEvent_PlayerKilled( entity victim, entity attacker, var damageInfo ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut index f495e5879..8e1002576 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/weapon_xp.gnut @@ -20,7 +20,7 @@ void function AddWeaponXP( entity player, int amount ) 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 ) + if ( !( "manualProscreenControl" in activeWeapon.s && activeWeapon.s.manualProscreenControl ) ) activeWeapon.SetProScreenIntValForIndex( 0, WeaponGetProScreenKills( player, weaponClassname ) ) } } \ No newline at end of file -- cgit v1.2.3