aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/mp/_vr.nut
blob: b9759ddf5274c7b7c7a8ac24aec822c339b18a5c (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
untyped

global function VR_Init
global function VR_GroundTroopsDeathCallback

struct {
	string vr_settings = ""
} file

function VR_Init( string settings = "", bool enableDropships = false )
{
	if ( reloadingScripts )
		return

	if ( !enableDropships )
		FlagSet( "DisableDropships" )

	file.vr_settings = settings

	//AddDeathCallback( "npc_soldier", VR_GroundTroopsDeathCallback )
	//AddDeathCallback( "npc_spectre", VR_GroundTroopsDeathCallback )
	//AddDeathCallback( "npc_marvin", VR_GroundTroopsDeathCallback )
	//AddDeathCallback( "player", VR_GroundTroopsDeathCallback )
	AddCallback_EntitiesDidLoad( EntitiesDidLoad )
}

void function EntitiesDidLoad()
{
	if ( file.vr_settings.find( "no_evac" ) != null )
		svGlobal.evacEnabled = false

	if ( file.vr_settings.find( "no_npc" ) != null )
	{
		disable_npcs()
	}

	if ( file.vr_settings.find( "no_titan" ) != null )
	{
		Riff_ForceTitanAvailability( eTitanAvailability.Never )
		FlagSet( "PilotBot" )
	}
}

void function VR_GroundTroopsDeathCallback( entity guy, var damageInfo )
{
	EmitSoundAtPosition( TEAM_UNASSIGNED, guy.GetOrigin(), "Object_Dissolve" )

	if ( ShouldDoDissolveDeath( guy, damageInfo ) )
		guy.Dissolve( ENTITY_DISSOLVE_CHAR, Vector( 0, 0, 0 ), 0 )
}

function ShouldDoDissolveDeath( guy, damageInfo )
{
	if ( !guy.IsPlayer() )
		return true

	// can't dissolve players when they're not playing the game, otherwise when the game starts again they're invisible
	local gs = GetGameState()
	if ( gs != eGameState.Playing && gs != eGameState.SuddenDeath && gs != eGameState.Epilogue )
	{
		printt( "Skipping player dissolve death because game is not active ( player:", guy, ")" )
		return false
	}

	return true
}