Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions docs/entities/guides/fgd-helpers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
title: New FGD Helpers
weight: 5
features:
---

# New FGD Helpers

Strata Source provides new FGD helpers that can be used in FGD files to extend the functionality and visuals of entities when working with them in Hammer. Some helpers rely on parameter input by using an KeyValue (KV) entry to work or rely on various KVs existing so the helper can function.

> [!NOTE]
>
> FGD helpers need to be specified **before** the class name assignment for the entity.

## Strata FGD Helpers

* [`catapult()`](./fgd-helpers#catapult)
* [`direction(angle/vector)`](./fgd-helpers#directionanglevector)
* [`orientedboundingbox(width, height, depth)`](./fgd-helpers#orientedboundingboxwidth-height-depth)
* [`orientedboundingboxhalf(width, height, depth)`](./fgd-helpers#orientedboundingboxhalfwidth-height-depth)
* [`orientedwidthheight(width, height)`](./fgd-helpers#orientedwidthheightwidth-height)
* [`worldtext()`](./fgd-helpers#worldtext)

## catapult()

Typically used for `trigger_catapult`. Provides a preview of the launch arc of the launch by the trigger generated by other KVs. For the `catapult` FGD helper to properly render the launch preview, the KVs `playerspeed`, `physicsspeed`, `launchtarget`, `useExactVelocity`, and `exactvelocitychoicetype`, are needed whether that is from manually adding them to the entity class entree or inheriting the `trigger_catapult` class entree.

`catapult` produces three lines for the preview. `useExactVelocity` will change how these lines behave if set to `Yes`/`1`.

* Green: When `useExactVelocity` is `No`/`0` and `playerspeed` does not equal `physicsspeed` the green line will represent the predicted arc of the player as defined by `playerspeed`. When `useExactVelocity` is enabled, the green line represents the more exact launch arc. Another green line will go with this from the entity to the end of the arc.
* Yellow: The yellow line represents the predicted arc of physics objects as defined by `physicsspeed` as long as it doesn't equal `playerspeed`.

![Catapult Preview](../images/catapult_preview.png)

Preview when `useExactVelocity` is set to `Yes`/`1`.
![Catapult Preview Use Exact Velocity](../images/catapult_preview2.png)

## direction(angle/vector)

The `direction` helpers allows for adding a arrow which protrudes from the entities origin to visually show a direction based on a KV input. `angle` and `vector` KV types work for a parameter for `direction` but it's recommended to use `angle` so the arrow can be more easily set.

![Direction Preview](../images/direction_preview.png)

## orientedboundingbox(width, height, depth)

`orientedboundingbox` allows for displaying, as the name implies, an white Oriented Bounding Box at the entities origin that can be changed using KVs in the entity class entree. Using KVs named as `width`, `height`, and `depth` is not required but put here to represent what each parameter represents. The OBB will rotate with the entity.

Parameters:

* width: Defines the width size of the bounding box along the x-axis/red axis.
* depth: Defines the depth size of the bounding box along the y-axis/green axis.
* height: Defines the height size of the bounding box along the z-axis/blue axis.

![Oriented Bounding Box Preview](../images/obb_preview.png)

## orientedboundingboxhalf(width, height, depth)

Exact same as `orientedboundingbox` but halves the sizes specified.

Parameters:

* width: Defines the width size of the bounding box along the x-axis/red axis.
* depth: Defines the depth size of the bounding box along the y-axis/green axis.
* height: Defines the height size of the bounding box along the z-axis/blue axis.

## orientedwidthheight(width, height)

Similar to `orientedboundingbox` but for representing flat quads. This preview uses a green plane to represent the width which extends its height based on the height parameter along the z-axis.

Parameters:

* width: Defines the depth size of the bounding box along the y-axis/green axis.
* height: Defines the height size of the bounding box along the z-axis/blue axis.

![Quad Preview](../images/quad_preview.png)

## worldtext()

`worldtext` is used to display visible text within Hammer's 3D viewport. Originally this was used for `point_worldtext` to display text in Hammer to get a visual on how it looks in game, but has also been used for `hammer_notes` to provide visible text in Hammer only. `worldtext` relies on the `message` KV to know what text to display in Hammer.

![World Text Preview](../images/worldtext_preview.png)
58 changes: 58 additions & 0 deletions docs/entities/guides/fgd-intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
title: Strata FGDs
weight: 0
features:
---

# Strata Forge Game Data (FGD)

## Introduction

**Valve's Hammer Editor**, starting from when it was the **Worldcraft** editor, uses plain text files to tell the editor what entities are available for the editor to provide. These are seen when using the **Entity Tool** or when in the **Object Properties** window, choosing classnames under the drop down for standard entities or brush entities.

These plain text files are named Forge Game Data or FGD for short. Every FGD file used by Hammer ends with the `.fgd` extension and are usually located (for Strata titles specifically) in their respective `GAME` folder (`p2ce`, `momentum`, etc). FGDs can be loaded from anywhere as long as they are formatted correctly for Hammer.

> [!CAUTION]
>
> A misconception with FGDs are that they tell the engine about what entities exist and their KeyValues and I/O. ***This is not true.***
>
> While FGDs tell Hammer what entities do exist in the engine, the reverse does not apply. Adding an entity entry does not add this entity to the engine, and changing existing entities KeyValues or I/O will not change what KeyValves and I/O the engine has defined. While custom FGD entities can get compiled (depending on the type) into a BSP if placed in a VMF, the engine dictates what entities do and don't exist and what KeyValues and I/O they have. If the engine sees an entity which doesn't exist in code, it will ignore it and print a error in the console stating the fact.
>
> This point also applies to custom AngelScript entities. While custom AngelScript entities are not programmed in at a engine level, the engine will still try to find any registered AngelScript entities in the BSP and add them into the map.

While the Strata Source Wiki will provide basic details on how to add a FGD to Strata's Hammer, it will not explain every single available FGD helper, entity class type or property, I/O type, or KV type. Only specific Strata features will be documented here. If you wish to get a full list of what is available for FGDs, the [FGD page on the Valve Developer Community site](https://developer.valvesoftware.com/wiki/FGD) can provide details on lots of other pieces that can be used. Note that not everything will work with Strata Source's Hammer.

## Specific Strata FGD Features

* Custom Entity Flags: The `flags` KV type can now be used on other KVs besides `spawnflags`. This is a good alternative to `choices` if you have various choices and want multiple to be selected.

![Custom Flags FGD Implementation](../images/custom_flags_preview1.png)
![Custom Flags In Object Properties](../images/custom_flags_preview2.png)

* `soundscape` KV type: A new KV type similar to `sound` or `studio` that will give the option to open the **Soundscape Browser** for choosing soundscapes. This is generally used with `env_soundscape`.

![Soundscape Browser](../../general_images/soundscapebrowser.png)

* `bool` and `boolean`: KV types `bool` and `boolean` are both valid and interchangeable for FGD KVs.

* Escape Sequences: Escape sequences `\n` `\t` `\"` `\\` are supported in FGD KV descriptions and don't cause issues with VMFs.

* Additional FGD Helpers: Strata Source adds several FGD helpers to aid with working with entities in Hammer. [Check this article out to find out more](./fgd-helpers).

* Custom AngelScript Entities: Strata Source gives making custom entries in a FGD even better by allowing you to tie that entity to a custom scripted AngelScript entity.

## Adding An FGD to Hammer

While this process is very similar most other versions of Hammer, the UI has changed so details will still be supplied.

FGDs are added to your Hammer game configurations, these are located in the Hammer options via the menu bar near the top of the Hammer window under `Tools > Options`.

![Options Button](../../general_images/options_button.png)

From there, you can navigate using the side bar to `Game Configuration`. At the top is where used FGDs are listed under `Game data files`. To add an new FGD, simply click `Add...` on the right. To get to a existing FGD to edit, select an FGD in the list and click `Edit`. This will open the FGD file in your systems default text editor. To remove an FGD, select one in the list and click `Remove`, this will not remove the actual FGD file.

![Game Configuration](../../general_images/hammer_game_config.png)

## Additional Resources

* [FGD Helpers](./fgd-helpers)
6 changes: 3 additions & 3 deletions docs/entities/guides/portal-floor-button-triggers.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
title: Portal Floor Button Triggers
weight: 5
weight: 10
features:
- MOD_PORTAL2
---

# Portal Floor Button Triggers

The entities [`prop_floor_button`](../reference/prop_floor_button), [`prop_floor_cube_button`](../reference/prop_floor_button), [`prop_floor_ball_button`](../reference/prop_floor_ball_button) and [`prop_under_floor_button`](../reference/prop_under_floor_button) spawn a trigger volume to detect players and cubes.
Each entity uses a different bounding size to match the default model, but custom models may need their own size.
The entities [`prop_floor_button`](../reference/prop_floor_button), [`prop_floor_cube_button`](../reference/prop_floor_button), [`prop_floor_ball_button`](../reference/prop_floor_ball_button) and [`prop_under_floor_button`](../reference/prop_under_floor_button) spawn a trigger volume to detect players and cubes.
Each entity uses a different bounding size to match the default model, but custom models may need their own size.
To allow this, these entities look for a hitbox group named `trigger`, and match the size of this. For example, this is the equivalent QC section for a standard modern button:

```php
Expand Down
Binary file added docs/entities/images/catapult_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/entities/images/catapult_preview2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/entities/images/custom_flags_preview1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/entities/images/custom_flags_preview2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/entities/images/direction_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/entities/images/obb_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/entities/images/quad_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/entities/images/worldtext_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/general_images/hammer_game_config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/general_images/hammer_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/general_images/options_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/general_images/soundscapebrowser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.