Skip to content

Commit

Permalink
Merge pull request #303 from MASSHUU12/v1.30.0-beta
Browse files Browse the repository at this point in the history
v1.30.0-beta
  • Loading branch information
MASSHUU12 authored Jul 11, 2024
2 parents 5c3b8ad + 9f9e12e commit 2b30469
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 73 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

All notable changes to this project will be documented in this file.

## [Unreleased]
## [1.30.0-beta 2024-07-11]

### Added

- 'run' argument to 'qc' command.
- 'enum' type.
- HistoryComponent
- HistoryComponent.

### Changed

- Reworked type system.
- Updated documentation for automatic input validation.
- Updated documentation.
- Changed indentation to spaces.
- CommandInputAttribute throws ArgumentException/ArgumentNullException
when passed type definition is invalid.
Expand Down
9 changes: 5 additions & 4 deletions addons/yat/docs/BUILTIN_COMMANDS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div align="center">
<h3>Builtin commands</h1>
<p>Here you can find information about builtin commands.</p>
<h3>Builtin commands</h1>
<p>Here you can find information about builtin commands.</p>
</div>

> [!NOTE]
> To disable the built-in command, just comment it out in the [RegisteredCommands](../src/scenes/registered_commands/RegisteredCommands.cs) file in the `RegisterBuiltinCommands` method.
>
> More information about each command can be found in their manuals.
| Command | Alias | Description |
Expand All @@ -20,7 +20,6 @@
| list | lc | List all available commands. |
| view | N/A | Changes the rendering mode of the viewport. |
| set | N/A | Sets a variable to a value. Does nothing by default, requires adding extensions. |
| watch | N/A | Runs user-defined (not threaded) commands at regular intervals. |
| history | hist | Manages the command history of the current session. |
| cat | N/A | Prints content of a file. |
| cowsay | N/A | Make a cow say something. |
Expand Down Expand Up @@ -49,3 +48,5 @@
| tfs | N/A | Toggles the full screen mode. |
| sr | N/A | Set the screen resolution. |
| lcr | N/A | Shows the result of the last command. |

<!-- | watch | N/A | Runs user-defined (not threaded) commands at regular intervals. | -->
14 changes: 7 additions & 7 deletions addons/yat/docs/CREATING_COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
To create a command, you need to create C# file and implement `ICommand` interface with `Command` attribute.

The `Command` attribute accepts the command `name`, and optionally its `description`, `manual` and `aliases`.
The `Command` attribute accepts the command **name**, and optionally its **description**, **manual** and **aliases**.
For description and manual, you can also use `Description` and `Usage` attributes.
The description and manual/usage have BBCode support.

If you do not specify **manual** or **Usage** it'll be automatically generated based on arguments.

The execution of the command begins in the `Execute` method.
The `Execute` method accepts `CommandData`, which contains probably all the things your command could ever need, these are things like: reference to YAT and BaseTerminal, raw arguments & options, converted arguments & options, cancellation token and more.
The execution of the command begins in the **Execute** method.
The **Execute** method accepts **CommandData**, which contains probably all the things your command could ever need, these are things like: reference to YAT and BaseTerminal, raw arguments & options, converted arguments & options, cancellation token and more.

Each created command, at the end of its operation, must return a status and an optional message with which it finished. You can create it yourself, or use one of the static methods of the ICommand interface, such as Success(), or Failure().
Each created command, at the end of its operation, must return a status and an optional message with which it finished. You can create it yourself, or use one of the static methods of the `ICommand` interface, such as **Success()**, or **Failure()**.

> [!NOTE]
> Each time a command is called, a new instance of it is created.
>
> If you want to maintain state between instances, for example, use static variables.
> If you want to maintain state between instances, you can use static variables.
As an example, let's look at Cls command:

Expand Down Expand Up @@ -52,13 +52,13 @@ public sealed class Cls : ICommand
> Using engine features via a command running on a separate thread can be problematic.
>
> Fortunately, rather most errors can be circumvented by using:
> CallDeferred, CallThreadSafe or CallDeferredThreadGroup.
> **CallDeferred**, **CallThreadSafe** or **CallDeferredThreadGroup**.
Creating a command that runs on a separate thread looks very similar to creating a regular command.

Therefore, first create a regular command and then add a `Threaded` attribute to it, which allows it to run on a separate thread.

