aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/mp/_ai_mp.gnut
blob: 1102aae1c5a2be986a9228ee24481747337af720 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
untyped
global function MpInitAILoadouts
global function SetProficiency
global function SPMP_UpdateNPCProficiency
global function SPMP_Callback_ForceAIMissPlayer
global function IsAutoPopulateEnabled

void function MpInitAILoadouts()
{

}

void function SetProficiency( entity npc )
{
	// unsure what the logic for deciding this should be so just going to default good
	npc.kv.WeaponProficiency = eWeaponProficiency.VERYGOOD
}

void function SPMP_UpdateNPCProficiency( entity npc )
{

}

bool function IsAutoPopulateEnabled( var team = null )
{
	if ( IsNPCSpawningEnabled() == false )
		return false

	if ( Flag( "disable_npcs" ) )
		return false

	if ( team == TEAM_MILITIA && Flag( "Disable_MILITIA" ) )
		return false
	if ( team == TEAM_IMC && Flag( "Disable_IMC" ) )
		return false

	return true
}

bool function SPMP_Callback_ForceAIMissPlayer( entity npc, entity player )
{
	if ( GetGameState() >= eGameState.Postmatch )
		return true
	
	if ( player.IsTitan() )
		return false
		
	int lethality = Riff_AILethality()
	if ( lethality <= eAILethality.Medium )
		if ( player.GetTitanSoulBeingRodeoed() != null )
			return true
	
	if ( Bleedout_IsBleedoutLogicActive() && Bleedout_ShouldAIMissBleedingPlayer( player ) )
		return true
	
	if ( player.ContextAction_IsActive() )
		return RandomFloat( 1 ) >= 0.25
	
	if ( IsFastPilot( player ) )
	{
		float chance = ( lethality + 1 ) * 0.125
		if ( lethality <= eAILethality.Medium && npc.IsMechanical() )
			chance /= 1.25
		
		return RandomFloat( 1 ) >= chance
	}
	
	return false
}