MCPcopy Create free account
hub / github.com/JACoders/OpenJK / NPC_ShySpawn

Function NPC_ShySpawn

code/game/NPC_spawn.cpp:1841–1866  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1839#define SHY_SPAWN_DISTANCE_SQR ( SHY_SPAWN_DISTANCE * SHY_SPAWN_DISTANCE )
1840
1841void NPC_ShySpawn( gentity_t *ent )
1842{
1843 ent->nextthink = level.time + SHY_THINK_TIME;
1844 ent->e_ThinkFunc = thinkF_NPC_ShySpawn;
1845
1846 if ( DistanceSquared( g_entities[0].currentOrigin, ent->currentOrigin ) <= SHY_SPAWN_DISTANCE_SQR )
1847 return;
1848
1849 if ( (InFOV( ent, &g_entities[0], 80, 64 )) ) // FIXME: hardcoded fov
1850 if ( (NPC_ClearLOS( &g_entities[0], ent->currentOrigin )) )
1851 return;
1852
1853 // 4/18/03 kef -- don't let guys spawn into other guys
1854 if (ent->spawnflags & 4096)
1855 {
1856 if (!NPC_SafeSpawn(ent, 64))
1857 {
1858 return;
1859 }
1860 }
1861
1862 ent->e_ThinkFunc = thinkF_NULL;
1863 ent->nextthink = 0;
1864
1865 NPC_Spawn_Go( ent );
1866}
1867
1868/*
1869-------------------------

Callers 1

NPC_SpawnFunction · 0.70

Calls 5

DistanceSquaredFunction · 0.85
NPC_SafeSpawnFunction · 0.85
InFOVFunction · 0.70
NPC_ClearLOSFunction · 0.70
NPC_Spawn_GoFunction · 0.70

Tested by

no test coverage detected