diff --git a/mod.json b/mod.json index f690d3a..f7de7e4 100644 --- a/mod.json +++ b/mod.json @@ -3,7 +3,7 @@ "Description": "Gives AI minions various anti-titan capabilities.", "LoadPriority": 2, "RequiredOnClient": false, - "Version": "1.0.6", + "Version": "1.0.7", "ConVars": [ // Weapon distribution CVARs. diff --git a/mod/scripts/vscripts/ai/_ai_soldiers.gnut b/mod/scripts/vscripts/ai/_ai_soldiers.gnut index 7ebf3b4..2d435a9 100644 --- a/mod/scripts/vscripts/ai/_ai_soldiers.gnut +++ b/mod/scripts/vscripts/ai/_ai_soldiers.gnut @@ -62,6 +62,19 @@ function AiSoldiers_Init() level.COOP_AT_WEAPON_RATES[ "mp_weapon_smr" ] <- 0.4 level.COOP_AT_WEAPON_RATES[ "mp_weapon_mgl" ] <- 0.1 + // add stub death callback, because in _codecallbacks_common.gnut there is + // CodeCallback_OnEntityKilled which is only called when an entity is being tracked. An + // entity is set to be tracked if it has a death callback for it's class, unfortunately this + // is then relayed to clients and used for client side death callbacks. The end result of + // not having this function called is that clients become completely unaware of any grunt + // deaths. A noticeable difference here is that grunts do not play the kill confirmed audio + // except on War Games, which does register a callback for grunt deaths to make them dissolve. + // + // Whilst this may seem like a bit of a hacky solution, it is generally better than simply + // tracking all entities. If a different callback is created in the future for grunt deaths + // that is not specific to a gamemode, map, etc. then this could be removed + AddDeathCallback( "npc_soldier", void function( entity guy, var damageInfo ){} ) + PrecacheSprite( $"sprites/glow_05.vmt" ) FlagInit( "disable_npcs" ) FlagInit( "Disable_IMC" ) @@ -362,7 +375,6 @@ void function OnEnemyChanged_TryHeavyArmorWeapon( entity npc ) } // For now, using HACKS because GetWeaponType() always returns 0 - //bool isActiveWeapon_AntiTitan = activeWeapon.GetWeaponType() == WT_ANTITITAN bool isActiveWeapon_AntiTitan = (( activeWeapon.GetWeaponInfoFileKeyField( "titanarmor_critical_hit_required" ) == null ) || ( activeWeapon.GetWeaponInfoFileKeyField( "titanarmor_critical_hit_required" ) == 0 )) // already using an appropriate weapon? diff --git a/mod/scripts/vscripts/ai/_ai_spawn_content.gnut b/mod/scripts/vscripts/ai/_ai_spawn_content.gnut index 072984b..6bd8f39 100644 --- a/mod/scripts/vscripts/ai/_ai_spawn_content.gnut +++ b/mod/scripts/vscripts/ai/_ai_spawn_content.gnut @@ -339,7 +339,7 @@ function CommonNPCOnSpawned( entity npc ) { thread DroneGruntThink( npc, npc.ai.droneSpawnAISettings ) } -/* + #if DEV if ( npc.GetMainWeapons().len() != 0) { array weaponsArray = npc.GetMainWeapons() @@ -351,7 +351,7 @@ function CommonNPCOnSpawned( entity npc ) printt( "[AI Spawn Content][Grunt] Grenade type: " + npc.kv.grenadeWeaponName ) } -*/ + #endif break case "npc_spectre": @@ -392,7 +392,7 @@ function CommonNPCOnSpawned( entity npc ) if ( GetConVarBool( "sv_npc_give_antititan" ) && GetCurrentPlaylistVarInt( "aitdm_archer_grunts", 0 ) == 0 && SP_GetPilotAntiTitanWeapon( npc ) == null ) TryAutoAssignAntiTitanWeapon( npc ) -/* + #if DEV if ( npc.GetMainWeapons().len() != 0) { array weaponsArray = npc.GetMainWeapons() @@ -404,9 +404,9 @@ function CommonNPCOnSpawned( entity npc ) printt( "[AI Spawn Content][Spectre] Grenade type: " + npc.kv.grenadeWeaponName ) } - + #endif break -*/ + case "npc_stalker": InitMinimapSettings( npc ) diff --git a/mod/scripts/vscripts/gamemodes/_gamemode_at.nut b/mod/scripts/vscripts/gamemodes/_gamemode_at.nut index aa210be..ddd9149 100644 --- a/mod/scripts/vscripts/gamemodes/_gamemode_at.nut +++ b/mod/scripts/vscripts/gamemodes/_gamemode_at.nut @@ -107,7 +107,6 @@ void function GamemodeAt_Init() // Set-up score callbacks ScoreEvent_SetupEarnMeterValuesForMixedModes() - AddDamageFinalCallback( "npc_titan", OnNPCTitanFinalDamaged ) AddCallback_OnPlayerKilled( AT_PlayerOrNPCKilledScoreEvent ) AddCallback_OnNPCKilled( AT_PlayerOrNPCKilledScoreEvent ) @@ -1663,9 +1662,10 @@ void function AT_HandleBossTitanSpawn( entity titan, AT_WaveOrigin campData, int titan.Minimap_AlwaysShow( TEAM_MILITIA, null ) thread BountyBossHighlightThink( titan ) - // set up titan-specific death callbacks, mark it as bounty boss for finalDamageCallbacks to work + // set up titan-specific death callbacks, mark it as bounty boss file.titanIsBountyBoss[ titan ] <- true file.bountyTitanRewards[ titan ] <- ATTRITION_SCORE_BOSS_DAMAGE + AddEntityCallback_OnPostDamaged( titan, OnBountyTitanPostDamage ) AddEntityCallback_OnKilled( titan, OnBountyTitanKilled ) titan.GetTitanSoul().soul.skipDoomState = true @@ -1689,13 +1689,7 @@ void function BountyBossHighlightThink( entity titan ) } } -void function OnNPCTitanFinalDamaged( entity titan, var damageInfo ) -{ - if ( titan in file.titanIsBountyBoss ) - OnBountyTitanDamaged( titan, damageInfo ) -} - -void function OnBountyTitanDamaged( entity titan, var damageInfo ) +void function OnBountyTitanPostDamage( entity titan, var damageInfo ) { entity attacker = DamageInfo_GetAttacker( damageInfo ) if ( !IsValid( attacker ) ) // delayed by projectile shots @@ -1708,14 +1702,6 @@ void function OnBountyTitanDamaged( entity titan, var damageInfo ) return } - // respawn FUCKED UP pilot weapon against titan's damage calculation, have to copy-paste this check from Titan_NPCTookDamage() - if ( HeavyArmorCriticalHitRequired( damageInfo ) && - CritWeaponInDamageInfo( damageInfo ) && - !IsCriticalHit( attacker, titan, DamageInfo_GetHitBox( damageInfo ), DamageInfo_GetDamage( damageInfo ), DamageInfo_GetDamageType( damageInfo ) ) && - IsValid( attacker ) && - !attacker.IsTitan() ) - return - int rewardSegment = ATTRITION_SCORE_BOSS_DAMAGE int healthSegment = titan.GetMaxHealth() / rewardSegment