aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/titan/class_titan.gnut
blob: 5f72385ea3464dfa646e7768c1c29bb54b2578f2 (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
untyped

global function ClassTitan_Init

global function Titan_AddPlayer
global function Titan_OnPlayerDeath
global function ClientCommand_TitanEject
global function ApplyTitanLoadoutModifiers


const TITAN_HATCHCOMMANDANIMTIME = 1.5	// cooldown time between toggling the cockpit state. Will be needed when we have animations to play

const COCKPIT_JOLT_DAMAGE_MIN = 1
const COCKPIT_JOLT_DAMAGE_MAX = 200
const TITAN_STUMBLE_HEALTH_PERCENTAGE = 0.5

string thisClassName = "titan"

function ClassTitan_Init()
{

	AddClientCommandCallback( "TitanEject", ClientCommand_TitanEject ) //
}

function Titan_AddPlayer( player )
{
	player.playerClassData[thisClassName] <- {}
	player.s.lastStaggerTime <- 0
}


// TODO: There should be an equivalent function for pilots
TitanLoadoutDef function ApplyTitanLoadoutModifiers( entity player, TitanLoadoutDef loadout )
{
	return loadout
}

void function Titan_OnPlayerDeath( entity player, var damageInfo )
{
	player.p.storedWeapons.clear()
}

bool function PlayerCanEject( entity player )
{
	if ( !IsAlive( player ) )
		return false

	if ( !player.IsTitan() )
		return false

	if ( Riff_TitanExitEnabled() == eTitanExitEnabled.Never )
		return false

	//if ( !CanDisembark( player ) )
	//	return false

	if ( IsPlayerDisembarking( player ) )
		return false

	if ( TitanEjectIsDisabled() )
		return false

	return true
}

bool function ClientCommand_TitanEject( entity player, array<string> args )
{
	if ( !PlayerCanEject( player ) )
		return true

	int ejectPressCount = args[ 0 ].tointeger()
	if ( ejectPressCount < 3 )
		return true

	thread TitanEjectPlayer( player )
	return true
}