In the passed `CommandData` you can find the `CancellationToken` which indicates when the command was asked to terminate prematurely.
In the passed **CommandData** you can find the **CancellationToken** which indicates when the command was asked to terminate prematurely.

### Overridable methods

Expand Down
16 changes: 8 additions & 8 deletions addons/yat/docs/CUSTOM_WINDOWS.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<div align="center">
<h3>Custom windows</h1>
<p>Here you can find information on creating custom windows for YAT commands.</p>
<h3>Custom windows</h1>
<p>Here you can find information on creating custom windows for YAT commands.</p>
</div>

### Custom windows

YAT internally uses the `YatWindow` node to create windows.
If you want to create your own windows for your commands, I recommend creating them by inheriting from `YatWindow`.
If you want to create your own windows for your commands, it's recommended to create them by inheriting from **YatWindow**.

This way, the window will behave similarly to native windows and its appearance will be consistent, plus you will get access to many additional out-of-the-box features.

Any windows should be added to `Yat.Windows` for order and clarity.
Any windows should be added to **Yat.Windows** for order and clarity.

You can add your window this way:

```csharp
```cs
Yat.Windows.AddChild(_yourWindow);
```

### Scaling with the main viewport

The `YatWindow` is able to scale to always contain itself in the `main viewport`.
To use this functionality, all you need to do is to use `base._Ready();` in the `_Ready` method of your window.
The **YatWindow** is able to scale to always contain itself in the main viewport.
To use this functionality, all you need to do is to use **base._Ready()** in the **_Ready** method of your window.

Using the variable `ViewportEdgeOffset` you can adjust how much the YatWindow will be smaller than the main viewport.
Using the variable **ViewportEdgeOffset** you can adjust how much the window will be smaller than the main viewport.
2 changes: 1 addition & 1 deletion addons/yat/docs/QUICK_COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p>Quick Commands are user-defined command prompts.</p>
</div>

> Quick Commands are saved in user://yat_qc.tres
> Quick Commands are saved in **user://yat_qc.tres**
### Managing Quick Commands

Expand Down
10 changes: 5 additions & 5 deletions addons/yat/docs/TERMINAL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<h3>Terminal</h1>
<p>Here you will find information on the operation of the terminal.</p>
<h3>Terminal</h1>
<p>Here you will find information on the operation of the terminal.</p>
</div>

### Aborting the command
Expand All @@ -9,13 +9,13 @@
>
> Whether and when the command terminates depends on the command and whether it respects the request.
Interrupting a command is possible only if it runs on a `separate thread` (and if its work does not end in a fraction of a second).
Interrupting a command is possible only if it runs on a **separate thread** (and if its work does not end in a fraction of a second).

To terminate the command you must use the keybinding `yat_terminal_interrupt`.
To terminate the command you must use the keybinding **yat_terminal_interrupt**.

### Context menu

YAT uses the keybinding `yat_context_menu` to launch the context menu.
YAT uses the keybinding **yat_context_menu** to launch the context menu.

### Signals

Expand Down
72 changes: 36 additions & 36 deletions addons/yat/docs/USAGE.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<div align="center">
<h3>Usage</h1>
<p>Here you can find information about using this extension and its basic configuration.</p>
<h3>Usage</h1>
<p>Here you can find information about using this extension and its basic configuration.</p>
</div>

## Getting started
### Getting started

To get started with YAT, you must first do two things:

### Create C# solution
#### Create C# solution

To create a C# solution in your project, you must select `Project > Tools > C# > Create C# solution` in the upper left corner of the window. This is a required action for any project created in C#.

### Configure .csproj
#### Configure .csproj

Unfortunately, the official template in the generated .csproj file is inadequate and cannot cope with more advanced projects, and as a result, several improvements need to be made to it.

Expand All @@ -34,50 +34,50 @@ This is the bare minimum that should be officially generated by Godot:

After performing these two actions, you can now compile the project and activate YAT.

## Keybindings
### Keybindings

YAT automatically adds the default actions and key bindings needed for the plugin to work properly.

All actions used have the prefix `yat`, so there should be no conflicts with actions specific to your project.
All actions used have the prefix **yat**, so there should be no conflicts with actions specific to your project.

You can find all the used actions below.

## YAT
### YAT

