Custom ModelDoc nodes
You can make a custom ModelDoc node. This is useful for any gamemode-specific data you want to attach to specific models. These nodes are defined in C# code, and the FGD for these is automatically generated for you.
Generic Game Data
- Define a struct or class. Add the
ModelDoc.GameData
attribute.
Run your gamemode. The FGD for this node then gets auto-generated.
Assign the node in ModelDoc. If you don't know how to do that, you should probably read a ModelDoc guide like this one.
Now you can use this data in code like so.
4a. or like so, which automatically checks of the data exists:
Break Commands
Break commands are a more specific alternative to GenericGameData which allows code to be ran when an entity with a model that has given node breaks via the Breakables class, such as doors, physics props and others.
They work identically to GenericGameData but the class markup looks a little different:
The OnBreak
callback will be called automatically when an entity breaks and has a model with (in this case) break_create_particle
break command.
Other things you can do with this
There are multiple attributes that you can use in order to make your own custom designers/helpers:
ModelDoc.Axis
ModelDoc.Box
ModelDoc.Sphere
ModelDoc.Capsule
ModelDoc.Cylinder
ModelDoc.Line
ModelDoc.HandPose
ModelDoc.EditorWidget