Source Entities:Entity pages
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.
- Code class
- Classname (You probably want this one)
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:
- https://github.com/ValveSoftware/source-sdk-2013/ - Source 2013 Multiplayer (and Singleplayer). The code in it is mainly for Half-Life 2 and episodes. Not as complete as some other repos, but it's the most up to date code available for some games.
- https://github.com/VSES/SourceEngine2007/ - Source 2007 games. This repo has a lot of code in it, but take it with a grain of salt cause it's far from up-to-date, especially regarding TF2.
- Half-Life 2
- Episodic
- Lost Coast
- HL2DM
- DODS
- CSS
- Portal
- TF2
- Misc. including HL2: Episode 3, HL:S, unfinished TFC port.
- https://github.com/NicolasDe/AlienSwarm/ - This is simply a copy of the code that ASW is bundled with. Handy if you don't have that game downloaded. Also has a few bits from L4D1/2 and HL2: Episode 3.
- https://github.com/raxxor45/ValveSecurity/ - Has most of the same stuff you'll find in the VSES SourceEngine2007 leak, but we do know it has some previously unknown SDK tools.
- https://github.com/perilouswithadollarsign/cstrike15_src/ - CS:GO code from 2017 (yes, that code).
- https://github.com/TheAlePower/TeamFortress2/ - TF2 code from 2017.
- https://github.com/ValveSoftware/halflife/ - Valve's official repo for GoldSrc games. Has code for HL (not expansions), Ricochet, and Deathmatch Classic.
- https://github.com/sigsegv-mvm/mvm-reversed/blob/master/Useful/classgraph-l4d2/ServerLinux-server_srv.txt - A list of almost every c++ class in Left 4 Dead 2 and what they inherit. Made before the last stand update. Same repo also has a list for L4D1.
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.
- Download and install Source.Python in your game or dedicated server.
- Make a folder at
[mod folder]/addons/source-python/plugins/classfinder
. - Put this file inside the classfinder folder.
- 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. - 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. - Load up a map in the game/server.
- 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]
- Classname pages with info (e.g. info_target): Add a category for the parent class of the one the entity is tied to. (For example, info_target's class is CInfoTarget, which inherits CPointEntity, so add
[[Category:CPointEntity]]
) Internal entities don't have associated classes, so skip this category for them. Also try to add a category for what the entity is for, such as Category:VFX. Some entities will fit into multiple categories or none, so it's okay to have none or multiple of these categories. Other categories such as Category:Entities are automatically added by templates. - Class pages with info (e.g. CBaseAnimating): None. Category:Code classes is automatically added by Template:Class.
- Class categories (e.g. Category:CBaseCombatCharacter): Add one for the class it inherits from. If it inherits from different classes in different games, add a category for each one.
- Classname pages redirecting to class pages (e.g. weapon_cs_base): Add the categories that Template:Entity would usually add, like Category:Entities, Category:Point entities, Category:Source base entities, and so on, and try to add a category for what the entity is for, such as Category:VFX. Do not add a class category.
- Class pages redirecting to classname pages (e.g. CNPC_Alyx): Add Category:Code classes only.
- Combination class and classname pages (e.g. Boomer): Treat it like both at once. Add Category:Code classes and any categories that would normally be added to a classname page containing info.