Nuclide
Software Development Kit for id Tech
Prop Data

Moving, interactive object properties. More...

Classes

struct  propdata_t
 Data holding PropData entries. More...
 
struct  breakModel_t
 Data holding BreakModel entries. More...
 

Enumerations

enum  propinfo_t {
  PROPINFO_HEALTH , PROPINFO_FLAGS , PROPINFO_DMG_BULLET , PROPINFO_DMG_MELEE ,
  PROPINFO_DMG_EXPLOSIVE , PROPINFO_EXPLOSIVE_DMG , PROPINFO_EXPLOSIVE_RADIUS , PROPINFO_BREAKMODEL ,
  PROPINFO_BREAKCOUNT , PROPINFO_SKIN , PROPINFO_MASS , PROPINFO_DAMPING_LINEAR ,
  PROPINFO_DAMPING_ANGULAR , PROPINFO_INERTIA , PROPINFO_VOLUME , PROPINFO_SURFACEPROP
}
 

Functions

void PropData_Init (void)
 
void PropData_Shutdown (void)
 
int PropData_Load (string)
 
int PropData_ForModel (string)
 
void PropData_SetStage (string)
 
int PropData_Finish (void)
 
__variant Prop_GetInfo (int, int)
 
void BreakModel_SpawnID (vector smins, vector smaxs, vector dir, float speed, int count, int index)
 
void BreakModel_Receive (void)
 
void BreakModel_ReceiveClientData (void)
 

Variables

var string g_curPropData
 
typedef enumflags
 
propdata_tg_propdata
 
int g_propdata_count
 
var hashtable g_hashpropdata
 
breakModel_tg_breakmodel
 
int g_breakmodel_count
 
int g_breakmodel_end
 
var hashtable g_hashbreakmodel
 

Detailed Description

Moving, interactive object properties.

Prop data

The prop data system was introduced in Source Engine 2004, it's been integrated into Nuclide and supported in a few different ways.

Overview

It allows you to easily create, without any programming knowledge, breakable props and entities.

That way, when you place prop_dynamic entities into the world for example, they will all have the same material, health and behavior when being interacted with.

Other entities, such as func_breakable can also take advantage of them.

Specs

According to Source SDK's propdata.txt we've got a kinda sorta hacky definition table for this stuff:

"PropData.txt"
{
"sometype"
{
// .. key/field attributes
// e.g.
"health" "10"
"breakable_model" "somematerial"
}
"BreakableModels"
{
// completely unrelated to types defined in propdata.txt
// but somehow still part of it?
"somematerial"
{
// model path / fadeout time pair
// e.g.
"foo.vvm" "2.5"
// but I also added
"foo.mdl#submodels=9" "5.0"
// where the # symbol notes that >9< submodels of the first
// submodel group will be chosen at random to represent 1 unit
// of the breakmodel collective
}
}
}

The idea is that props specify the type of prop they are ("sometype") and it defines a set of sensible defaults.

However, props can override any parts of this inside the model data itself. Currently no model format FTEQW supports allows for reading of said propdata. However we'll be loading "foobar.vvm.propdata" to remedy this for those.

Usage

Any entity in Nuclide that inherits NSSurfacePropEntity can take advantage of the propdata features.

Either the entity inside the map defines which propdata definition it wants to use (via the .propdata string field), or the model file has a text definition alongside as mentioned above.

Map entity key

An example for the example specification listed above would be a propdata key/value pair as part of the entity definition:

 {
   "classname" "func_wall"
   "model"     "*42"
   "propdata"  "sometype"
 }

Model propdata definition

If you had a model, e.g. located at models/foobar.vvm then if you were to place a file named models/foobar.vvm.propdata alongside it with the following contents:

 PropData.txt
 {
   prop_data
   {
     "health" "30"
     "breakable_model" "somematerial"
     "breakable_count" "10"
   }
 }

This registers an internal propdata definition with the name models/foobar.vvm.propdata** that would correspond to the above contents. You have to absolutely make sure that the model's .propdata file calls the data structure prop_data however, like described above.

You don't have to do anything else in the entity, the prop model will now have health of 30 and break into 'somematerial' upon its destruction.

Commands

Physics Object Commands

These are only relevant for when you want to use a phyics object, or rather an object that's handled by NSPhysicsEntity, such as prop_physics.

Enumeration Type Documentation

◆ propinfo_t

enum propinfo_t
Enumerator
PROPINFO_HEALTH 
PROPINFO_FLAGS 
PROPINFO_DMG_BULLET 
PROPINFO_DMG_MELEE 
PROPINFO_DMG_EXPLOSIVE 
PROPINFO_EXPLOSIVE_DMG 
PROPINFO_EXPLOSIVE_RADIUS 
PROPINFO_BREAKMODEL 
PROPINFO_BREAKCOUNT 
PROPINFO_SKIN 
PROPINFO_MASS 
PROPINFO_DAMPING_LINEAR 
PROPINFO_DAMPING_ANGULAR 
PROPINFO_INERTIA 
PROPINFO_VOLUME 
PROPINFO_SURFACEPROP 

Function Documentation

◆ BreakModel_Receive()

void BreakModel_Receive ( void  )

◆ BreakModel_ReceiveClientData()

void BreakModel_ReceiveClientData ( void  )

◆ BreakModel_SpawnID()

void BreakModel_SpawnID ( vector  smins,
vector  smaxs,
vector  dir,
float  speed,
int  count,
int  index 
)

◆ Prop_GetInfo()

__variant Prop_GetInfo ( int  i,
int  type 
)

◆ PropData_Finish()

int PropData_Finish ( void  )

◆ PropData_ForModel()

int PropData_ForModel ( string  modelname)

◆ PropData_Init()

void PropData_Init ( void  )

◆ PropData_Load()

int PropData_Load ( string  type)

◆ PropData_SetStage()

void PropData_SetStage ( string  type)

◆ PropData_Shutdown()

void PropData_Shutdown ( void  )

Variable Documentation

◆ enumflags

typedef enumflags
Initial value:
{
PDFL_BLOCKLOS,
PDFL_AIWALKABLE,
PDFL_ALLOWSTATIC
} propdataFlag_t

◆ g_breakmodel

breakModel_t* g_breakmodel

◆ g_breakmodel_count

int g_breakmodel_count

◆ g_breakmodel_end

int g_breakmodel_end

◆ g_curPropData

var string g_curPropData

◆ g_hashbreakmodel

var hashtable g_hashbreakmodel

◆ g_hashpropdata

var hashtable g_hashpropdata

◆ g_propdata

propdata_t* g_propdata

◆ g_propdata_count

int g_propdata_count