Source Entities:Entity pages

From Source Entities
Jump to navigation Jump to search

Src Ents has a pretty complex system for documenting entities. Do note that every entity will have a page for the classname, and a page for the code class. (don't freak out, it's actually not that bad)

First, are you making a page for the code class or the classname? Your exact answer to this question might change, depending on the answer to the next.

The rest of this page is a small FAQ devoted to answering some questions editors may have.

How can I find entity info if it's not in the FGDs?[edit source]

Logically, search in code. Here's some public code repos:

To find the code class associated with an entity, look for a macro called LINK_ENTITY_TO_CLASS. It will have the classname and the code class next to each other.

To find what class another class inherits from, search for "class CMyClass public". Be careful cause sometimes multiple classes will be listed even though they aren't "entity" classes.

The bulk of the data we need will be in what's called the data description. Find this by looking for the BEGIN_DATADESC() macro. This will not include some keyvalues. Be sure to also check for anything under the function KeyValue() if it exists. If both of these are missing, the entity or class very likely doesn't have any keyvalues, inputs, or outputs unique to it. Flags are usually done like this:

#define	SF_ENVEXPLOSION_NODAMAGE	0x00000001 // when set, ENV_EXPLOSION will not actually inflict damage
#define	SF_ENVEXPLOSION_REPEATABLE	0x00000002 // can this entity be refired?
#define SF_ENVEXPLOSION_NOFIREBALL	0x00000004 // don't draw the fireball
#define SF_ENVEXPLOSION_NOSMOKE		0x00000008 // don't draw the smoke
#define SF_ENVEXPLOSION_NODECAL		0x00000010 // don't make a scorch mark
#define SF_ENVEXPLOSION_NOSPARKS	0x00000020 // don't make sparks
#define SF_ENVEXPLOSION_NOSOUND		0x00000040 // don't play explosion sound.

There's no standard way to define flags apparently, though this is the most common.

What if the game doesn't have public code?[edit source]

You'll need these. These will show you everything except for flags, and keyvalues that got defined through the KeyValue() method. We also have every stock FGD uploaded, so you can find info you need there as well if it's something not in the datamaps. Note: Classes shown next to classnames in datamaps are not necessarily accurate. The class it prints is always the highest one that's using the DECLARE_CLASS() macro, meaning it sometimes looks like it's implying weird things such as env_blood being tied to CBaseEntity, which is false and happens very infrequently. If it looks wrong, it probably is.

Source.Python method[edit source]

If at this point nothing has given you the name of the class an entity is tied to, including simply searching on google or opening server.dll in a text editor and looking for an appropriate-sounding class, (yes, I've really done that) there's one more method you can try. It's not too difficult, but it's relatively unoptimized at the moment and you have to work with it on a per-entity basis, which is okay since you'll almost never have to do this; roughly 1200 of the wiki's then 1800 entities were documented before this method had to be developed.

  1. Download and install Source.Python in your game or dedicated server.
  2. Make a folder at [mod folder]/addons/source-python/plugins/classfinder.
  3. Put this file inside the classfinder folder.
  4. If you're not using a dedicated server, (if you don't know what that is, you aren't using one) add -insecure in your launch options.
  5. Open classfinder.py in a text editor of your choice and change trigger_multiple on line 8 to the entity you want to find the class of.
  6. Load up a map in the game/server.
  7. Put sp plugin reload classfinder in the console. In the console you should see every class the entity inherits.

This method apparently does not work for some entities, such as boomer. This is probably because a select few entities aren't allowed to be spawned by most means. The classes reported have also rarely been seen to be inaccurate, such as with info_null.

How should I categorize the pages?[edit source]