aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/scripts/vscripts/mp/_spawn_functions.nut
blob: 3d9b84f3a061df73efcc5f18b54c7422e2fff0ae (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
untyped

global function SpawnFunctions_Init

function SpawnFunctions_Init()
{
	if ( IsLobby() )
		return

	// shared OnSpawned callbacks
	AddSpawnCallback( "script_mover",		SpawnScriptMover )
	AddSpawnCallback( "path_track", 		SpawnPathTrack )
	AddSpawnCallback( "info_hint", 		SpawnInfoHint )
	AddDeathCallback( "npc_titan", 					EmptyDeathCallback ) // so death info gets sent to client

	// Arc Cannon Targets
	foreach ( classname, val in ArcCannonTargetClassnames )
	{
		AddSpawnCallback( classname, AddToArcCannonTargets )
	}

	foreach ( classname, val in ProximityTargetClassnames )
	{
		AddSpawnCallback( classname, AddToProximityTargets )
	}
}

void function EmptyDeathCallback( entity _1, var _2 )
{
}


void function SpawnPathTrack( entity node )
{
	if ( node.HasKey( "WaitSignal" ) )
		RegisterSignal( node.kv.WaitSignal )

	if ( node.HasKey( "SendSignal" ) )
		RegisterSignal( node.kv.SendSignal )

	if ( node.HasKey( "WaitFlag" ) )
		FlagInit( expect string( node.kv.WaitFlag ) )

	if ( node.HasKey( "SetFlag" ) )
		FlagInit( expect string( node.kv.SetFlag ) )
}

void function SpawnScriptMover( entity ent )
{
	if ( ent.HasKey( "custom_health" ) )
	{
		//printt( "setting health on " + ent + " to " + ent.kv.custom_health.tointeger() )
		ent.SetHealth( ent.kv.custom_health.tointeger() )
	}
}

void function SpawnInfoHint( entity ent )
{
	Assert( !ent.HasKey( "hotspot" ) || ent.kv.hotspot.tolower() in level.hotspotHints, "info_hint at " + ent.GetOrigin() + " has unknown hotspot hint: " + ent.kv.hotspot.tolower() )
}