aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Custom/scripts/vscripts/gamemodes/sh_riff_floor_is_lava.nut
blob: 3a8ac8e752b388c955256e88dd4e6795ccbf4236 (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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
untyped

global function RiffFloorIsLavaShared_Init

global function GetFogHeight
global function GetLethalFogTopTitan
global function GetLethalFogTop
global function GetLethalFogBottom
global function GetVisibleFogTop
global function GetVisibleFogBottom
global function GetMaxTitanSpawnFogHeight

global function IsEntInSafeVolume
global function IsEntInLethalVolume

struct
{
	float fogDepth = 64.0
	float maxTitanSpawnFogDepth = 170.0
	array lethalTitanVolumes
	array lethalPilotVolumes
	array safePilotVolumes
	bool volumesDebug = false
	table< string, float > lethalFogHeights
} file

function RiffFloorIsLavaShared_Init()
{
	switch ( GetMapName() )
	{
		case "mp_lagoon":
			AddLethalTitanVolume( Vector( -45.656845, 3555.449463, 40.422455 ), Vector( 1209.944092, 5599.152832, 234.813217 ) )
			AddLethalTitanVolume( Vector( -5232.395020, 205.406250, 0.031250 ), Vector( -777.285400, 4075.119385, 300.634771 ) )
			AddLethalTitanVolume( Vector( -4686.448730, 4190.655273, 20.642021 ), Vector( -41.171387, 9072.019043, 200.697632 ) )
			AddLethalTitanVolume( Vector( -7586.861328, 4072.843994, 0.031254 ), Vector( -7012.854004, 4614.723145, 302.714966 ) )
			break

		case "mp_nexus":
			AddLethalTitanVolume( Vector( 1567.173523, -27.374023, 209.422455 ), Vector( 2516.944092, 2585.152832, 500.813217 ) )
			AddLethalTitanVolume( Vector( -2825.766113, 5056.203125, 243.706253 ), Vector( -2255.893555, 5688.334961, 400.251160 ) )
			AddLethalTitanVolume( Vector( -5717.068359, -349.599976, 189.669785 ), Vector( -4960.125000, 758.196350, 400.268097 ) )
			AddLethalTitanVolume( Vector( -3292.942139, 1713.916626, 233.749817 ), Vector( -2322.137695, 3091.497070, 477.462799 ) )
			AddLethalTitanVolume( Vector( -878.712769, -5878.528809, 71.145332 ), Vector( 338.741943, -5014.183594, 443.146179 ) )
			AddLethalTitanVolume( Vector( -6930.957031, -1277.388550, 107.619537 ), Vector( -6574.779297, -779.338013, 685.485901 ) )
			break

		case "mp_outpost_207":
			AddSafePilotVolume( Vector( 2359.524658, -631.065918, -256.714142 ), Vector( 2623.051270, -182.453323, -220.125641 ) )

			AddLethalTitanVolume( Vector( -100.349350, 2218.763916, -330.968750 ), Vector( 2561.511230, 4030.028320, -133.065369 ) )
			AddLethalTitanVolume( Vector( -452.031647, 282.244629, -255.968750 ), Vector( 2241.971069, 1594.146851, -100.212967 ) )
			break

		case "mp_training_ground":
			AddSafePilotVolume( Vector( -2618.053223, -3435.505615, 40.215054 ), Vector( -2309.167236, -3321.788330, 146.218491 ) )
			AddSafePilotVolume( Vector( -3187.767090, -2886.333496, 45.746925 ), Vector( -2865.753174, -2681.679443, 109.089279 ) )
			AddSafePilotVolume( Vector( -3717.815674, -2350.831543, 47.694588 ), Vector( -3431.980957, -2145.194092, 120.640717 ) )

			AddLethalTitanVolume( Vector( -3439.702179, -2227.359741, -8.036909 ), Vector( 2185.765076, 2384.459412, 225.199013 ) )
			AddLethalTitanVolume( Vector( -3200.747681, -4456.148926, 0.0 ), Vector( -1261.621826, -3000.667480, 160.689011 ) )
			AddLethalTitanVolume( Vector( 1261.621826, 3000.667480, 0.0 ), Vector( 2700.747681, 4456.148926, 160.689011 ) )
			AddLethalTitanVolume( Vector( -3291.510986, 3483.724609, 4.031250 ), Vector( -2018.871826, 4463.995850, 122.675621 ) )
			AddLethalTitanVolume( Vector( 2018.871826, -3638.995850, 4.031250 ), Vector( 2241.510986, -3483.724609, 122.675621 ) )
			AddLethalTitanVolume( Vector( -2798.816528, -2302.519897, -30.285933 ), Vector( -1561.589355, -791.616699, 300.917297 ) )
			AddLethalTitanVolume( Vector( 3809.276123, 1639.001587, 11.272846 ), Vector( 4056.847412, 1862.587036, 100.205643 ) )
			AddLethalTitanVolume( Vector( -4189.979492, -3298.505127, -5.597572 ), Vector( -3398.622803, -560.027344, 147.054291 ) )
			break

		case "mp_runoff":
			AddLethalPilotVolume( Vector( -621.502319, -5743.472656, 299.838928 ), Vector( -397.317047, -5578.512207, 425.437927 ) )
			break
	}
}

float function GetFogHeight()
{
	string mapName = GetMapName()

	file.lethalFogHeights = {}
	file.lethalFogHeights[ "mp_angel_city" ] <- 216.0 // cp ctf mfd
	file.lethalFogHeights[ "mp_lagoon" ] <- 98.0 // cp mfd
	file.lethalFogHeights[ "mp_nexus" ] <- 310.0 // mfd
	file.lethalFogHeights[ "mp_o2" ] <- 40.0 // mfd
	file.lethalFogHeights[ "mp_outpost_207" ] <- -225.0 // mfd
	file.lethalFogHeights[ "mp_training_ground" ] <- 80.0 // cp mfd
	file.lethalFogHeights[ "mp_harmony_mines" ] <- 260.0 // cp ctf mfd
	file.lethalFogHeights[ "mp_haven" ] <- 128.0 // mfd

	// good map, needs spawns, etc...
	file.lethalFogHeights[ "mp_rise" ] <- 420.0 // mfd
	file.lethalFogHeights[ "mp_runoff" ] <- 340.0 // mfd
	file.lethalFogHeights[ "mp_zone_18" ] <- 460.0 // mfd
	file.lethalFogHeights[ "mp_sandtrap" ] <- 64.0

	// these don't work as well
	file.lethalFogHeights[ "mp_swampland" ] <- 350.0	// mfd
	file.lethalFogHeights[ "mp_backwater" ] <- 320.0 // mfd
	file.lethalFogHeights[ "mp_airbase" ] <- 450.0
	file.lethalFogHeights[ "mp_boneyard" ] <- 64.0
	file.lethalFogHeights[ "mp_colony" ] <- 270.0
	file.lethalFogHeights[ "mp_corporate" ] <- -765.0
	file.lethalFogHeights[ "mp_fracture" ] <- 270.0
	file.lethalFogHeights[ "mp_overlook" ] <- 16.0
	file.lethalFogHeights[ "mp_relic" ] <- 475.0
	file.lethalFogHeights[ "mp_smugglers_cove" ] <- 400.0
	file.lethalFogHeights[ "mp_wargames" ] <- 64.0
	file.lethalFogHeights[ "mp_switchback" ] <- 840.0

	file.lethalFogHeights[ "mp_chin_rodeo_express" ] <- 1580.0
	
	// custom: titanfall 2 maps
	// TODO: really need a modular system here
	file.lethalFogHeights[ "mp_colony02" ] <- 270.0 // map changed name from tf1 => tf2
	file.lethalFogHeights[ "mp_glitch" ] <- 200.0
	file.lethalFogHeights[ "mp_grave" ] <- 2350.0
	file.lethalFogHeights[ "mp_homestead" ] <- 64.0
	file.lethalFogHeights[ "mp_forwardbase_kodai" ] <- 930.0
	file.lethalFogHeights[ "mp_thaw" ] <- 32.0
	file.lethalFogHeights[ "mp_black_water_canal" ] <- 32.0
	file.lethalFogHeights[ "mp_eden" ] <- 175.0
	file.lethalFogHeights[ "mp_drydock" ] <- 300.0
	file.lethalFogHeights[ "mp_crashsite3" ] <- 800.0 // crashsite is just as awful for this as it is for anything else
	file.lethalFogHeights[ "mp_complex3" ] <- 630.0
	file.lethalFogHeights[ "mp_relic02" ] <- 250.0 // not great, tf1's would honestly be worse though imo
	
	// lf maps: overall a bit hit or miss, many likely have spawn issues
	file.lethalFogHeights[ "mp_lf_stacks" ] <- -9999.0 // entirely nonworking, breaks spawns no matter what from what i can tell, could potentially use safe zones for this?
	file.lethalFogHeights[ "mp_lf_deck" ] <- -9999.0 // nonworking fogcontroller so fog is invisible
	file.lethalFogHeights[ "mp_lf_uma" ] <- 64.0
	file.lethalFogHeights[ "mp_lf_meadow" ] <- 64.0
	file.lethalFogHeights[ "mp_lf_traffic" ] <- 50.0
	file.lethalFogHeights[ "mp_lf_township" ] <- 64.0

	if ( mapName in file.lethalFogHeights )
		return file.lethalFogHeights[ mapName ]

	return 64.0
}

float function GetLethalFogTopTitan()
{
	float fogTop = GetLethalFogTop()

	switch ( GetMapName() )
	{
		case "mp_lagoon":
		case "mp_nexus":
		case "mp_outpost_207":
		case "mp_training_ground":
		case "mp_chin_rodeo_express":
			return fogTop
	}

	return fogTop + 256.0
}

float function GetLethalFogTop()
{
	return GetFogHeight() - file.fogDepth * 0.2
}

float function GetLethalFogBottom()
{
	return GetFogHeight() - file.fogDepth * 0.7
}

float function GetVisibleFogTop()
{
	return GetFogHeight() + file.fogDepth * 0.5
}

float function GetVisibleFogBottom()
{
	return GetFogHeight() - file.fogDepth * 0.5
}

float function GetMaxTitanSpawnFogHeight()
{
	return GetFogHeight() - file.maxTitanSpawnFogDepth
}

function AddLethalTitanVolume( vector volumeMins, vector volumeMaxs )
{
	Assert( volumeMins.x < volumeMaxs.x )
	Assert( volumeMins.y < volumeMaxs.y )
	Assert( volumeMins.z < volumeMaxs.z )

	file.lethalTitanVolumes.append( { mins = volumeMins, maxs = volumeMaxs } )
}

function AddLethalPilotVolume( vector volumeMins, vector volumeMaxs )
{
	Assert( volumeMins.x < volumeMaxs.x )
	Assert( volumeMins.y < volumeMaxs.y )
	Assert( volumeMins.z < volumeMaxs.z )

	file.lethalPilotVolumes.append( { mins = volumeMins, maxs = volumeMaxs } )
}

function AddSafePilotVolume( vector volumeMins, vector volumeMaxs )
{
	Assert( volumeMins.x < volumeMaxs.x )
	Assert( volumeMins.y < volumeMaxs.y )
	Assert( volumeMins.z < volumeMaxs.z )

	file.safePilotVolumes.append( { mins = volumeMins, maxs = volumeMaxs } )
}

function IsEntInSafeVolume( entity ent )
{
	if ( ent.IsPlayer() )
	{
		foreach ( volume in file.safePilotVolumes )
		{
			vector entOrg = ent.GetOrigin()

			#if SERVER
				if ( file.volumesDebug )
					DebugDrawBox( Vector( 0.0, 0.0, 0.0 ), volume.mins, volume.maxs, 0, 0, 255, 1, 0.1 )
			#endif

			if ( PointIsWithinBounds( entOrg, expect vector( volume.mins ), expect vector( volume.maxs ) ) )
				return true
		}
	}
}

function IsEntInLethalVolume( entity ent )
{
	if ( ent.IsTitan() )
	{
		foreach ( volume in file.lethalTitanVolumes )
		{
			vector entOrg = ent.GetOrigin()

			#if SERVER
				if ( file.volumesDebug )
					DebugDrawBox( Vector( 0.0, 0.0, 0.0 ), volume.mins, volume.maxs, 255, 255, 0, 1, 0.1 )
			#endif

			if ( PointIsWithinBounds( entOrg, expect vector( volume.mins ), expect vector( volume.maxs ) ) )
				return true
		}
	}
	else if ( ent.IsPlayer() )
	{
		foreach ( volume in file.lethalPilotVolumes )
		{
			vector entOrg = ent.GetOrigin()

			#if SERVER
				if ( file.volumesDebug )
					DebugDrawBox( Vector( 0.0, 0.0, 0.0 ), volume.mins, volume.maxs, 255, 255, 0, 1, 0.1 )
			#endif

			if ( PointIsWithinBounds( entOrg, expect vector( volume.mins ), expect vector( volume.maxs ) ) )
				return true
		}
	}

	return false
}