Skip to content

Commit

Permalink
chore: adds some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
OctoD committed May 27, 2024
1 parent 503299f commit 5fdd7eb
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ This addon is part of the Godot Gameplay Systems (GGS). It provides a tagging sy

You can either download this addon from the asset-store inside the Godot editor or download it from the releases page and install it manually.

## Documentation

Go and read the [documentation](docs/readme.md) to learn how to use this addon. It's very simple and easy to use.

## Working on the source

If you want to work on the source, you can clone this repository, and start building the code.
Expand Down
45 changes: 45 additions & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Godot Gameplay Tags
===================

This addon is a simple way to add tags to your nodes and query them later.

## How does it work

This addon handles the `meta` property gracefully to manage tags in your nodes. This way, you can assign tags to your nodes and query them later.

Each tagged node is added to a specific group, so you can use the Godot's built-in group system to query the nodes (but this is facilitated by the `TagManager` singleton).

## How to use this addon

You can use two different approaches to handle tags to your nodes:

- Create one or more TagDictionary resources and assign the tags to your nodes.
- Handle the tags directly to your nodes with scripts.
- Do both.

## Creating a TagDictionary

To create a TagDictionary, you have to create a new resource in the Godot editor. You can do this by right-clicking on the FileSystem dock and selecting `New Resource` -> `TagDictionary`.

Once created, you can add tags to the dictionary by clicking on the `+` (Add Tag) button in the `TagDictionary` category.

To assign one or more tags, select one or more nodes and in the inspector click the `Node tags` tab, then select all the tags you want to assign to the nodes.

## Handling tags with scripts

To add, update, remove or check if a node is tagged, you can use the `TagManager` singleton.

This singleton, has several methods to help you manage the tags of your nodes:

| Method | Description |
|--------|-------------|
| `add_tag(node: Node, tag: StringName) -> void` | Adds a single tag to a node. |
| `add_tags(node: Node, tags: PackedStringArray) -> void` | Adds multiple tags to a node. |
| `get_tagged_nodes(target: Node) -> Array[Node]` | Gets all the nodes that have tags assigned under the target node. |
| `get_tags(target: Node) -> PackedStringArray` | Gets all the tags assigned to a node. |
| `has_all_tags(tags: PackedStringArray, target: Node) -> bool` | Checks if a node has all the tags assigned. |
| `has_some_tags(tags: PackedStringArray, target: Node) -> bool` | Checks if a node has at least one of the tags assigned. |
| `has_none_tags(tags: PackedStringArray, target: Node) -> bool` | Checks if a node has none of the tags assigned. |
| `remove_tag(tag: GString, target: Node)` | Removes a single tag from a node. |
| `remove_tags(tags: PackedStringArray, target: Node)` | Removes multiple tags from a node. |
| `set_tags(tags: PackedStringArray, target: Node)` | Sets the tags of a node, removing the previous ones. |
4 changes: 3 additions & 1 deletion godot/.gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
*.import export-ignore
icon.svg export-ignore
project.godot export-ignore
examples export-ignore
examples export-ignore
docs export-ignore
roadmap.md export-ignore
6 changes: 6 additions & 0 deletions roadmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Next releases features

- CSV import/export/update
- JSON import/export/update
- `MultiplayerTagUpdate`
- Tags table manager, to manage tags in a table view and check the nodes that have the tags assigned.

0 comments on commit 5fdd7eb

Please sign in to comment.