From 9a96d0bff56f1969c68bb52a2f33296095bdc67d Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Tue, 31 Aug 2021 23:14:58 +0100 Subject: move to new mod format --- .../mod/scripts/vscripts/mp/_spawn_functions.nut | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Northstar.CustomServers/mod/scripts/vscripts/mp/_spawn_functions.nut (limited to 'Northstar.CustomServers/mod/scripts/vscripts/mp/_spawn_functions.nut') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_spawn_functions.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_spawn_functions.nut new file mode 100644 index 000000000..3d9b84f3a --- /dev/null +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_spawn_functions.nut @@ -0,0 +1,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() ) +} \ No newline at end of file -- cgit v1.2.3