From 0dab0b6545749e156b21a27be7fae76d7813c9b0 Mon Sep 17 00:00:00 2001 From: x3Karma Date: Fri, 27 May 2022 22:13:55 +0800 Subject: [PATCH 1/9] 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/9] 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/9] 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/9] 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 96181596fb39b45ee347617014ed5ed4354cf1a8 Mon Sep 17 00:00:00 2001 From: x3Karma Date: Sun, 31 Jul 2022 04:51:22 +0800 Subject: [PATCH 5/9] Teabag Confirmed --- .../northstar_client_localisation_english.txt | 12 + Northstar.Custom/keyvalues/playlists_v2.txt | 64 +++ Northstar.Custom/mod.json | 19 + .../vscripts/gamemodes/_gamemode_tbag.nut | 397 ++++++++++++++++++ .../vscripts/gamemodes/cl_gamemode_tbag.nut | 73 ++++ .../vscripts/gamemodes/sh_gamemode_tbag.nut | 52 +++ 6 files changed, 617 insertions(+) create mode 100644 Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut create mode 100644 Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_tbag.nut create mode 100644 Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_tbag.nut diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt index 8c6cadcff..2ba969782 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt @@ -164,6 +164,18 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a "PL_tffa_abbr" "TFFA" "GAMEMODE_TFFA" "Titan Free for All" + "PL_tbag" "Teabag Confirmed" + "PL_tbag_lobby" "Teabag Confirmed Lobby" + "PL_tbag_desc" "Killing enemy pilots drops a battery. Teabag it to score a point" + "PL_tbag_abbr" "TBAG" + "floatingduration" "Battery Duration" + "teabagcounter" "Teabag Counts" + "GAMEMODE_TBAG" "Teabag Confirmed" + "SCOREBOARD_GAVETEABAG" "Teabags Given" + "SCOREBOARD_DENYTEABAG" "Teabags Denied" + "TBAG_TEABAG_CONFIRMED" "Teabags Confirmed" + "TBAG_TEABAG_DENIED" "Teabags Denied" + "PL_hs" "Hide and Seek" "PL_hs_lobby" "Hide and Seek Lobby" "PL_hs_desc" "Hiders hide, seekers try to find them." diff --git a/Northstar.Custom/keyvalues/playlists_v2.txt b/Northstar.Custom/keyvalues/playlists_v2.txt index a47cc07e4..6d7e06132 100644 --- a/Northstar.Custom/keyvalues/playlists_v2.txt +++ b/Northstar.Custom/keyvalues/playlists_v2.txt @@ -258,6 +258,23 @@ playlists gamemode_score_hint #GAMEMODE_SCORE_HINT_TDM } } + tbag + { + inherit defaults + vars + { + name #PL_tbag + lobbytitle #PL_tbag_lobby + description #PL_tbag_desc + hint #PL_tbag_hint + abbreviation #PL_tbag_abbr + max_players 12 + max_teams 2 + classic_mp 1 + + gamemode_score_hint #GAMEMODE_SCORE_HINT_TDM + } + } sns { inherit defaults @@ -856,6 +873,53 @@ playlists } } } + tbag + { + inherit defaults + vars + { + name #PL_tbag + lobbytitle #PL_tbag_lobby + description #PL_tbag_desc + abbreviation #PL_tbag_abbr + image ps + //mixtape_slot 7 + mixtape_timeout 120 + visible 0 + } + gamemodes + { + tbag + { + maps + { + mp_forwardbase_kodai 1 + mp_grave 1 + mp_homestead 1 + mp_thaw 1 + mp_black_water_canal 1 + mp_eden 1 + mp_drydock 1 + mp_crashsite3 1 + mp_complex3 1 + mp_angel_city 1 + mp_colony02 1 + mp_glitch 1 + mp_lf_stacks 1 + mp_lf_deck 1 + mp_lf_meadow 1 + mp_lf_traffic 1 + mp_lf_township 1 + mp_lf_uma 1 + mp_relic02 1 + mp_wargames 1 + mp_rise 1 + mp_coliseum 1 + mp_coliseum_column 1 + } + } + } + } sns { inherit defaults diff --git a/Northstar.Custom/mod.json b/Northstar.Custom/mod.json index 28825a585..25a7b4e9d 100644 --- a/Northstar.Custom/mod.json +++ b/Northstar.Custom/mod.json @@ -303,6 +303,25 @@ "Path": "gamemodes/cl_gamemode_tffa.gnut", "RunOn": "CLIENT && MP" }, + { + "Path": "gamemodes/sh_gamemode_tbag.nut", + "RunOn": "( CLIENT || SERVER ) && MP", + "ClientCallback": { + "Before": "Sh_GamemodeTbag_Init" + }, + + "ServerCallback": { + "Before": "Sh_GamemodeTbag_Init" + } + }, + { + "Path": "gamemodes/_gamemode_tbag.nut", + "RunOn": "SERVER && MP" + }, + { + "Path": "gamemodes/cl_gamemode_tbag.nut", + "RunOn": "CLIENT && MP" + }, { "Path": "sh_3psequence_to_1p_hacks.gnut", "RunOn": "( CLIENT || SERVER ) && MP", diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut new file mode 100644 index 000000000..12f0a82d5 --- /dev/null +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut @@ -0,0 +1,397 @@ +global function GamemodeTbag_Init +global function CreateBattery + +struct { + table players // needed for detecting if tbag grace period exceeded 3 seconds + table > trigger // needed for detecting individual batteries + table tbag // needed for detecting tbag counter + int floatingDuration // how long it takes for the battery to disappear + int teabagCounter // how many times do you need to teabag +} file + + +void function GamemodeTbag_Init() +{ + SetShouldUseRoundWinningKillReplay( true ) + Riff_ForceTitanAvailability( eTitanAvailability.Never ) + ClassicMP_ForceDisableEpilogue( true ) + + AddCallback_OnClientConnected( TbagInitPlayer ) + AddCallback_OnPlayerKilled( TbagOnPlayerKilled ) + AddCallback_OnClientDisconnected( TbagCleanupClient ) + AddCallback_GameStateEnter( eGameState.WinnerDetermined, OnWinnerDetermined ) + + SetTimeoutWinnerDecisionFunc( CheckScoreForDraw ) + + file.floatingDuration = GetCurrentPlaylistVarInt( "floatingduration", 30 ) + file.teabagCounter = GetCurrentPlaylistVarInt( "teabagcounter", 4 ) + + AddClientCommandCallback("Tbag_down", Crouching ); + AddClientCommandCallback("Tbag_downtoggle", ToggleCrouching ); // toggle crouch requires x2 the input for whatever reason +} + +void function TbagInitPlayer( entity player ) +{ + file.players[player] <- Time() // start beginning countdown + file.tbag[player] <- 0 // newslot this so the tbag counter starts at 0 +} + +void function TbagCleanupClient( entity player ) +{ + // remove all saved tables of this player when they disconnect. + if (player in file.players) + delete file.players[player] + + if (player in file.trigger) + delete file.trigger[player] + + if (player in file.tbag) + delete file.tbag[player] +} + +void function TbagOnPlayerKilled( entity victim, entity attacker, var damageInfo ) +{ + if ( !victim.IsPlayer() || GetGameState() != eGameState.Playing || attacker == victim) + return + + if ( attacker.IsPlayer() ) + { + CreateBattery(victim) + SetRoundWinningKillReplayAttacker(attacker) + } +} + +void function OnWinnerDetermined() +{ + SetRespawnsEnabled( false ) + SetKillcamsEnabled( false ) +} + +int function CheckScoreForDraw() +{ + if (GameRules_GetTeamScore(TEAM_IMC) > GameRules_GetTeamScore(TEAM_MILITIA)) + return TEAM_IMC + else if (GameRules_GetTeamScore(TEAM_MILITIA) > GameRules_GetTeamScore(TEAM_IMC)) + return TEAM_MILITIA + + return TEAM_UNASSIGNED +} + +// ======================================================================================================== +// +// BATTERY STUFF +// +// ======================================================================================================== + +void function CreateBattery(entity player) +{ + entity batteryPack = CreateEntity( "prop_dynamic" ) + batteryPack.SetValueForModelKey( RODEO_BATTERY_MODEL ) // ideally I would want the Helmet collectible from the campaign :/ + batteryPack.kv.fadedist = 10000 + + // trace origins to the floor so it spawns on the floor instead of being midair + array ignoreArray = [] // no idea what this array requires + TraceResults downTrace = TraceLine( player.EyePosition(), player.GetOrigin() + <0.0, 0.0, -1000.0>, ignoreArray, TRACE_MASK_SHOT, TRACE_COLLISION_GROUP_BLOCK_WEAPONS ) + + batteryPack.SetOrigin( downTrace.endPos ) + + entity flyer = CreateEntity( "script_mover" ) + flyer.kv.SpawnAsPhysicsMover = false + flyer.SetValueForModelKey( $"models/dev/empty_model.mdl" ) + flyer.SetOrigin( batteryPack.GetOrigin() ) + flyer.kv.solid = SOLID_HITBOXES + flyer.kv.DisableBoneFollowers = 1 + flyer.kv.fadedist = 10000 + batteryPack.SetParent(flyer) + DispatchSpawn( flyer ) + + DispatchSpawn( batteryPack ) + batteryPack.SetModel( RODEO_BATTERY_MODEL ) + Battery_StartFX( batteryPack ) + Highlight_SetFriendlyHighlight( batteryPack, "sp_friendly_pilot" ) + Highlight_SetNeutralHighlight( batteryPack, "enemy_player" ) + Highlight_SetEnemyHighlight( batteryPack, "enemy_player" ) + batteryPack.SetVelocity( < 0, 0, 1 > ) + + SetTeam( batteryPack, player.GetTeam() ) + + thread StartAnimating( flyer ) + thread CreateBatteryTrigger( batteryPack ) + thread DestroyBattery( flyer, file.floatingDuration ) +} + +void function DestroyBattery(entity batteryPack, int duration) +{ + batteryPack.EndSignal( "OnDestroy" ) + OnThreadEnd( + function () : ( batteryPack ) + { + if ( IsValid( batteryPack ) ) + { + batteryPack.Destroy() + } + } + ) + int lastDuration = (duration - (duration - 5) ) + wait duration - 5 + thread FlickeringOnTimeout(batteryPack) + wait lastDuration +} + +void function FlickeringOnTimeout(entity bruh) +{ + while (IsValid(bruh)) + { + try + { + wait 0.2 + bruh.kv.VisibilityFlags = ENTITY_VISIBLE_TO_EVERYONE + wait 0.2 + bruh.kv.VisibilityFlags = 0 + } catch (why) + {} + WaitFrame() + } +} + +void function CreateBatteryTrigger(entity batteryPack) +{ + entity trigger = CreateEntity( "trigger_cylinder" ) + trigger.SetRadius( 100 ) + trigger.SetAboveHeight( 100 ) + trigger.SetBelowHeight( 100 ) + trigger.SetOrigin( batteryPack.GetOrigin() ) + trigger.SetParent( batteryPack ) + trigger.kv.triggerFilterNpc = "none" + DispatchSpawn( trigger ) + SetTeam(trigger, batteryPack.GetTeam()) + trigger.SetEnterCallback( BatteryTrigger_Enter ) + trigger.SetLeaveCallback( BatteryTrigger_Leave ) +} + +void function BatteryTrigger_Enter( entity trigger, entity player ) +{ + if ( trigger != null && IsValid(player) && player.IsPlayer()) + { + if (! (player in file.trigger)) + { + file.trigger[player] <- [] // create a new fucking array if there hasn't been one before + file.trigger[player].append(trigger) + } else { + file.trigger[player].append(trigger) // since there's already an array, append this entity trigger to it. + } + } +} + +void function BatteryTrigger_Leave( entity trigger, entity player ) +{ + if ( trigger != null ) + { + if (player in file.trigger) + { + foreach( triggerbaby in file.trigger[player] ) + { + if (file.trigger[player].find(trigger) != -1) + file.trigger[player].remove( file.trigger[player].find(trigger) ) + } + } + } +} + +bool function Crouching(entity player, array args) +{ + if (! (player in file.players) ) + return true; + + if (! (player in file.trigger) ) + return true; + + if (Time() - file.players[player] > 3.0) // if they exceeded the grace period, demolish their counter + { + file.tbag[player] = 0 + file.players[player] = Time() + } + + if (Time() - file.players[player] <= 3.0) // oh hey they do be tbaging, add one to the counter + { + int i = file.tbag[player] + i++ + file.tbag[player] = i + file.players[player] = Time() + } + + if (file.tbag[player] >= file.teabagCounter) // they tbag alot, so time to do stuff + { + foreach (triggerbaby in file.trigger[player]) + { + if (triggerbaby.GetTeam() != player.GetTeam()) + { + AddTeamScore( player.GetTeam(), 1) // add score if tbag'd an enemy's corpse + entity batteryPack = triggerbaby.GetParent() + entity mover = batteryPack.GetParent() + if ( IsValid( mover ) ) + { + ClearChildren( batteryPack ) + mover.Destroy() + } + if (IsValid (triggerbaby) ) + { + file.trigger[player].remove( file.trigger[player].find(triggerbaby) ) + triggerbaby.Destroy() + } + Remote_CallFunction_NonReplay( player, "ServerCallback_TeabagConfirmed" ) + player.AddToPlayerGameStat( PGS_TITAN_KILLS, 1 ) + } else // remove it to deny enemy from tbagging + { + entity batteryPack = triggerbaby.GetParent() + entity mover = batteryPack.GetParent() + if ( IsValid( mover ) ) + { + ClearChildren( batteryPack ) + mover.Destroy() + } + if (IsValid (triggerbaby) ) + { + file.trigger[player].remove( file.trigger[player].find(triggerbaby) ) + triggerbaby.Destroy() + } + Remote_CallFunction_NonReplay( player, "ServerCallback_TeabagDenied" ) + player.AddToPlayerGameStat( PGS_DEFENSE_SCORE, 1 ) + } + } + } + return true; +} + +bool function ToggleCrouching(entity player, array args) +{ + if (! (player in file.players) ) + return true; + + if (! (player in file.trigger) ) + return true; + + if (Time() - file.players[player] > 3.0) + { + file.tbag[player] = 0 + file.players[player] = Time() + } + + if (Time() - file.players[player] <= 3.0) + { + int i = file.tbag[player] + i++ + file.tbag[player] = i + file.players[player] = Time() + } + + if (file.tbag[player] >= (file.teabagCounter * 2)) + { + foreach (triggerbaby in file.trigger[player]) + { + if (triggerbaby.GetTeam() != player.GetTeam()) + { + AddTeamScore( player.GetTeam(), 1) + entity batteryPack = triggerbaby.GetParent() + entity mover = batteryPack.GetParent() + if ( IsValid( mover ) ) + { + ClearChildren( batteryPack ) + mover.Destroy() + } + if (IsValid (triggerbaby) ) + { + file.trigger[player].remove( file.trigger[player].find(triggerbaby) ) + triggerbaby.Destroy() + } + Remote_CallFunction_NonReplay( player, "ServerCallback_TeabagConfirmed" ) + player.AddToPlayerGameStat( PGS_TITAN_KILLS, 1 ) + } else + { + entity batteryPack = triggerbaby.GetParent() + entity mover = batteryPack.GetParent() + if ( IsValid( mover ) ) + { + ClearChildren( batteryPack ) + mover.Destroy() + } + if (IsValid (triggerbaby) ) + { + file.trigger[player].remove( file.trigger[player].find(triggerbaby) ) + triggerbaby.Destroy() + } + Remote_CallFunction_NonReplay( player, "ServerCallback_TeabagDenied" ) + player.AddToPlayerGameStat( PGS_DEFENSE_SCORE, 1 ) + } + } + } + return true; +} + +// ======================================================================================================== +// floating batteries that spins +// many thanks @Pebbers lol - karma +// ======================================================================================================== + +const float CYCLES = 3.0 +const float RADIUS = 3.0 +const float ANGLES = 45.0 + +void function StartAnimating(entity toAnimate) { + vector originalOrigin = toAnimate.GetOrigin() + vector originalAngles = toAnimate.GetAngles() + + // this will go -RADIUS -> RADIUS + // Ratio is abs(zOffset) / RADIUS + float zOffset = 0.0 + float posOffset = 0.0 + float angleOffset = 0.0 + float currTime = Time() + + while ( IsValid(toAnimate) ) + { + // delta time since last frame so it isnt frame dependant lmao + float delta = (Time() - currTime) // s since last frame + float step = CYCLES * delta + float ratio = fAbs(zOffset) / RADIUS + float smooth = sineEasing(ratio) // how much it'll increment every second + float angleStep = ANGLES * delta + + zOffset += step + angleOffset += angleStep + angleOffset = angleOffset % 360 + currTime = Time() + posOffset = smooth * 2 + try + { + //toAnimate.SetOrigin(originalOrigin + <0,0,posOffset>) + // toAnimate.SetAngles(originalAngles + <0,angleOffset,0>) + toAnimate.NonPhysicsMoveTo( originalOrigin + <0,0,posOffset> , 0.5, 0.1, 0.1 ) + toAnimate.NonPhysicsRotateTo( originalAngles + <0,angleOffset,0> , 0.5, 0.1, 0.1 ) + } catch (ex) + { + print(ex) + } + + WaitFrame() + } +} +// Eases in via sine function from -1 to 1 +// makes it look smooth +// math turned out to be useful wow +float function sineEasing(float x) { + return (-(2 * (cos(PI * x) - 1) / 2)) - 1.0 +} + + +//abs of a float +float function fAbs(float x) { + float res = 0.0; + if (x < 0) { + res = -x + } else { + res = x; + } + return res +} + diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_tbag.nut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_tbag.nut new file mode 100644 index 000000000..cd4e7af3f --- /dev/null +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_tbag.nut @@ -0,0 +1,73 @@ +global function ClGamemodeTbag_Init +global function ServerCallback_TeabagConfirmed +global function ServerCallback_TeabagDenied + +void function ClGamemodeTbag_Init() +{ + // add ffa gamestate asset + // ClGameState_RegisterGameStateAsset( $"ui/gamestate_info_ffa.rpak" ) + + // add music for mode, this is copied directly from the ffa/fra music registered in cl_music.gnut + RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_INTRO, "music_mp_freeagents_intro", TEAM_IMC ) + RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_INTRO, "music_mp_freeagents_intro", TEAM_MILITIA ) + + RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_WIN, "music_mp_freeagents_outro_win", TEAM_IMC ) + RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_WIN, "music_mp_freeagents_outro_win", TEAM_MILITIA ) + + RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_DRAW, "music_mp_freeagents_outro_lose", TEAM_IMC ) + RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_DRAW, "music_mp_freeagents_outro_lose", TEAM_MILITIA ) + + RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_LOSS, "music_mp_freeagents_outro_lose", TEAM_IMC ) + RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_LOSS, "music_mp_freeagents_outro_lose", TEAM_MILITIA ) + + RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_THREE_MINUTE, "music_mp_freeagents_almostdone", TEAM_IMC ) + RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_THREE_MINUTE, "music_mp_freeagents_almostdone", TEAM_MILITIA ) + + RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_LAST_MINUTE, "music_mp_freeagents_lastminute", TEAM_IMC ) + RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_LAST_MINUTE, "music_mp_freeagents_lastminute", TEAM_MILITIA ) + + #if CLIENT + RegisterConCommandTriggeredCallback( "+duck", PlayerPressed_down ) + RegisterConCommandTriggeredCallback( "+toggle_duck", PlayerPressed_downtoggle ) + #endif +} + +void function ServerCallback_TeabagConfirmed() +{ + // heavily based on mfd code + entity localPlayer = GetLocalViewPlayer() + + AnnouncementData announcement = Announcement_Create( "#TBAG_TEABAG_CONFIRMED" ) + Announcement_SetTitleColor( announcement, <1,0,0> ) + Announcement_SetPurge( announcement, true ) + Announcement_SetPriority( announcement, 200 ) //Be higher priority than Titanfall ready indicator etc + Announcement_SetSoundAlias( announcement, SFX_HUD_ANNOUNCE_QUICK ) + Announcement_SetStyle( announcement, ANNOUNCEMENT_STYLE_QUICK ) + AnnouncementFromClass( localPlayer, announcement ) +} + +void function ServerCallback_TeabagDenied() +{ + // heavily based on mfd code + entity localPlayer = GetLocalViewPlayer() + + AnnouncementData announcement = Announcement_Create( "#TBAG_TEABAG_DENIED" ) + Announcement_SetTitleColor( announcement, <1,0,0> ) + Announcement_SetPurge( announcement, true ) + Announcement_SetPriority( announcement, 200 ) //Be higher priority than Titanfall ready indicator etc + Announcement_SetSoundAlias( announcement, SFX_HUD_ANNOUNCE_QUICK ) + Announcement_SetStyle( announcement, ANNOUNCEMENT_STYLE_QUICK ) + AnnouncementFromClass( localPlayer, announcement ) +} + +#if CLIENT +void function PlayerPressed_down( entity player ) +{ + player.ClientCommand( "Tbag_down" ) +} + +void function PlayerPressed_downtoggle( entity player ) +{ + player.ClientCommand( "Tbag_downtoggle" ) +} +#endif \ No newline at end of file diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_tbag.nut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_tbag.nut new file mode 100644 index 000000000..854d6f70c --- /dev/null +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_tbag.nut @@ -0,0 +1,52 @@ +global function Sh_GamemodeTbag_Init + +global const string GAMEMODE_TBAG = "tbag" + +void function Sh_GamemodeTbag_Init() +{ + // create custom gamemode + AddCallback_OnCustomGamemodesInit( CreateGamemodeTbag ) + AddCallback_OnRegisteringCustomNetworkVars( TbagRegisterNetworkVars ) +} + +void function CreateGamemodeTbag() +{ + GameMode_Create( GAMEMODE_TBAG ) + GameMode_SetName( GAMEMODE_TBAG, "#GAMEMODE_TBAG" ) + GameMode_SetDesc( GAMEMODE_TBAG, "#PL_tbag_desc" ) + GameMode_SetGameModeAnnouncement( GAMEMODE_TBAG, "grnc_modeDesc" ) + GameMode_SetDefaultTimeLimits( GAMEMODE_TBAG, 10, 0.0 ) + GameMode_AddScoreboardColumnData( GAMEMODE_TBAG, "#SCOREBOARD_PILOT_KILLS", PGS_PILOT_KILLS, 2 ) + GameMode_AddScoreboardColumnData( GAMEMODE_TBAG, "#SCOREBOARD_DEATHS", PGS_ASSAULT_SCORE, 2 ) + GameMode_AddScoreboardColumnData( GAMEMODE_TBAG, "#SCOREBOARD_GAVETEABAG", PGS_TITAN_KILLS, 2 ) + GameMode_AddScoreboardColumnData( GAMEMODE_TBAG, "#SCOREBOARD_DENYTEABAG", PGS_DEFENSE_SCORE, 2 ) + GameMode_SetColor( GAMEMODE_TBAG, [147, 204, 57, 255] ) + + AddPrivateMatchMode( GAMEMODE_TBAG ) // add to private lobby modes + + AddPrivateMatchModeSettingArbitrary( "#PL_tbag", "floatingduration", "30" ) + AddPrivateMatchModeSettingArbitrary( "#PL_tbag", "teabagcounter", "4" ) + + // set this to 25 score limit default + GameMode_SetDefaultScoreLimits( GAMEMODE_TBAG, 25, 0 ) + + #if SERVER + GameMode_AddServerInit( GAMEMODE_TBAG, GamemodeTbag_Init ) + GameMode_SetPilotSpawnpointsRatingFunc( GAMEMODE_TBAG, RateSpawnpoints_Generic ) + GameMode_SetTitanSpawnpointsRatingFunc( GAMEMODE_TBAG, RateSpawnpoints_Generic ) + #elseif CLIENT + GameMode_AddClientInit( GAMEMODE_TBAG, ClGamemodeTbag_Init ) + #endif + #if !UI + GameMode_SetScoreCompareFunc( GAMEMODE_TBAG, CompareAssaultScore ) + #endif +} + +void function TbagRegisterNetworkVars() +{ + if ( GAMETYPE != GAMEMODE_TBAG ) + return + + Remote_RegisterFunction( "ServerCallback_TeabagConfirmed" ) + Remote_RegisterFunction( "ServerCallback_TeabagDenied" ) +} From f1572a5e4d7054ff6c593a65b0c455568153c7e4 Mon Sep 17 00:00:00 2001 From: x3Karma Date: Mon, 15 Aug 2022 18:02:20 +0800 Subject: [PATCH 6/9] typo --- .../mod/resource/northstar_client_localisation_english.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt index 2ba969782..73ee9cad2 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt @@ -173,8 +173,8 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a "GAMEMODE_TBAG" "Teabag Confirmed" "SCOREBOARD_GAVETEABAG" "Teabags Given" "SCOREBOARD_DENYTEABAG" "Teabags Denied" - "TBAG_TEABAG_CONFIRMED" "Teabags Confirmed" - "TBAG_TEABAG_DENIED" "Teabags Denied" + "TBAG_TEABAG_CONFIRMED" "Teabag Confirmed" + "TBAG_TEABAG_DENIED" "Teabag Denied" "PL_hs" "Hide and Seek" "PL_hs_lobby" "Hide and Seek Lobby" From b8aae4a706390e6546e1ee4350a65beb1261819b Mon Sep 17 00:00:00 2001 From: x3Karma Date: Mon, 15 Aug 2022 18:10:08 +0800 Subject: [PATCH 7/9] Added Server-Sided Input Callbacks + Formatting --- .../vscripts/gamemodes/_gamemode_tbag.nut | 116 ++++++++++-------- .../vscripts/gamemodes/cl_gamemode_tbag.nut | 24 +--- 2 files changed, 64 insertions(+), 76 deletions(-) diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut index 12f0a82d5..4598ec4df 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut @@ -9,7 +9,6 @@ struct { int teabagCounter // how many times do you need to teabag } file - void function GamemodeTbag_Init() { SetShouldUseRoundWinningKillReplay( true ) @@ -22,18 +21,18 @@ void function GamemodeTbag_Init() AddCallback_GameStateEnter( eGameState.WinnerDetermined, OnWinnerDetermined ) SetTimeoutWinnerDecisionFunc( CheckScoreForDraw ) + PrecacheModel( HELMET_COLLECTIBLE_MODEL ) file.floatingDuration = GetCurrentPlaylistVarInt( "floatingduration", 30 ) file.teabagCounter = GetCurrentPlaylistVarInt( "teabagcounter", 4 ) - - AddClientCommandCallback("Tbag_down", Crouching ); - AddClientCommandCallback("Tbag_downtoggle", ToggleCrouching ); // toggle crouch requires x2 the input for whatever reason } void function TbagInitPlayer( entity player ) { file.players[player] <- Time() // start beginning countdown file.tbag[player] <- 0 // newslot this so the tbag counter starts at 0 + AddCrouchButtonInputCallback( player ) + AddToggleCrouchButtonInputCallback( player ) } void function TbagCleanupClient( entity player ) @@ -56,8 +55,8 @@ void function TbagOnPlayerKilled( entity victim, entity attacker, var damageInfo if ( attacker.IsPlayer() ) { - CreateBattery(victim) - SetRoundWinningKillReplayAttacker(attacker) + CreateBattery( victim ) + SetRoundWinningKillReplayAttacker( attacker ) } } @@ -77,13 +76,23 @@ int function CheckScoreForDraw() return TEAM_UNASSIGNED } +void function AddCrouchButtonInputCallback( entity player ) +{ + AddButtonPressedPlayerInputCallback( player, IN_DUCK, Crouching ) +} + +void function AddToggleCrouchButtonInputCallback( entity player ) +{ + AddButtonPressedPlayerInputCallback( player, IN_DUCKTOGGLE, ToggleCrouching ) // toggle crouch requires x2 the input +} + // ======================================================================================================== // // BATTERY STUFF // // ======================================================================================================== -void function CreateBattery(entity player) +void function CreateBattery( entity player ) { entity batteryPack = CreateEntity( "prop_dynamic" ) batteryPack.SetValueForModelKey( RODEO_BATTERY_MODEL ) // ideally I would want the Helmet collectible from the campaign :/ @@ -120,7 +129,7 @@ void function CreateBattery(entity player) thread DestroyBattery( flyer, file.floatingDuration ) } -void function DestroyBattery(entity batteryPack, int duration) +void function DestroyBattery( entity batteryPack, int duration ) { batteryPack.EndSignal( "OnDestroy" ) OnThreadEnd( @@ -132,14 +141,15 @@ void function DestroyBattery(entity batteryPack, int duration) } } ) - int lastDuration = (duration - (duration - 5) ) + int lastDuration = ( duration - (duration - 5) ) wait duration - 5 thread FlickeringOnTimeout(batteryPack) wait lastDuration } -void function FlickeringOnTimeout(entity bruh) +void function FlickeringOnTimeout( entity bruh ) { + batteryPack.EndSignal( "OnDestroy" ) while (IsValid(bruh)) { try @@ -154,7 +164,7 @@ void function FlickeringOnTimeout(entity bruh) } } -void function CreateBatteryTrigger(entity batteryPack) +void function CreateBatteryTrigger( entity batteryPack ) { entity trigger = CreateEntity( "trigger_cylinder" ) trigger.SetRadius( 100 ) @@ -164,16 +174,16 @@ void function CreateBatteryTrigger(entity batteryPack) trigger.SetParent( batteryPack ) trigger.kv.triggerFilterNpc = "none" DispatchSpawn( trigger ) - SetTeam(trigger, batteryPack.GetTeam()) + SetTeam( trigger, batteryPack.GetTeam() ) trigger.SetEnterCallback( BatteryTrigger_Enter ) trigger.SetLeaveCallback( BatteryTrigger_Leave ) } void function BatteryTrigger_Enter( entity trigger, entity player ) { - if ( trigger != null && IsValid(player) && player.IsPlayer()) + if ( trigger != null && IsValid(player) && player.IsPlayer() ) { - if (! (player in file.trigger)) + if ( !( player in file.trigger ) ) { file.trigger[player] <- [] // create a new fucking array if there hasn't been one before file.trigger[player].append(trigger) @@ -187,7 +197,7 @@ void function BatteryTrigger_Leave( entity trigger, entity player ) { if ( trigger != null ) { - if (player in file.trigger) + if ( player in file.trigger ) { foreach( triggerbaby in file.trigger[player] ) { @@ -198,21 +208,21 @@ void function BatteryTrigger_Leave( entity trigger, entity player ) } } -bool function Crouching(entity player, array args) +void function Crouching( entity player ) { - if (! (player in file.players) ) - return true; + if ( !(player in file.players) ) + return - if (! (player in file.trigger) ) - return true; + if ( !(player in file.trigger) ) + return - if (Time() - file.players[player] > 3.0) // if they exceeded the grace period, demolish their counter + if ( Time() - file.players[player] > 3.0 ) // if they exceeded the grace period, demolish their counter { file.tbag[player] = 0 file.players[player] = Time() } - if (Time() - file.players[player] <= 3.0) // oh hey they do be tbaging, add one to the counter + if ( Time() - file.players[player] <= 3.0 ) // oh hey they do be tbaging, add one to the counter { int i = file.tbag[player] i++ @@ -220,13 +230,13 @@ bool function Crouching(entity player, array args) file.players[player] = Time() } - if (file.tbag[player] >= file.teabagCounter) // they tbag alot, so time to do stuff + if ( file.tbag[player] >= file.teabagCounter ) // they tbag alot, so time to do stuff { - foreach (triggerbaby in file.trigger[player]) + foreach ( triggerbaby in file.trigger[player] ) { - if (triggerbaby.GetTeam() != player.GetTeam()) + if ( triggerbaby.GetTeam() != player.GetTeam() ) { - AddTeamScore( player.GetTeam(), 1) // add score if tbag'd an enemy's corpse + AddTeamScore( player.GetTeam(), 1 ) // add score if tbag'd an enemy's corpse entity batteryPack = triggerbaby.GetParent() entity mover = batteryPack.GetParent() if ( IsValid( mover ) ) @@ -234,7 +244,7 @@ bool function Crouching(entity player, array args) ClearChildren( batteryPack ) mover.Destroy() } - if (IsValid (triggerbaby) ) + if ( IsValid( triggerbaby ) ) { file.trigger[player].remove( file.trigger[player].find(triggerbaby) ) triggerbaby.Destroy() @@ -250,7 +260,7 @@ bool function Crouching(entity player, array args) ClearChildren( batteryPack ) mover.Destroy() } - if (IsValid (triggerbaby) ) + if ( IsValid(triggerbaby) ) { file.trigger[player].remove( file.trigger[player].find(triggerbaby) ) triggerbaby.Destroy() @@ -260,24 +270,24 @@ bool function Crouching(entity player, array args) } } } - return true; + return } -bool function ToggleCrouching(entity player, array args) +void function ToggleCrouching( entity player ) { - if (! (player in file.players) ) - return true; + if ( !(player in file.players) ) + return - if (! (player in file.trigger) ) - return true; + if ( !(player in file.trigger) ) + return - if (Time() - file.players[player] > 3.0) + if ( Time() - file.players[player] > 3.0 ) { file.tbag[player] = 0 file.players[player] = Time() } - if (Time() - file.players[player] <= 3.0) + if ( Time() - file.players[player] <= 3.0 ) { int i = file.tbag[player] i++ @@ -285,13 +295,13 @@ bool function ToggleCrouching(entity player, array args) file.players[player] = Time() } - if (file.tbag[player] >= (file.teabagCounter * 2)) + if ( file.tbag[player] >= ( file.teabagCounter * 2 ) ) { - foreach (triggerbaby in file.trigger[player]) + foreach ( triggerbaby in file.trigger[player] ) { - if (triggerbaby.GetTeam() != player.GetTeam()) + if ( triggerbaby.GetTeam() != player.GetTeam() ) { - AddTeamScore( player.GetTeam(), 1) + AddTeamScore( player.GetTeam(), 1 ) entity batteryPack = triggerbaby.GetParent() entity mover = batteryPack.GetParent() if ( IsValid( mover ) ) @@ -299,7 +309,7 @@ bool function ToggleCrouching(entity player, array args) ClearChildren( batteryPack ) mover.Destroy() } - if (IsValid (triggerbaby) ) + if ( IsValid( triggerbaby ) ) { file.trigger[player].remove( file.trigger[player].find(triggerbaby) ) triggerbaby.Destroy() @@ -315,7 +325,7 @@ bool function ToggleCrouching(entity player, array args) ClearChildren( batteryPack ) mover.Destroy() } - if (IsValid (triggerbaby) ) + if ( IsValid(triggerbaby) ) { file.trigger[player].remove( file.trigger[player].find(triggerbaby) ) triggerbaby.Destroy() @@ -325,7 +335,7 @@ bool function ToggleCrouching(entity player, array args) } } } - return true; + return } // ======================================================================================================== @@ -337,7 +347,7 @@ const float CYCLES = 3.0 const float RADIUS = 3.0 const float ANGLES = 45.0 -void function StartAnimating(entity toAnimate) { +void function StartAnimating( entity toAnimate ) { vector originalOrigin = toAnimate.GetOrigin() vector originalAngles = toAnimate.GetAngles() @@ -348,13 +358,13 @@ void function StartAnimating(entity toAnimate) { float angleOffset = 0.0 float currTime = Time() - while ( IsValid(toAnimate) ) + while ( IsValid( toAnimate ) ) { // delta time since last frame so it isnt frame dependant lmao - float delta = (Time() - currTime) // s since last frame + float delta = ( Time() - currTime ) // s since last frame float step = CYCLES * delta - float ratio = fAbs(zOffset) / RADIUS - float smooth = sineEasing(ratio) // how much it'll increment every second + float ratio = fAbs( zOffset ) / RADIUS + float smooth = sineEasing( ratio ) // how much it'll increment every second float angleStep = ANGLES * delta zOffset += step @@ -370,7 +380,7 @@ void function StartAnimating(entity toAnimate) { toAnimate.NonPhysicsRotateTo( originalAngles + <0,angleOffset,0> , 0.5, 0.1, 0.1 ) } catch (ex) { - print(ex) + print( ex ) } WaitFrame() @@ -379,15 +389,15 @@ void function StartAnimating(entity toAnimate) { // Eases in via sine function from -1 to 1 // makes it look smooth // math turned out to be useful wow -float function sineEasing(float x) { - return (-(2 * (cos(PI * x) - 1) / 2)) - 1.0 +float function sineEasing( float x ) { + return ( -( 2 * ( cos( PI * x ) - 1 ) / 2 ) ) - 1.0 } //abs of a float -float function fAbs(float x) { +float function fAbs( float x ) { float res = 0.0; - if (x < 0) { + if ( x < 0 ) { res = -x } else { res = x; diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_tbag.nut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_tbag.nut index cd4e7af3f..67f362e73 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_tbag.nut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/cl_gamemode_tbag.nut @@ -4,10 +4,6 @@ global function ServerCallback_TeabagDenied void function ClGamemodeTbag_Init() { - // add ffa gamestate asset - // ClGameState_RegisterGameStateAsset( $"ui/gamestate_info_ffa.rpak" ) - - // add music for mode, this is copied directly from the ffa/fra music registered in cl_music.gnut RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_INTRO, "music_mp_freeagents_intro", TEAM_IMC ) RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_INTRO, "music_mp_freeagents_intro", TEAM_MILITIA ) @@ -25,16 +21,10 @@ void function ClGamemodeTbag_Init() RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_LAST_MINUTE, "music_mp_freeagents_lastminute", TEAM_IMC ) RegisterLevelMusicForTeam( eMusicPieceID.LEVEL_LAST_MINUTE, "music_mp_freeagents_lastminute", TEAM_MILITIA ) - - #if CLIENT - RegisterConCommandTriggeredCallback( "+duck", PlayerPressed_down ) - RegisterConCommandTriggeredCallback( "+toggle_duck", PlayerPressed_downtoggle ) - #endif } void function ServerCallback_TeabagConfirmed() { - // heavily based on mfd code entity localPlayer = GetLocalViewPlayer() AnnouncementData announcement = Announcement_Create( "#TBAG_TEABAG_CONFIRMED" ) @@ -58,16 +48,4 @@ void function ServerCallback_TeabagDenied() Announcement_SetSoundAlias( announcement, SFX_HUD_ANNOUNCE_QUICK ) Announcement_SetStyle( announcement, ANNOUNCEMENT_STYLE_QUICK ) AnnouncementFromClass( localPlayer, announcement ) -} - -#if CLIENT -void function PlayerPressed_down( entity player ) -{ - player.ClientCommand( "Tbag_down" ) -} - -void function PlayerPressed_downtoggle( entity player ) -{ - player.ClientCommand( "Tbag_downtoggle" ) -} -#endif \ No newline at end of file +} \ No newline at end of file From f25ee3a48644f8508d901886f1d087e2bcb5649e Mon Sep 17 00:00:00 2001 From: x3Karma Date: Mon, 15 Aug 2022 18:13:43 +0800 Subject: [PATCH 8/9] Remove Helmet Model line --- .../mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut | 1 - 1 file changed, 1 deletion(-) diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut index 4598ec4df..89492d354 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut @@ -21,7 +21,6 @@ void function GamemodeTbag_Init() AddCallback_GameStateEnter( eGameState.WinnerDetermined, OnWinnerDetermined ) SetTimeoutWinnerDecisionFunc( CheckScoreForDraw ) - PrecacheModel( HELMET_COLLECTIBLE_MODEL ) file.floatingDuration = GetCurrentPlaylistVarInt( "floatingduration", 30 ) file.teabagCounter = GetCurrentPlaylistVarInt( "teabagcounter", 4 ) From d57dc3d462694e9454ebf5564d07c85361178205 Mon Sep 17 00:00:00 2001 From: x3Karma Date: Mon, 15 Aug 2022 19:15:50 +0800 Subject: [PATCH 9/9] renaming dumb variables --- .../mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut index 89492d354..eb50c5687 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_tbag.nut @@ -146,17 +146,17 @@ void function DestroyBattery( entity batteryPack, int duration ) wait lastDuration } -void function FlickeringOnTimeout( entity bruh ) +void function FlickeringOnTimeout( entity batteryPack ) { batteryPack.EndSignal( "OnDestroy" ) - while (IsValid(bruh)) + while (IsValid(batteryPack)) { try { wait 0.2 - bruh.kv.VisibilityFlags = ENTITY_VISIBLE_TO_EVERYONE + batteryPack.kv.VisibilityFlags = ENTITY_VISIBLE_TO_EVERYONE wait 0.2 - bruh.kv.VisibilityFlags = 0 + batteryPack.kv.VisibilityFlags = 0 } catch (why) {} WaitFrame()