global function GamemodeGG_Init void function GamemodeGG_Init() { SetSpawnpointGamemodeOverride( FFA ) SetShouldUseRoundWinningKillReplay( true ) ClassicMP_ForceDisableEpilogue( true ) SetLoadoutGracePeriodEnabled( false ) // prevent modifying loadouts with grace period SetWeaponDropsEnabled( false ) Riff_ForceTitanAvailability( eTitanAvailability.Never ) Riff_ForceBoostAvailability( eBoostAvailability.Disabled ) AddCallback_OnPlayerRespawned( OnPlayerRespawned ) AddCallback_OnPlayerKilled( OnPlayerKilled ) AddCallback_GameStateEnter( eGameState.WinnerDetermined, OnWinnerDetermined ) } void function OnPlayerRespawned( entity player ) { UpdateLoadout( player ) thread OnPlayerRespawned_Threaded( player ) } void function OnPlayerRespawned_Threaded( entity player ) { // bit of a hack, need to rework earnmeter code to have better support for completely disabling it // rn though this just waits for earnmeter code to set the mode before we set it back WaitFrame() PlayerEarnMeter_SetMode( player, eEarnMeterMode.DISABLED ) } void function OnPlayerKilled( entity victim, entity attacker, var damageInfo ) { if ( !victim.IsPlayer() || !attacker.IsPlayer() || GetGameState() != eGameState.Playing ) return if ( attacker == victim ) // suicide { string message = victim.GetPlayerName() + " committed suicide." foreach ( entity player in GetPlayerArray() ) SendHudMessage( player, message, -1, 0.4, 255, 0, 0, 0, 0, 3, 0.15 ) if ( GameRules_GetTeamScore( victim.GetTeam() ) != 0 ) { AddTeamScore( victim.GetTeam(), -1 ) // get absolutely fucking destroyed lol victim.AddToPlayerGameStat( PGS_ASSAULT_SCORE, -1 ) } } else { if ( DamageInfo_GetDamageSourceIdentifier( damageInfo ) != eDamageSourceId.melee_pilot_emptyhanded ) { AddTeamScore( attacker.GetTeam(), 1 ) attacker.AddToPlayerGameStat( PGS_ASSAULT_SCORE, 1 ) UpdateLoadout( attacker ) } if ( DamageInfo_GetDamageSourceIdentifier( damageInfo ) == eDamageSourceId.human_execution ) { string message = victim.GetPlayerName() + " got executed." foreach ( entity player in GetPlayerArray() ) SendHudMessage( player, message, -1, 0.4, 255, 0, 0, 0, 0, 3, 0.15 ) if ( GameRules_GetTeamScore( victim.GetTeam() ) != 0 ) { AddTeamScore( victim.GetTeam(), -1 ) // get absolutely fucking destroyed lol victim.AddToPlayerGameStat( PGS_ASSAULT_SCORE, -1 ) } } } } void function UpdateLoadout( entity player ) { // todo: honestly, this should be reworked to use PilotLoadoutDefs instead of directly modifying weapons and shit int currentWeaponIndex = GameRules_GetTeamScore( player.GetTeam() ) array weapons = GetGunGameWeapons() if ( currentWeaponIndex >= weapons.len() ) currentWeaponIndex = weapons.len() - 1 if ( currentWeaponIndex > 18 ) // play end of game music for special weapons PlayMusicToAll( eMusicPieceID.LEVEL_LAST_MINUTE ) // this *shouldn't* overlap if done multiple times GunGameWeapon weapon = weapons[ currentWeaponIndex ] foreach ( entity weapon in player.GetMainWeapons() ) player.TakeWeaponNow( weapon.GetWeaponClassName() ) foreach ( entity weapon in player.GetOffhandWeapons() ) player.TakeWeaponNow( weapon.GetWeaponClassName() ) if ( weapon.offhandSlot != -1 ) { // TEMP: give archer so player so player has a weapon which lets them use offhands // need to replace this with a custom empty weapon at some point player.GiveWeapon( "mp_weapon_rocket_launcher" ) player.GiveOffhandWeapon( weapon.weapon, weapon.offhandSlot, weapon.mods ) } else player.GiveWeapon( weapon.weapon, weapon.mods ) player.GiveOffhandWeapon( "melee_pilot_emptyhanded", OFFHAND_MELEE ) } void function OnWinnerDetermined() { SetRespawnsEnabled( false ) SetKillcamsEnabled( false ) }