From 0dab0b6545749e156b21a27be7fae76d7813c9b0 Mon Sep 17 00:00:00 2001 From: x3Karma Date: Fri, 27 May 2022 22:13:55 +0800 Subject: [PATCH 1/7] fixed not showing Auto-Titans death in killfeed --- .../vscripts/mp/_base_gametype_mp.gnut | 138 ++++++++++-------- 1 file changed, 79 insertions(+), 59 deletions(-) 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 5d5742c32..1ec8c7355 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -23,18 +23,20 @@ struct { bool killcamsEnabled = true bool playerDeathsHidden = false int titanDamageGameStat = -1 - + entity intermissionCamera - array specCams + array specCams } file void function BaseGametype_Init_MPSP() { AddSpawnCallback( "info_intermission", SetIntermissionCamera ) - + AddPostDamageCallback( "player", AddToTitanDamageStat ) AddPostDamageCallback( "npc_titan", AddToTitanDamageStat ) - + AddCallback_OnNPCKilled( CheckForAutoTitanDeath ) + AddCallback_OnPlayerKilled( CheckForAutoTitanDeath ) + RegisterSignal( "PlayerRespawnStarted" ) RegisterSignal( "KillCamOver" ) } @@ -101,7 +103,7 @@ void function CodeCallback_OnClientConnectionStarted( entity player ) player.s.nextWaveSpawnTime <- 0.0 player.s.meleeSlowMoEndTime <- 0.0 - + player.p.connectTime = Time() Assert( !player._entityVars ) @@ -114,7 +116,7 @@ void function CodeCallback_OnClientConnectionStarted( entity player ) } printl( "Player connect started: " + player + "---UID:" + player.GetUID() ) - + InitPassives( player ) } @@ -131,7 +133,7 @@ void function CodeCallback_OnClientConnectionCompleted( entity player ) InitMeleeAnimEventCallbacks( player ) ZiplineInit( player ) - + UpdateMinimapStatus( player ) UpdateMinimapStatusToOtherPlayers( player ) MinimapPlayerConnected( player ) @@ -207,22 +209,22 @@ void function CodeCallback_OnClientDisconnected( entity player, string reason ) void function CodeCallback_OnPlayerRespawned( entity player ) { SetHumanRagdollImpactTable( player ) - + player.s.respawnCount++ player.s.respawnTime = Time() ClearRecentDamageHistory( player ) - + player.Signal( "OnRespawned" ) // kill any postdeaththreads that could be running - + Loadouts_TryGivePilotLoadout( player ) //player.SetPredictionEnabled( true ) doesn't seem needed, as native code seems to set this - + foreach ( entity weapon in player.GetMainWeapons() ) weapon.SetProScreenOwner( player ) - + foreach ( void functionref( entity ) callback in svGlobal.onPlayerRespawnedCallbacks ) callback( player ) - + Remote_CallFunction_NonReplay( player, "ServerCallback_YouRespawned" ) ClearLastAttacker( player ) // so dying to anything doesn't credit the same attacker after respawning } @@ -257,20 +259,20 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga player.SetNoTarget( false ) player.SetNoTargetSmartAmmo( false ) player.ClearExtraWeaponMods() - + // disable prediction to prevent it messing with ragdoll in some places, as well as killreplay and such player.SetPredictionEnabled( false ) - + if ( player.IsTitan() ) SoulDies( player.GetTitanSoul(), damageInfo ) // cleanup some titan stuff, no idea where else to put this - + ClearRespawnAvailable( player ) OnThreadEnd( function() : ( player ) { if ( !IsValid( player ) ) return - + player.s.inPostDeath = false }) @@ -289,7 +291,7 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga if( attackerInfo.attacker != attacker && !exists ) { alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] <- true - Remote_CallFunction_NonReplay( attackerInfo.attacker, "ServerCallback_SetAssistInformation", attackerInfo.damageSourceId, attacker.GetEncodedEHandle(), player.GetEncodedEHandle(), attackerInfo.time ) + Remote_CallFunction_NonReplay( attackerInfo.attacker, "ServerCallback_SetAssistInformation", attackerInfo.damageSourceId, attacker.GetEncodedEHandle(), player.GetEncodedEHandle(), attackerInfo.time ) AddPlayerScore( attackerInfo.attacker, "PilotAssist" ) attackerInfo.attacker.AddToPlayerGameStat( PGS_ASSISTS, 1 ) } @@ -305,29 +307,29 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga player.Signal( "RodeoOver" ) player.ClearParent() - + // do some pre-replay stuff if we're gonna do a replay float replayLength = CalculateLengthOfKillReplay( player, methodOfDeath ) bool shouldDoReplay = Replay_IsEnabled() && KillcamsEnabled() && IsValid( attacker ) && ShouldDoReplay( player, attacker, replayLength, methodOfDeath ) table replayTracker = { validTime = null } if ( shouldDoReplay ) thread TrackDestroyTimeForReplay( attacker, replayTracker ) - + player.StartObserverMode( OBS_MODE_DEATHCAM ) if ( ShouldSetObserverTarget( attacker ) ) player.SetObserverTarget( attacker ) else player.SetObserverTarget( null ) - + if ( ( GamePlayingOrSuddenDeath() || GetGameState() == eGameState.Epilogue ) && !file.playerDeathsHidden ) player.AddToPlayerGameStat( PGS_DEATHS, 1 ) - + if ( !file.playerDeathsHidden ) Remote_CallFunction_NonReplay( player, "ServerCallback_YouDied", attacker.GetEncodedEHandle(), GetHealthFrac( attacker ), methodOfDeath ) float deathcamLength = GetDeathCamLength( player ) wait deathcamLength - + // use info_intermission camera after deathcam, if it exists if ( file.intermissionCamera != null ) { @@ -340,18 +342,18 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga // hack: double check if killcams are enabled and valid here in case gamestate has changed this shouldDoReplay = shouldDoReplay && Replay_IsEnabled() && KillcamsEnabled() && IsValid( attacker ) // quick note: in cases where player.Die() is called: e.g. for round ends, player == attacker - if ( shouldDoReplay ) - { - player.watchingKillreplayEndTime = Time() + replayLength + if ( shouldDoReplay ) + { + player.watchingKillreplayEndTime = Time() + replayLength float beforeTime = GetKillReplayBeforeTime( player, methodOfDeath ) - - replayTracker.validTime <- null - + + replayTracker.validTime <- null + float respawnTime = Time() - 2 // seems to get the killreplay to end around the actual kill if ( "respawnTime" in attacker.s ) respawnTime = Time() - expect float ( attacker.s.respawnTime ) - - thread PlayerWatchesKillReplayWrapper( player, attacker, respawnTime, timeOfDeath, beforeTime, replayTracker ) + + thread PlayerWatchesKillReplayWrapper( player, attacker, respawnTime, timeOfDeath, beforeTime, replayTracker ) } player.SetPlayerSettings( "spectator" ) // prevent a crash with going from titan => pilot on respawn @@ -361,18 +363,18 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga { // is it a good idea to do respawn code in postdeaththread? fuck if i know lol float respawnDelay = max( 0, GetCurrentPlaylistVarFloat( "respawn_delay", 0.0 ) - deathcamLength ) - + print( "respawn delay " + respawnDelay ) - + UpdateNextRespawnTime( player, Time() + respawnDelay ) SetRespawnAvailable( player ) - + wait respawnDelay - + player.WaitSignal( "RespawnMe" ) // set in base_gametype: ClientCommand_RespawnPlayer - + ClearRespawnAvailable( player ) // need so the respawn icon doesn't show for like a frame on next death - + if ( ( expect bool( player.GetPersistentVar( "spawnAsTitan" ) ) && IsTitanAvailable( player ) ) || ( Riff_SpawnAsTitan() > 0 && Riff_ShouldSpawnAsTitan( player ) ) ) // spawn as titan thread RespawnAsTitan( player ) else // spawn as pilot @@ -382,7 +384,7 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga { if ( shouldDoReplay && player.IsWatchingKillReplay() ) player.WaitSignal( "KillCamOver" ) - + thread PlayerBecomesSpectator( player ) } } @@ -391,14 +393,14 @@ void function PlayerWatchesKillReplayWrapper( entity player, entity attacker, fl { player.EndSignal( "RespawnMe" ) player.EndSignal( "OnRespawned" ) - + player.EndSignal( "OnDestroy" ) attacker.EndSignal( "OnDestroy" ) - + svGlobal.levelEnt.EndSignal( "GameStateChanged" ) - - OnThreadEnd( function() : ( player ) - { + + OnThreadEnd( function() : ( player ) + { // don't clear if we're in a roundwinningkillreplay if ( IsValid( player ) && !( ( GetGameState() == eGameState.SwitchingSides || GetGameState() == eGameState.WinnerDetermined ) && IsRoundWinningKillReplayEnabled() ) ) { @@ -408,7 +410,7 @@ void function PlayerWatchesKillReplayWrapper( entity player, entity attacker, fl //player.SetPredictionEnabled( true ) doesn't seem needed, as native code seems to set this on respawn } }) - + player.SetPredictionEnabled( false ) PlayerWatchesKillReplay( player, attacker.GetEncodedEHandle(), attacker.GetIndexForEntity(), timeSinceAttackerSpawned, timeOfDeath, beforeTime, replayTracker ) } @@ -431,35 +433,35 @@ void function RespawnAsTitan( entity player, bool manualPosition = false ) entity spawnpoint = FindSpawnPoint( player, true, ( ShouldStartSpawn( player ) || Flag( "ForceStartSpawn" ) ) && !IsFFAGame() ) TitanLoadoutDef titanLoadout = GetTitanLoadoutForPlayer( player ) - + asset model = GetPlayerSettingsAssetForClassName( titanLoadout.setFile, "bodymodel" ) Attachment warpAttach = GetAttachmentAtTimeFromModel( model, "at_hotdrop_01", "offset", spawnpoint.GetOrigin(), spawnpoint.GetAngles(), 0 ) PlayFX( TURBO_WARP_FX, warpAttach.position, warpAttach.angle ) - + entity titan = CreateAutoTitanForPlayer_FromTitanLoadout( player, titanLoadout, spawnpoint.GetOrigin(), spawnpoint.GetAngles() ) DispatchSpawn( titan ) player.SetPetTitan( null ) // prevent embark prompt from showing up - + AddCinematicFlag( player, CE_FLAG_CLASSIC_MP_SPAWNING ) // hide hud - + // do titanfall scoreevent AddPlayerScore( player, "Titanfall", player ) - + entity camera = CreateTitanDropCamera( spawnpoint.GetAngles(), < 90, titan.GetAngles().y, 0 > ) camera.SetParent( titan ) - + // calc offset for spawnpoint angle // todo this seems bad but too lazy to figure it out rn //vector xyOffset = RotateAroundOrigin2D( < 44, 0, 0 >, < 0, 0, 0>, spawnpoint.GetAngles().y ) //xyOffset.z = 520 // < 44, 0, 520 > at 0,0,0, seems to be the offset used in tf2 //print( xyOffset ) - + vector xyOffset = RotateAroundOrigin2D( < 44, 0, 520 >, < 0, 0, 0 >, spawnpoint.GetAngles().y ) - + camera.SetLocalOrigin( xyOffset ) camera.SetLocalAngles( < camera.GetAngles().x, spawnpoint.GetAngles().y, camera.GetAngles().z > ) // this straight up just does not work lol camera.Fire( "Enable", "!activator", 0, player ) - + player.EndSignal( "OnDestroy" ) titan.EndSignal( "OnDestroy" ) OnThreadEnd( function() : ( player, titan, camera ) @@ -469,21 +471,21 @@ void function RespawnAsTitan( entity player, bool manualPosition = false ) RemoveCinematicFlag( player, CE_FLAG_CLASSIC_MP_SPAWNING ) // show hud player.isSpawning = false } - + if ( IsValid( titan ) ) titan.Destroy() // pilotbecomestitan leaves an npc titan that we need to delete else RespawnAsPilot( player ) // this is 100% an edgecase, just avoid softlocking if we ever hit it in playable gamestates - + camera.Fire( "Disable", "!activator", 0, player ) camera.Destroy() }) - + waitthread TitanHotDrop( titan, "at_hotdrop_01", spawnpoint.GetOrigin(), spawnpoint.GetAngles(), player, camera ) // do hotdrop anim - + player.RespawnPlayer( null ) // spawn player as pilot so they get their pilot loadout on embark player.SetOrigin( titan.GetOrigin() ) - + // don't make player titan when entity batteryContainer is not valid. // This will prevent a servercrash that sometimes occur when evac is disabled and somebody is calling a titan in the defeat screen. if( IsValid( titan.GetTitanSoul().soul.batteryContainer ) ) @@ -529,9 +531,27 @@ void function AddToTitanDamageStat( entity victim, var damageInfo ) float amount = DamageInfo_GetDamage( damageInfo ) if ( attacker.IsPlayer() && attacker != victim ) - attacker.AddToPlayerGameStat( file.titanDamageGameStat, amount ) // titan damage on + attacker.AddToPlayerGameStat( file.titanDamageGameStat, amount ) // titan damage on } +void function CheckForAutoTitanDeath( entity victim, entity attacker, var damageInfo ) +{ + if( !IsValid(victim) && victim.IsTitan() ) + return + + if( !victim.IsPlayer() ) + { + if (GetPetTitanOwner(victim) && GetPetTitanOwner(victim) != attacker) + foreach(player in GetPlayerArray()) + Remote_CallFunction_NonReplay( player, "ServerCallback_OnTitanKilled", attacker.GetEncodedEHandle(), victim.GetEncodedEHandle(), DamageInfo_GetCustomDamageType( damageInfo ), DamageInfo_GetDamageSourceIdentifier( damageInfo ) ) + } + else + { + if (victim != attacker) + foreach(player in GetPlayerArray()) + Remote_CallFunction_NonReplay( player, "ServerCallback_OnTitanKilled", attacker.GetEncodedEHandle(), victim.GetEncodedEHandle(), DamageInfo_GetCustomDamageType( damageInfo ), DamageInfo_GetDamageSourceIdentifier( damageInfo ) ) + } +} // stuff to change later From 22efab8551190ab9ff3c56adabb5888e47ba8a14 Mon Sep 17 00:00:00 2001 From: x3Karma Date: Fri, 27 May 2022 22:21:53 +0800 Subject: [PATCH 2/7] revert indents --- .../vscripts/mp/_base_gametype_mp.gnut | 106 +++++++++--------- 1 file changed, 53 insertions(+), 53 deletions(-) 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 1ec8c7355..bf3ea3bc8 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -23,15 +23,15 @@ struct { bool killcamsEnabled = true bool playerDeathsHidden = false int titanDamageGameStat = -1 - + entity intermissionCamera - array specCams + array specCams } file void function BaseGametype_Init_MPSP() { AddSpawnCallback( "info_intermission", SetIntermissionCamera ) - + AddPostDamageCallback( "player", AddToTitanDamageStat ) AddPostDamageCallback( "npc_titan", AddToTitanDamageStat ) AddCallback_OnNPCKilled( CheckForAutoTitanDeath ) @@ -103,7 +103,7 @@ void function CodeCallback_OnClientConnectionStarted( entity player ) player.s.nextWaveSpawnTime <- 0.0 player.s.meleeSlowMoEndTime <- 0.0 - + player.p.connectTime = Time() Assert( !player._entityVars ) @@ -116,7 +116,7 @@ void function CodeCallback_OnClientConnectionStarted( entity player ) } printl( "Player connect started: " + player + "---UID:" + player.GetUID() ) - + InitPassives( player ) } @@ -133,7 +133,7 @@ void function CodeCallback_OnClientConnectionCompleted( entity player ) InitMeleeAnimEventCallbacks( player ) ZiplineInit( player ) - + UpdateMinimapStatus( player ) UpdateMinimapStatusToOtherPlayers( player ) MinimapPlayerConnected( player ) @@ -209,19 +209,19 @@ void function CodeCallback_OnClientDisconnected( entity player, string reason ) void function CodeCallback_OnPlayerRespawned( entity player ) { SetHumanRagdollImpactTable( player ) - + player.s.respawnCount++ player.s.respawnTime = Time() ClearRecentDamageHistory( player ) - + player.Signal( "OnRespawned" ) // kill any postdeaththreads that could be running - + Loadouts_TryGivePilotLoadout( player ) //player.SetPredictionEnabled( true ) doesn't seem needed, as native code seems to set this - + foreach ( entity weapon in player.GetMainWeapons() ) weapon.SetProScreenOwner( player ) - + foreach ( void functionref( entity ) callback in svGlobal.onPlayerRespawnedCallbacks ) callback( player ) @@ -259,20 +259,20 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga player.SetNoTarget( false ) player.SetNoTargetSmartAmmo( false ) player.ClearExtraWeaponMods() - + // disable prediction to prevent it messing with ragdoll in some places, as well as killreplay and such player.SetPredictionEnabled( false ) - + if ( player.IsTitan() ) SoulDies( player.GetTitanSoul(), damageInfo ) // cleanup some titan stuff, no idea where else to put this - + ClearRespawnAvailable( player ) OnThreadEnd( function() : ( player ) { if ( !IsValid( player ) ) return - + player.s.inPostDeath = false }) @@ -291,7 +291,7 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga if( attackerInfo.attacker != attacker && !exists ) { alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] <- true - Remote_CallFunction_NonReplay( attackerInfo.attacker, "ServerCallback_SetAssistInformation", attackerInfo.damageSourceId, attacker.GetEncodedEHandle(), player.GetEncodedEHandle(), attackerInfo.time ) + Remote_CallFunction_NonReplay( attackerInfo.attacker, "ServerCallback_SetAssistInformation", attackerInfo.damageSourceId, attacker.GetEncodedEHandle(), player.GetEncodedEHandle(), attackerInfo.time ) AddPlayerScore( attackerInfo.attacker, "PilotAssist" ) attackerInfo.attacker.AddToPlayerGameStat( PGS_ASSISTS, 1 ) } @@ -314,22 +314,22 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga table replayTracker = { validTime = null } if ( shouldDoReplay ) thread TrackDestroyTimeForReplay( attacker, replayTracker ) - + player.StartObserverMode( OBS_MODE_DEATHCAM ) if ( ShouldSetObserverTarget( attacker ) ) player.SetObserverTarget( attacker ) else player.SetObserverTarget( null ) - + if ( ( GamePlayingOrSuddenDeath() || GetGameState() == eGameState.Epilogue ) && !file.playerDeathsHidden ) player.AddToPlayerGameStat( PGS_DEATHS, 1 ) - + if ( !file.playerDeathsHidden ) Remote_CallFunction_NonReplay( player, "ServerCallback_YouDied", attacker.GetEncodedEHandle(), GetHealthFrac( attacker ), methodOfDeath ) float deathcamLength = GetDeathCamLength( player ) wait deathcamLength - + // use info_intermission camera after deathcam, if it exists if ( file.intermissionCamera != null ) { @@ -342,18 +342,18 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga // hack: double check if killcams are enabled and valid here in case gamestate has changed this shouldDoReplay = shouldDoReplay && Replay_IsEnabled() && KillcamsEnabled() && IsValid( attacker ) // quick note: in cases where player.Die() is called: e.g. for round ends, player == attacker - if ( shouldDoReplay ) - { - player.watchingKillreplayEndTime = Time() + replayLength + if ( shouldDoReplay ) + { + player.watchingKillreplayEndTime = Time() + replayLength float beforeTime = GetKillReplayBeforeTime( player, methodOfDeath ) - - replayTracker.validTime <- null - + + replayTracker.validTime <- null + float respawnTime = Time() - 2 // seems to get the killreplay to end around the actual kill if ( "respawnTime" in attacker.s ) respawnTime = Time() - expect float ( attacker.s.respawnTime ) - - thread PlayerWatchesKillReplayWrapper( player, attacker, respawnTime, timeOfDeath, beforeTime, replayTracker ) + + thread PlayerWatchesKillReplayWrapper( player, attacker, respawnTime, timeOfDeath, beforeTime, replayTracker ) } player.SetPlayerSettings( "spectator" ) // prevent a crash with going from titan => pilot on respawn @@ -363,18 +363,18 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga { // is it a good idea to do respawn code in postdeaththread? fuck if i know lol float respawnDelay = max( 0, GetCurrentPlaylistVarFloat( "respawn_delay", 0.0 ) - deathcamLength ) - + print( "respawn delay " + respawnDelay ) - + UpdateNextRespawnTime( player, Time() + respawnDelay ) SetRespawnAvailable( player ) - + wait respawnDelay - + player.WaitSignal( "RespawnMe" ) // set in base_gametype: ClientCommand_RespawnPlayer - + ClearRespawnAvailable( player ) // need so the respawn icon doesn't show for like a frame on next death - + if ( ( expect bool( player.GetPersistentVar( "spawnAsTitan" ) ) && IsTitanAvailable( player ) ) || ( Riff_SpawnAsTitan() > 0 && Riff_ShouldSpawnAsTitan( player ) ) ) // spawn as titan thread RespawnAsTitan( player ) else // spawn as pilot @@ -384,7 +384,7 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga { if ( shouldDoReplay && player.IsWatchingKillReplay() ) player.WaitSignal( "KillCamOver" ) - + thread PlayerBecomesSpectator( player ) } } @@ -393,14 +393,14 @@ void function PlayerWatchesKillReplayWrapper( entity player, entity attacker, fl { player.EndSignal( "RespawnMe" ) player.EndSignal( "OnRespawned" ) - + player.EndSignal( "OnDestroy" ) attacker.EndSignal( "OnDestroy" ) - + svGlobal.levelEnt.EndSignal( "GameStateChanged" ) - - OnThreadEnd( function() : ( player ) - { + + OnThreadEnd( function() : ( player ) + { // don't clear if we're in a roundwinningkillreplay if ( IsValid( player ) && !( ( GetGameState() == eGameState.SwitchingSides || GetGameState() == eGameState.WinnerDetermined ) && IsRoundWinningKillReplayEnabled() ) ) { @@ -410,7 +410,7 @@ void function PlayerWatchesKillReplayWrapper( entity player, entity attacker, fl //player.SetPredictionEnabled( true ) doesn't seem needed, as native code seems to set this on respawn } }) - + player.SetPredictionEnabled( false ) PlayerWatchesKillReplay( player, attacker.GetEncodedEHandle(), attacker.GetIndexForEntity(), timeSinceAttackerSpawned, timeOfDeath, beforeTime, replayTracker ) } @@ -433,20 +433,20 @@ void function RespawnAsTitan( entity player, bool manualPosition = false ) entity spawnpoint = FindSpawnPoint( player, true, ( ShouldStartSpawn( player ) || Flag( "ForceStartSpawn" ) ) && !IsFFAGame() ) TitanLoadoutDef titanLoadout = GetTitanLoadoutForPlayer( player ) - + asset model = GetPlayerSettingsAssetForClassName( titanLoadout.setFile, "bodymodel" ) Attachment warpAttach = GetAttachmentAtTimeFromModel( model, "at_hotdrop_01", "offset", spawnpoint.GetOrigin(), spawnpoint.GetAngles(), 0 ) PlayFX( TURBO_WARP_FX, warpAttach.position, warpAttach.angle ) - + entity titan = CreateAutoTitanForPlayer_FromTitanLoadout( player, titanLoadout, spawnpoint.GetOrigin(), spawnpoint.GetAngles() ) DispatchSpawn( titan ) player.SetPetTitan( null ) // prevent embark prompt from showing up - + AddCinematicFlag( player, CE_FLAG_CLASSIC_MP_SPAWNING ) // hide hud - + // do titanfall scoreevent AddPlayerScore( player, "Titanfall", player ) - + entity camera = CreateTitanDropCamera( spawnpoint.GetAngles(), < 90, titan.GetAngles().y, 0 > ) camera.SetParent( titan ) @@ -457,11 +457,11 @@ void function RespawnAsTitan( entity player, bool manualPosition = false ) //print( xyOffset ) vector xyOffset = RotateAroundOrigin2D( < 44, 0, 520 >, < 0, 0, 0 >, spawnpoint.GetAngles().y ) - + camera.SetLocalOrigin( xyOffset ) camera.SetLocalAngles( < camera.GetAngles().x, spawnpoint.GetAngles().y, camera.GetAngles().z > ) // this straight up just does not work lol camera.Fire( "Enable", "!activator", 0, player ) - + player.EndSignal( "OnDestroy" ) titan.EndSignal( "OnDestroy" ) OnThreadEnd( function() : ( player, titan, camera ) @@ -471,21 +471,21 @@ void function RespawnAsTitan( entity player, bool manualPosition = false ) RemoveCinematicFlag( player, CE_FLAG_CLASSIC_MP_SPAWNING ) // show hud player.isSpawning = false } - + if ( IsValid( titan ) ) titan.Destroy() // pilotbecomestitan leaves an npc titan that we need to delete else RespawnAsPilot( player ) // this is 100% an edgecase, just avoid softlocking if we ever hit it in playable gamestates - + camera.Fire( "Disable", "!activator", 0, player ) camera.Destroy() }) - + waitthread TitanHotDrop( titan, "at_hotdrop_01", spawnpoint.GetOrigin(), spawnpoint.GetAngles(), player, camera ) // do hotdrop anim player.RespawnPlayer( null ) // spawn player as pilot so they get their pilot loadout on embark player.SetOrigin( titan.GetOrigin() ) - + // don't make player titan when entity batteryContainer is not valid. // This will prevent a servercrash that sometimes occur when evac is disabled and somebody is calling a titan in the defeat screen. if( IsValid( titan.GetTitanSoul().soul.batteryContainer ) ) @@ -531,7 +531,7 @@ void function AddToTitanDamageStat( entity victim, var damageInfo ) float amount = DamageInfo_GetDamage( damageInfo ) if ( attacker.IsPlayer() && attacker != victim ) - attacker.AddToPlayerGameStat( file.titanDamageGameStat, amount ) // titan damage on + attacker.AddToPlayerGameStat( file.titanDamageGameStat, amount ) // titan damage on } void function CheckForAutoTitanDeath( entity victim, entity attacker, var damageInfo ) From 64ba6f9dec1c32bb146ed4b4ed3666f92c989718 Mon Sep 17 00:00:00 2001 From: x3Karma Date: Fri, 27 May 2022 22:23:17 +0800 Subject: [PATCH 3/7] revert indents again --- .../mod/scripts/vscripts/mp/_base_gametype_mp.gnut | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 bf3ea3bc8..a60bdc126 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -34,9 +34,9 @@ void function BaseGametype_Init_MPSP() AddPostDamageCallback( "player", AddToTitanDamageStat ) AddPostDamageCallback( "npc_titan", AddToTitanDamageStat ) + AddCallback_OnNPCKilled( CheckForAutoTitanDeath ) AddCallback_OnPlayerKilled( CheckForAutoTitanDeath ) - RegisterSignal( "PlayerRespawnStarted" ) RegisterSignal( "KillCamOver" ) } @@ -221,10 +221,10 @@ void function CodeCallback_OnPlayerRespawned( entity player ) foreach ( entity weapon in player.GetMainWeapons() ) weapon.SetProScreenOwner( player ) - + foreach ( void functionref( entity ) callback in svGlobal.onPlayerRespawnedCallbacks ) callback( player ) - + Remote_CallFunction_NonReplay( player, "ServerCallback_YouRespawned" ) ClearLastAttacker( player ) // so dying to anything doesn't credit the same attacker after respawning } @@ -307,7 +307,7 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga player.Signal( "RodeoOver" ) player.ClearParent() - + // do some pre-replay stuff if we're gonna do a replay float replayLength = CalculateLengthOfKillReplay( player, methodOfDeath ) bool shouldDoReplay = Replay_IsEnabled() && KillcamsEnabled() && IsValid( attacker ) && ShouldDoReplay( player, attacker, replayLength, methodOfDeath ) @@ -449,13 +449,13 @@ void function RespawnAsTitan( entity player, bool manualPosition = false ) entity camera = CreateTitanDropCamera( spawnpoint.GetAngles(), < 90, titan.GetAngles().y, 0 > ) camera.SetParent( titan ) - + // calc offset for spawnpoint angle // todo this seems bad but too lazy to figure it out rn //vector xyOffset = RotateAroundOrigin2D( < 44, 0, 0 >, < 0, 0, 0>, spawnpoint.GetAngles().y ) //xyOffset.z = 520 // < 44, 0, 520 > at 0,0,0, seems to be the offset used in tf2 //print( xyOffset ) - + vector xyOffset = RotateAroundOrigin2D( < 44, 0, 520 >, < 0, 0, 0 >, spawnpoint.GetAngles().y ) camera.SetLocalOrigin( xyOffset ) @@ -482,7 +482,7 @@ void function RespawnAsTitan( entity player, bool manualPosition = false ) }) waitthread TitanHotDrop( titan, "at_hotdrop_01", spawnpoint.GetOrigin(), spawnpoint.GetAngles(), player, camera ) // do hotdrop anim - + player.RespawnPlayer( null ) // spawn player as pilot so they get their pilot loadout on embark player.SetOrigin( titan.GetOrigin() ) From 48f1a3db0c9aacf1e18b6f833346e46cfa48d18a Mon Sep 17 00:00:00 2001 From: x3Karma Date: Sat, 28 May 2022 18:52:54 +0800 Subject: [PATCH 4/7] bug fix --- .../mod/scripts/vscripts/mp/_base_gametype_mp.gnut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a60bdc126..642459770 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -536,7 +536,7 @@ void function AddToTitanDamageStat( entity victim, var damageInfo ) void function CheckForAutoTitanDeath( entity victim, entity attacker, var damageInfo ) { - if( !IsValid(victim) && victim.IsTitan() ) + if( !IsValid(victim) || !victim.IsTitan() ) return if( !victim.IsPlayer() ) From 283f4d35569d58593d89adc00dacd78ef9286567 Mon Sep 17 00:00:00 2001 From: x3Karma Date: Mon, 11 Jul 2022 02:37:23 +0800 Subject: [PATCH 5/7] Hardpoint Fixes --- .../scripts/vscripts/gamemodes/_gamemode_cp.nut | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut index 705b7836f..c81bfb229 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut @@ -471,8 +471,10 @@ void function HardpointThink( HardpointStruct hardpoint ) } else if(cappingTeam==TEAM_UNASSIGNED) // nobody on point { - if((GetHardpointState(hardpoint)==CAPTURE_POINT_STATE_AMPED)||(GetHardpointState(hardpoint)==CAPTURE_POINT_STATE_AMPING)) + if((GetHardpointState(hardpoint)>=CAPTURE_POINT_STATE_AMPED) || (GetHardpointState(hardpoint)==CAPTURE_POINT_STATE_SELF_UNAMPING)) { + if (GetHardpointState(hardpoint) == CAPTURE_POINT_STATE_AMPED) + SetHardpointState(hardpoint,CAPTURE_POINT_STATE_SELF_UNAMPING) // plays a pulsating effect on the UI only when the hardpoint is amped SetHardpointCappingTeam(hardpoint,hardpointEnt.GetTeam()) SetHardpointCaptureProgress(hardpoint,max(1.0,GetHardpointCaptureProgress(hardpoint)-(deltaTime/HARDPOINT_AMPED_DELAY))) if(GetHardpointCaptureProgress(hardpoint)<=1.001) // unamp @@ -546,8 +548,10 @@ void function HardpointThink( HardpointStruct hardpoint ) } else if(file.ampingEnabled)//amping or reamping { - if(GetHardpointState(hardpoint) Date: Fri, 10 Mar 2023 07:24:52 +0800 Subject: [PATCH 6/7] "fixed" spacing for like one line the rest of the file is kinda oof tho but not related to my pr --- .../mod/scripts/vscripts/gamemodes/_gamemode_cp.nut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut index c81bfb229..c833dec84 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut @@ -551,7 +551,7 @@ void function HardpointThink( HardpointStruct hardpoint ) // i have no idea why but putting it CAPTURE_POINT_STATE_AMPING will say 'CONTESTED' on the UI // since whether the point is contested is checked above, putting the hardpoint state to a value of 8 fixes it somehow if(GetHardpointState(hardpoint)<=CAPTURE_POINT_STATE_AMPING) - SetHardpointState(hardpoint, 8 ) + SetHardpointState( hardpoint, 8 ) SetHardpointCaptureProgress( hardpoint, min( 2.0, GetHardpointCaptureProgress( hardpoint ) + ( deltaTime / HARDPOINT_AMPED_DELAY * capperAmount ) ) ) if(GetHardpointCaptureProgress(hardpoint)==2.0&&!(GetHardpointState(hardpoint)==CAPTURE_POINT_STATE_AMPED)) { From bc52f386dfaa1a2f4a6ac276e1f02bf053faf451 Mon Sep 17 00:00:00 2001 From: x3Karma Date: Fri, 10 Mar 2023 07:28:03 +0800 Subject: [PATCH 7/7] 69 spacing --- .../mod/scripts/vscripts/gamemodes/_gamemode_cp.nut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut index c833dec84..1bc42de0e 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut @@ -669,7 +669,7 @@ void function OnHardpointLeft( entity trigger, entity player ) if(playerStruct.player == player) playerStruct.isOnHardpoint = false - player.SetPlayerNetInt( "playerHardpointID", 69) // an arbitary number to remove the hud from the player + player.SetPlayerNetInt( "playerHardpointID", 69 ) // an arbitary number to remove the hud from the player } string function CaptureStateToString( int state )