- `yat_terminal_toggle` - Toggles the state of the overlay.
- `yat_context_menu` - Allows to call the context menu.
- `yat_terminal_history_next` - Displays the next command from history.
- `yat_terminal_history_previous` - Displays the previous command from history.
- `yat_terminal_interrupt` - Used to stop command working on separate thread.
- `yat_terminal_autocompletion_next` - Used to display next suggestions from autocompletion.
- `yat_terminal_autocompletion_previous` - Used to display previous suggestions from autocompletion.
- `yat_terminal_close_full_window_display` - Used to close full window display.
- `yat_terminal_toggle` - Toggles the state of the overlay.
- `yat_context_menu` - Allows to call the context menu.
- `yat_terminal_history_next` - Displays the next command from history.
- `yat_terminal_history_previous` - Displays the previous command from history.
- `yat_terminal_interrupt` - Used to stop command working on separate thread.
- `yat_terminal_autocompletion_next` - Used to display next suggestions from autocompletion.
- `yat_terminal_autocompletion_previous` - Used to display previous suggestions from autocompletion.
- `yat_terminal_close_full_window_display` - Used to close full window display.

## Example
### Example

- `yat_example_player_move_left`
- `yat_example_player_move_right`
- `yat_example_player_move_forward`
- `yat_example_player_move_backward`
- `yat_example_player_move_left`
- `yat_example_player_move_right`
- `yat_example_player_move_forward`
- `yat_example_player_move_backward`

### Default keybindings
#### Default keybindings

- yat_terminal_toggle: `~`
- yat_terminal_interrupt: `Ctrl + C`
- yat_context_menu: `Right Mouse Button`
- yat_terminal_history_next: `Arrow Down`
- yat_terminal_history_previous: `Arrow Up`
- yat_terminal_autocompletion_next: `Tab`
- yat_terminal_autocompletion_previous: `Shift + Tab`
- yat_terminal_close_full_window_display: `Q`
- yat_terminal_toggle: `~`
- yat_terminal_interrupt: `Ctrl + C`
- yat_context_menu: `Right Mouse Button`
- yat_terminal_history_next: `Arrow Down`
- yat_terminal_history_previous: `Arrow Up`
- yat_terminal_autocompletion_next: `Tab`
- yat_terminal_autocompletion_previous: `Shift + Tab`
- yat_terminal_close_full_window_display: `Q`

#### Example
##### Example

- yat_example_player_move_left: `A`
- yat_example_player_move_right: `D`
- yat_example_player_move_forward: `W`
- yat_example_player_move_backward: `S`
- yat_example_player_move_left: `A`
- yat_example_player_move_right: `D`
- yat_example_player_move_forward: `W`
- yat_example_player_move_backward: `S`

## Script Templates
### Script Templates

YAT includes script templates that can be used as a base for creating new classes. They are available from Godot in the `Create Script` window.
16 changes: 8 additions & 8 deletions addons/yat/docs/YAT_ENABLE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<h3>YatEnable</h1>
<p>Here you can find information on the YatEnable functionality that allows you to restrict access to the terminal.</p>
<h3>YatEnable</h1>
<p>Here you can find information on the YatEnable functionality that allows you to restrict access to the terminal.</p>
</div>

<br />
Expand All @@ -9,20 +9,20 @@ If you don't want users to access the terminal, you can easily **block** access

Checking whether the requirements to allow access to YAT have been met is done only once during the startup of the plugin.

Requirements can be combined, when one of them is met YAT will become available.
Requirements can be combined, when **one** of them is met YAT will become available.

### File

You can set the terminal to become accessible only if the specified file (default `.yatenable`) is in the `user://` and/or `res://` directory.
You can set the terminal to become accessible only if the specified file (default ".yatenable") is in the **user://** and/or **res://** directory.

### CMD argument
### Terminal argument

The access restriction can also be lifted when the specified argument (default `--yat`) is passed to the executable file.
The access restriction can also be lifted when the specified argument (default "--yat") is passed to the executable file.

The argument can be passed this way:

```bash
```sh
my_awesome_game -- --yat
```

Note the two hyphens preceding the argument, without them it won't work.
Note the two hyphens preceding the argument, without them, it won't work because Godot will consume the input.
2 changes: 1 addition & 1 deletion addons/yat/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="YAT"
description="YAT is an addon that provides a customizable, in-game terminal for your Godot project. Currently in beta."
author="MASSHUU"
version="1.29.0-beta"
version="1.30.0-beta"
script="Plugin.cs"

0 comments on commit 2b30469

Please sign in to comment.