nuclide/Documentation/Prop_data.md

4.5 KiB

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

A global propdata definition file can be found at scripts/propdata.txt and it contains structures for types and a separate section titled BreakableModels. You can ignore the latter for now.

An example propdata.txt looks like this:

 "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"
     }
   }
 }

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

  • base : Which propdata fields to inherit.
  • blockLOS : Will this prop break the line-of-sight of NPCs?
  • AIWalkable : Can AI walk over this?
  • allow_static : Will static props use this definition?
  • dmg.bullets : Damage multiplier for bullets.
  • dmg.club : Damage multiplier for melee weapons.
  • dmg.explosive : Damage multiplier for explosive weapons.
  • health : Absolute amount of health on spawn.
  • explosive_damage : Makes the entity explosive, with specifying the max amount of damage.
  • explosive_radius : Sets the explosion radius in q units. Is 2.5 times the damage by default.
  • breakable_particle : Which particle effect to play when this entity breaks.
  • breakable_model : Which models to spawn when it breaks.
  • breakable_count : The amount of models it'll spawn upon breaking.
  • surfaceprop : 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 NSPhysicsEntity, such as prop_physics.

  • mass : Mass of the object, in kilograms.
  • volume : Volume of the object, in cubic meters.
  • inertia : Inertia multiplier.
  • damping : Linear movement damping multiplier.
  • rotdamping : Angular movement damping multiplier.