aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/scripts/vscripts/ai/_squad_spawn.gnut
blob: 9dbdd699dc6fc98296f641b67d45a5649c7cfad5 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
global function GetNPCBaseClassFromSpawnFunc

global function CreateZipLineSquadDropTable

string function GetNPCBaseClassFromSpawnFunc( entity functionref( int, vector, vector ) spawnFunc )
{
	// temp spawn a guy to get his baseclass.
	entity npc = spawnFunc( TEAM_IMC, Vector(0,0,0), Vector(0,0,0) )
	string baseClass = npc.GetClassName()
	npc.Destroy()
	return baseClass
}



void function DropOffAISide_NPCThink( entity npc, int index, entity dropship, string attach )
{
	npc.EndSignal( "OnDeath" )

	//init
	npc.SetParent( dropship, attach )
	npc.SetEfficientMode( true )

	//deploy
	array<string> deployAnims = DropOffAISide_GetDeployAnims()
	array<float> seekTimes = DropOffAISide_GetSeekTimes()

	thread PlayAnimTeleport( npc, deployAnims[ index ], dropship, attach )
	npc.Anim_SetInitialTime( seekTimes[ index ] )
	WaittillAnimDone( npc )

	npc.SetEfficientMode( false )

	//disperse
	array<string> disperseAnims = DropOffAISide_GetDisperseAnims()
	vector origin = HackGetDeltaToRef( npc.GetOrigin(), npc.GetAngles(), npc, disperseAnims[ index ] ) + Vector( 0,0,2 )
	waitthread PlayAnimGravity( npc, disperseAnims[ index ], origin, npc.GetAngles() )
}

void function DropOffAISide_WarpOutShip( entity dropship, vector origin, vector angles )
{
	wait 1.5
	dropship.EndSignal( "OnDeath" )

	string anim = "cd_dropship_rescue_side_end"
	thread PlayAnim( dropship, anim, origin, angles )

	//blend
	wait dropship.GetSequenceDuration( anim ) - 0.2

	dropship.Hide()
	thread WarpoutEffect( dropship )
}

float function GetInstantSpawnRadius( entity npc )
{
	float radius 	= 64

	if ( npc )
	{
		switch ( npc.GetClassName() )
		{
			case "npc_gunship":
			case "npc_dropship":
				radius = 512
				break

			case "npc_titan":
				radius = 256
				break

			case "npc_super_spectre":
			case "npc_prowler":
				radius = 128
				break

			default:
				radius = 64
				break
		}
	}

	return radius
}




/************************************************************************************************\

##     ## ####  ######   ######        ########  #######   #######  ##        ######
###   ###  ##  ##    ## ##    ##          ##    ##     ## ##     ## ##       ##    ##
#### ####  ##  ##       ##                ##    ##     ## ##     ## ##       ##
## ### ##  ##   ######  ##                ##    ##     ## ##     ## ##        ######
##     ##  ##        ## ##                ##    ##     ## ##     ## ##             ##
##     ##  ##  ##    ## ##    ##          ##    ##     ## ##     ## ##       ##    ##
##     ## ####  ######   ######           ##     #######   #######  ########  ######

\************************************************************************************************/




array<string> function DropOffAISide_GetIdleAnims()
{
	array<string> anims = [
	"pt_ds_side_intro_gen_idle_A",	//standing right
	"pt_ds_side_intro_gen_idle_B",	//standing left
	"pt_ds_side_intro_gen_idle_C",	//sitting right
	"pt_ds_side_intro_gen_idle_D" ]	//sitting left

	return anims
}

array<string> function DropOffAISide_GetDeployAnims()
{
	array<string> anims = [
	"pt_generic_side_jumpLand_A",	//standing right
	"pt_generic_side_jumpLand_B",	//standing left
	"pt_generic_side_jumpLand_C",	//sitting right
	"pt_generic_side_jumpLand_D" ]	//sitting left

	return anims
}

array<string> function DropOffAISide_GetDisperseAnims()
{
	array<string> anims = [
	"React_signal_thatway",	//standing right
	"React_spot_radio2",	//standing left
	"stand_2_run_45R",		//sitting right
	"stand_2_run_45L" ]		//sitting left

	return anims
}

array<float> function DropOffAISide_GetSeekTimes()
{
	array<float> anims = [
	9.75,	//standing right
	10.0,	//standing left
	10.5,	//sitting right
	11.25 ]	//sitting left

	return anims
}


CallinData function CreateZipLineSquadDropTable( int team, int count, vector origin, vector angles, string squadName = "" )
{
	if ( squadName == "" )
		squadName = MakeSquadName( team, UniqueString( "ZiplineTable" ) )

	CallinData drop
	drop.origin 		= origin
	drop.yaw 			= angles.y
	drop.dist 			= 768
	drop.team 			= team
	drop.squadname 		= squadName
	SetDropTableSpawnFuncs( drop, CreateSoldier, count )
	SetCallinStyle( drop, eDropStyle.ZIPLINE_NPC )

	return drop
}