Moving, interactive object properties.
More...
Moving, interactive object properties.
The prop data system was introduced in Source Engine 2004, it's been replicated by 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 entities such as prop_dynamic with a similar model into the world, they will all have the same material, health and behavior when being interacted with.
Any ncSurfacePropEntity can take advantage of its features.
Specs
Prop data is defined in Valve's VDF format, under scripts/propdata.txt
:
"PropData.txt"
{
"sometype"
{
"health" "10"
"breakable_model" "somematerial"
}
"BreakableModels"
{
"somematerial"
{
"foo.vvm" "2.5"
"foo.mdl#submodels=9" "5.0"
}
}
}
The idea is that props specify the type of prop they are ("sometype") and it defines a set of sensible defaults for them.
Usage
Any entity in Nuclide that inherits ncSurfacePropEntity can take advantage of the propdata features.
Either the entityDef or entity-data inside the map defines which definition it wants to use (via the "propdata" key), or the model file has a text definition alongside it.
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
- base <string>: Which propdata fields to inherit.
- blockLOS <bool>: Will this prop break the line-of-sight of NPCs?
- AIWalkable <bool>: Can AI walk over this?
- allow_static <bool>: Will static props use this definition?
- dmg.bullets <float>: Damage multiplier for bullets.
- dmg.club <float>: Damage multiplier for melee weapons.
- dmg.explosive <float>: Damage multiplier for explosive weapons.
- health <int>: Absolute amount of health on spawn.
- explosive_damage <int>: Makes the entity explosive, with <int> specifying the max amount of damage.
- explosive_radius <float>: Sets the explosion radius in q units. Is 2.5 times the damage by default.
- breakable_particle <string>: Which particle effect to play when this entity breaks.
- breakable_model <string>: Which models to spawn when it breaks.
- breakable_count <int>: The amount of models it'll spawn upon breaking.
- surfaceprop <string>: Surfaceprop override for the object.
Physics Object Commands
These are only relevant for when you want to use a phyics object, or rather an object that's handled by ncPhysicsEntity, such as prop_physics.
- mass <float>: Mass of the object, in kilograms.
- volume <float>: Volume of the object, in cubic meters.
- inertia <float>: Inertia multiplier.
- damping <float>: Linear movement damping multiplier.
- rotdamping <float>: Angular movement damping multiplier.
|
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
,
PROPINFO_DOLL
} |
|
◆ 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 |
| ) |
|
◆ 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 | |
PROPINFO_DOLL | |
◆ enumflags
Initial value:{
PDFL_BLOCKLOS,
PDFL_AIWALKABLE,
PDFL_ALLOWSTATIC
} propdataFlag_t
◆ g_breakmodel
◆ g_breakmodel_count
◆ g_breakmodel_end
◆ g_curPropData
◆ g_hashbreakmodel
var hashtable g_hashbreakmodel |
◆ g_hashpropdata
var hashtable g_hashpropdata |
◆ g_propdata
◆ g_propdata_count