Skip to content

Entity Data

Nak edited this page Sep 12, 2022 · 3 revisions

Functions to retrieve the raw entity data from the BSP. Map-creators can store any type of data onto these entities.

*Note: I think BSPObject:FindInX functions are slower, than ents.FindInX as the engine use a grid system.

Returns Functions Description
Table BSPObject:GetEntity( Number index ) Returns the raw entity data said entity.
Table BSPObject:GetEntities() Returns a list of all entity-data for said map.
Table BSPObject:FindInSphere( Vector origin, Number radius ) Returns a list of entity data, within the specified sphere.
Table BSPObject:FindInBox( Vector boxMins, Vector boxMaxs ) Returns a list of entity data, within the specified box.
Table BSPObject:FindByName( String name ) Returns a list of entity data, matching the name ( targetname ).
Table BSPObject:FindByModel( String model ) Returns a list of entity data, matching the model.
Table BSPObject:FindByClass( String class ) Returns a list of entity data, matching the class.

Some data are automatically parsed: origin, angles, rendercolor and a few more.

Example of Entity[7] within gm_construct.bsp.

] lua_run PrintTable( NikNaks.CurrentMap:GetEntities()[7] )
> PrintTable( NikNaks.CurrentMap:GetEntities()[7] )...
_cone	=	40
_exponent	=	1
_inner_cone	=	30
_light	=	255 255 255 400
_lightHDR	=	-1 -1 -1 1
_lightscaleHDR	=	1
_quadratic_attn	=	1
angles	=	-90.000 0.000 0.000
classname	=	light_spot
hammerid	=	1199
origin	=	1600.000000 -448.000000 19.006701
pitch	=	-90
style	=	0

Nik Naks Wiki


Features:

Clone this wiki locally