You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/class-reference.md
+31-25Lines changed: 31 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,8 +17,12 @@ These classes enable various Trenchbroom features for use in your game.
17
17
18
18
## TrenchbroomTag
19
19
20
+
A matching filter that identifies type of brushes and textures and applies in-editor appearance. Does not affect in-game appearance or in-game functionality.
21
+
20
22
**Tag Name**
21
23
24
+
Name to describe this tag. Not used as the matching pattern.
25
+
22
26
**Tag Attributes**
23
27
24
28
An array of strings determining the in-editor appearance of brushes/faces that match this tag.
@@ -72,11 +76,11 @@ A list of all [FGD](entities/fgd.md) files to include in the [Game Definition](e
72
76
73
77
**Brush Tags**
74
78
75
-
A lookup pattern for all brush entity classnames in the map to apply editor hints, such as `_transparent`.
79
+
A lookup pattern for all brush entity classnames in the map to apply editor hints, such as `_transparent`. Only affects appearance in Trenchbroom, does not apply to making materials transparent in Godot.
76
80
77
81
**Face Tags**
78
82
79
-
A lookup pattern for all texture names in the map to apply editor hints, such as `_transparent`.
83
+
A lookup pattern for all texture names in the map to apply editor hints, such as `_transparent`. Only affects appearance in Trenchbroom, does not apply to making materials transparent in Godot.
80
84
81
85
**Face Attrib Surface Flag**
82
86
@@ -130,6 +134,10 @@ All base classes placed here will give the same class properties, meta propertie
130
134
131
135
**Class Properties** - A dictionary of properties.
132
136
137
+
Keys must be of type String. Keys are read as the property name in Trenchbroom.
138
+
139
+
Values must be of the following types:
140
+
133
141
Once exported to the Trenchbroom game config, the dictionary values are written by editing entities in Trenchbroom, and read by accessing `properties` on a QodotEntity once the map is built.
134
142
135
143
You can also set default values for your properties by repeating this process in Meta Properties, matching the key names and value datatypes from this dictionary.
@@ -138,25 +146,27 @@ You can also set default values for your properties by repeating this process in
138
146
139
147
Ensure the description's key matches the property's key. Description values can only be strings.
140
148
141
-
**Meta Properties** - Editor-specific properties, such as the default color and size used to represent this class.
149
+
**Meta Properties** - Editor-specific properties, such as the default color and size used to represent this class. Primarily used by point classes.
142
150
143
-
Add an entry with a matching key to an existing property, set the value to the same data type, and whatever value is present will become the default. Only one meta property is read per class property.
151
+
Keys must be of type String. Values must be a type determined by the key name.
152
+
153
+
Possible key/value pairs include:
154
+
| Key String | Value type |
155
+
|------|-----|
156
+
| size | AABB |
157
+
| color | Color |
144
158
145
159
**Node Class** - The type of Godot node to spawn at this location.
146
160
147
161
### QodotFGDPointClass
148
162
163
+
A single point for an entity.
164
+
149
165
**Scene File** - The .tscn Godot scene that spawns in place of QodotEntity. The easiest way to spawn a specific node at a specific point.
150
166
151
167
Scene File takes priority over every other option here, especially if there's already a script attached to the .tscn file.
152
168
153
-
**Script Class** - The script to attach to your entity's root node.
154
-
155
-
This is ideal for spawning nodes without a .tscn file. If you want to access this entities' Class Properties, add a script here that `extends QodotMap` and accesses `properties["key_name"]`.
156
-
157
-
You can extend other Spatial-derived node types too, and add necessary children (CollisionShape, MeshInstance) through code, but you lose out on the ablity to access `properties`. You can fix this by always choosing to extend `QodotEntity` and adding more complex nodes like Area and RigidBody as children through code.
158
-
159
-
Make sure to update Node Class so it matches the the script's `extends`!
169
+
**Script Class** - The script to attach to your entity's root node. See [Scripting Entities](entities/scripting-entities) for details.
160
170
161
171
**Node Class** - The type of node to spawn at this location. This property should match the `extends` of your Script Class. You can ignore this property if you're using a Scene File.
162
172
@@ -168,7 +178,7 @@ You can get around this by extending `QodotEntity` and using `var body = RigidBo
168
178
169
179
### QodotFGDSolidClass
170
180
171
-
Solid classes can have multiple brushes (select multiple brushes when making the entity) so these properties apply to the solid class as a single object, not to each brush individually.
181
+
Solid classes can have multiple brushes (select multiple brushes before creating the entity). These properties apply to the solid class as a single node, with each brush built as one CollisionShape child.
172
182
173
183
**Spawn Type** - Changes how the QodotMap arranges these brushes in its node hierarchy.
174
184
@@ -178,26 +188,24 @@ There are 4 settings:
178
188
- Entity
179
189
- Group
180
190
181
-
**Build Visuals** - Makes the solid class visible when checked.
191
+
Worldspawn contributes this entity's brushes to a primary StaticBody node. Intended for the Worldspawn definition only.
192
+
193
+
Worldspawn contributes this entity's brushes to a primary StaticBody node without overriding the original definition of Worldspawn.
182
194
183
-
You may want to disable this for invisible triggers and other gameplay-related solid classes.
195
+
Group separates brushes into a new StaticBody node. Intended for grouped brushes.
184
196
185
-
**Node Class** - Sets the node type of the solid class root.
197
+
Entity separates brushes into a node separate from the primary StaticBody, supporting scripts and CollisionObject node types.
186
198
187
-
If you're adding a Script Class, this value should match the `extends` of the script.
199
+
**Build Visuals** - Builds a MeshInstance child for the solid class when checked. Does not build a MeshInstance child when unchecked.
188
200
189
-
Setting this to RigidBody and setting Spawn Type to Entity changes these brushes from static geometry into physics objects.
201
+
**Node Class** - Sets the node type of the solid class root. If you're adding a Script Class, this value should match the `extends` of the script. See [Scripting Entities](entities/scripting-entities).
190
202
191
-
**Collision Shape Type** - Changes how collision is built.
203
+
**Collision Shape Type** - Changes the type of CollisionShape resource used for CollisionShape children.
192
204
193
205
- None
194
206
- Convex
195
207
- Concave
196
208
197
-
Convex creations a CollisionShape for each brush, depending on the Spawn Type. Entity creates an outer hull, Group creates individual shapes for each brush. Convex is a good bet for most situations.
198
-
199
-
Concave allows for concave brush geometry, or if you chose Entity and want a single concave CollisionShape to make up your solid class. 🚧
200
-
201
209
**Script Class** - The script applied to the entity's root.
202
210
203
211
Although `QodotFGDSolidClass` is a class you can extend from, this is meant as a Qodot internal to build solid classes. This does not extend QodotEntity, and will not give you access to `properties`.
@@ -226,9 +234,7 @@ You can define properties for entities in the Class Properties dictionary. The "
226
234
227
235
## Note on Arrays
228
236
229
-
When you add an Array as a class property, it must contain other Arrays, with each Array creating one flag. These flag Arrays must have 3 items: Name, Value, and Default value.
230
-
231
-
Name must be a String.
237
+
Arrays create flags. When you add an Array as a class property, it must contain other Arrays, each Array creating one flag. These flag Arrays must have 3 items: Name, Value, and Default value. Name must be a String.
232
238
233
239
Value is traditionally a bool, but it can also be a float, int, or String. Qodot parses all these data types as Strings in the end, which will change how you will be [Accessing Class Properties in Code](#accessing-class-properties-in-code).
0 commit comments