Skip to content

Commit

Permalink
Updated Northstar scripts to version 1.17.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gazyi committed Jul 22, 2023
1 parent 4c476c4 commit 31d906d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 13 additions & 1 deletion mod/scripts/vscripts/ai/_ai_soldiers.gnut
Original file line number Diff line number Diff line change
Expand Up @@ -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" )
Expand Down Expand Up @@ -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?
Expand Down
10 changes: 5 additions & 5 deletions mod/scripts/vscripts/ai/_ai_spawn_content.gnut
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ function CommonNPCOnSpawned( entity npc )
{
thread DroneGruntThink( npc, npc.ai.droneSpawnAISettings )
}
/*
#if DEV
if ( npc.GetMainWeapons().len() != 0)
{
array<entity> weaponsArray = npc.GetMainWeapons()
Expand All @@ -351,7 +351,7 @@ function CommonNPCOnSpawned( entity npc )

printt( "[AI Spawn Content][Grunt] Grenade type: " + npc.kv.grenadeWeaponName )
}
*/
#endif
break

case "npc_spectre":
Expand Down Expand Up @@ -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<entity> weaponsArray = npc.GetMainWeapons()
Expand All @@ -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 )

Expand Down
20 changes: 3 additions & 17 deletions mod/scripts/vscripts/gamemodes/_gamemode_at.nut
Original file line number Diff line number Diff line change
Expand Up @@ -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 )

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 31d906d

Please sign in to comment.