├── addons └── yat │ ├── LICENSE │ ├── Plugin.cs │ ├── Plugin.cs.uid │ ├── README.md │ ├── assets │ └── fonts │ │ └── JetBrains_Mono │ │ ├── JetBrainsMono-Italic-VariableFont_wght.ttf │ │ ├── JetBrainsMono-Italic-VariableFont_wght.ttf.import │ │ ├── JetBrainsMono-VariableFont_wght.ttf │ │ ├── JetBrainsMono-VariableFont_wght.ttf.import │ │ └── OFL.txt │ ├── docs │ ├── .gdignore │ ├── AUTOMATIC_INPUT_VALIDATION.md │ ├── BUILTIN_COMMANDS.md │ ├── CALLING_METHODS_ON_NODES.md │ ├── CREATING_COMMANDS.md │ ├── CUSTOM_WINDOWS.md │ ├── QUICK_COMMANDS.md │ ├── TERMINAL.md │ ├── USAGE.md │ ├── YAT_ENABLE.md │ ├── assets │ │ └── yat_icon_baner.png │ └── classes │ │ ├── BaseTerminal.md │ │ ├── Extensible.md │ │ ├── FullWindowDisplay.md │ │ ├── Input.md │ │ ├── Output.md │ │ ├── Parser.md │ │ ├── Reflection.md │ │ ├── RegisteredCommands.md │ │ ├── Scene.md │ │ ├── Storage.md │ │ ├── YAT.md │ │ └── YatWindow.md │ ├── plugin.cfg │ └── src │ ├── Debug │ ├── CpuInfoItem.cs │ ├── CpuInfoItem.cs.uid │ ├── DebugScreen.cs │ ├── DebugScreen.cs.uid │ ├── DebugScreen.tscn │ ├── DebugScreenItem.cs │ ├── DebugScreenItem.cs.uid │ ├── EngineInfoItem.cs │ ├── EngineInfoItem.cs.uid │ ├── FpsItem.cs │ ├── FpsItem.cs.uid │ ├── GpuInfoItem.cs │ ├── GpuInfoItem.cs.uid │ ├── LookingAtInfo.cs │ ├── LookingAtInfo.cs.uid │ ├── MemoryInfoItem.cs │ ├── MemoryInfoItem.cs.uid │ ├── OsInfoItem.cs │ ├── OsInfoItem.cs.uid │ ├── SceneObjectsInfo.cs │ ├── SceneObjectsInfo.cs.uid │ └── yat_debug_screen_theme.tres │ ├── Net │ ├── EConnectionStatus.cs │ ├── EConnectionStatus.cs.uid │ ├── Networking.cs │ ├── Networking.cs.uid │ ├── NetworkingOptions.cs │ └── NetworkingOptions.cs.uid │ ├── Update │ ├── Release.cs │ ├── Release.cs.uid │ ├── ReleaseTagInfo.cs │ ├── ReleaseTagInfo.cs.uid │ ├── SemanticVersion.cs │ ├── SemanticVersion.cs.uid │ ├── Updater.cs │ ├── Updater.cs.uid │ ├── UpdaterWindow.cs │ ├── UpdaterWindow.cs.uid │ └── UpdaterWindow.tscn │ ├── YAT.cs │ ├── YAT.cs.uid │ ├── YAT.tscn │ ├── attributes │ ├── ArgumentAttribute.cs │ ├── ArgumentAttribute.cs.uid │ ├── CommandAttribute.cs │ ├── CommandAttribute.cs.uid │ ├── CommandInputAttribute.cs │ ├── CommandInputAttribute.cs.uid │ ├── DescriptionAttribute.cs │ ├── DescriptionAttribute.cs.uid │ ├── ExtensionAttribute.cs │ ├── ExtensionAttribute.cs.uid │ ├── IgnoreAttribute.cs │ ├── IgnoreAttribute.cs.uid │ ├── NoValidateAttribute.cs │ ├── NoValidateAttribute.cs.uid │ ├── OptionAttribute.cs │ ├── OptionAttribute.cs.uid │ ├── ThreadedAttribute.cs │ ├── ThreadedAttribute.cs.uid │ ├── TitleAttribute.cs │ ├── TitleAttribute.cs.uid │ ├── UsageAttribute.cs │ └── UsageAttribute.cs.uid │ ├── classes │ ├── CommandType.cs │ ├── CommandType.cs.uid │ ├── CommandTypeEnum.cs │ ├── CommandTypeEnum.cs.uid │ ├── CommandTypeRanged.cs │ ├── CommandTypeRanged.cs.uid │ ├── Extensible.cs │ ├── Extensible.cs.uid │ ├── LruCache.cs │ ├── LruCache.cs.uid │ ├── Parser.cs │ ├── Parser.cs.uid │ ├── Pipeline.cs │ ├── Pipeline.cs.uid │ ├── clipboard │ │ ├── Clipboard.cs │ │ ├── Clipboard.cs.uid │ │ └── CopyImageToClipboard.ps1 │ └── managers │ │ ├── command_manager │ │ ├── CommandManager.cs │ │ ├── CommandManager.cs.uid │ │ └── CommandManager.tscn │ │ └── preferences_manager │ │ ├── PreferencesManager.cs │ │ ├── PreferencesManager.cs.uid │ │ └── PreferencesManager.tscn │ ├── commands │ ├── Cat.cs │ ├── Cat.cs.uid │ ├── CheckUpdate.cs │ ├── CheckUpdate.cs.uid │ ├── Cls.cs │ ├── Cls.cs.uid │ ├── Cn.cs │ ├── Cn.cs.uid │ ├── Cowsay.cs │ ├── Cowsay.cs.uid │ ├── Crash.cs │ ├── Crash.cs.uid │ ├── Cs.cs │ ├── Cs.cs.uid │ ├── Dollar.cs │ ├── Dollar.cs.uid │ ├── Ds.cs │ ├── Ds.cs.uid │ ├── Echo.cs │ ├── Echo.cs.uid │ ├── Forcegc.cs │ ├── Forcegc.cs.uid │ ├── Fov.cs │ ├── Fov.cs.uid │ ├── History.cs │ ├── History.cs.uid │ ├── Inspect.cs │ ├── Inspect.cs.uid │ ├── Ip.cs │ ├── Ip.cs.uid │ ├── Lcr.cs │ ├── Lcr.cs.uid │ ├── List.cs │ ├── List.cs.uid │ ├── Load.cs │ ├── Load.cs.uid │ ├── Locale.cs │ ├── Locale.cs.uid │ ├── Ls.cs │ ├── Ls.cs.uid │ ├── Man.cs │ ├── Man.cs.uid │ ├── Pause.cs │ ├── Pause.cs.uid │ ├── Ping.cs │ ├── Ping.cs.uid │ ├── Preferences.cs │ ├── Preferences.cs.uid │ ├── QuickCommands.cs │ ├── QuickCommands.cs.uid │ ├── Quit.cs │ ├── Quit.cs.uid │ ├── Reset.cs │ ├── Reset.cs.uid │ ├── Restart.cs │ ├── Restart.cs.uid │ ├── Set.cs │ ├── Set.cs.uid │ ├── Sleep.cs │ ├── Sleep.cs.uid │ ├── Sr.cs │ ├── Sr.cs.uid │ ├── Ss.cs │ ├── Ss.cs.uid │ ├── Sys.cs │ ├── Sys.cs.uid │ ├── Tfs.cs │ ├── Tfs.cs.uid │ ├── Timescale.cs │ ├── Timescale.cs.uid │ ├── ToggleAudio.cs │ ├── ToggleAudio.cs.uid │ ├── TraceRoute.cs │ ├── TraceRoute.cs.uid │ ├── Version.cs │ ├── Version.cs.uid │ ├── View.cs │ ├── View.cs.uid │ ├── Watch.cs │ ├── Watch.cs.uid │ ├── Wenv.cs │ ├── Wenv.cs.uid │ ├── Whereami.cs │ └── Whereami.cs.uid │ ├── enums │ ├── ECommandAdditionStatus.cs │ ├── ECommandAdditionStatus.cs.uid │ ├── ECommandInputType.cs │ ├── ECommandInputType.cs.uid │ ├── ECommandResult.cs │ ├── ECommandResult.cs.uid │ ├── EDebugScreenItemPosition.cs │ ├── EDebugScreenItemPosition.cs.uid │ ├── EInputType.cs │ ├── EInputType.cs.uid │ ├── EMethodStatus.cs │ ├── EMethodStatus.cs.uid │ ├── EPrintType.cs │ ├── EPrintType.cs.uid │ ├── ERejectionReason.cs │ ├── ERejectionReason.cs.uid │ ├── ESceneChangeFailureReason.cs │ ├── ESceneChangeFailureReason.cs.uid │ ├── EStringConversionResult.cs │ ├── EStringConversionResult.cs.uid │ ├── MethodValidationResult.cs │ └── MethodValidationResult.cs.uid │ ├── helpers │ ├── Keybindings.cs │ ├── Keybindings.cs.uid │ ├── Messages.cs │ ├── Messages.cs.uid │ ├── Numeric.cs │ ├── Numeric.cs.uid │ ├── OS.cs │ ├── OS.cs.uid │ ├── Reflection.cs │ ├── Reflection.cs.uid │ ├── Scene.cs │ ├── Scene.cs.uid │ ├── Storage.cs │ ├── Storage.cs.uid │ ├── Text.cs │ ├── Text.cs.uid │ ├── World.cs │ ├── World.cs.uid │ ├── ZipExtractor.cs │ └── ZipExtractor.cs.uid │ ├── interfaces │ ├── ICommand.cs │ ├── ICommand.cs.uid │ ├── IExtension.cs │ └── IExtension.cs.uid │ ├── resources │ ├── preferences │ │ ├── YatPreferences.cs │ │ ├── YatPreferences.cs.uid │ │ └── YatPreferences.tres │ ├── quick_commands │ │ ├── QuickCommands.cs │ │ ├── QuickCommands.cs.uid │ │ └── QuickCommands.tres │ └── yat_tooltip_theme.tres │ ├── scenes │ ├── base_terminal │ │ ├── BaseTerminal.cs │ │ ├── BaseTerminal.cs.uid │ │ ├── BaseTerminal.tscn │ │ ├── components │ │ │ ├── autocompletion │ │ │ │ ├── Autocompletion.cs │ │ │ │ ├── Autocompletion.cs.uid │ │ │ │ └── Autocompletion.tscn │ │ │ ├── command_validator │ │ │ │ ├── CommandValidator.cs │ │ │ │ ├── CommandValidator.cs.uid │ │ │ │ └── CommandValidator.tscn │ │ │ ├── full_window_display │ │ │ │ ├── FullWindowDisplay.cs │ │ │ │ ├── FullWindowDisplay.cs.uid │ │ │ │ └── FullWindowDisplay.tscn │ │ │ ├── history_component │ │ │ │ ├── HistoryComponent.cs │ │ │ │ ├── HistoryComponent.cs.uid │ │ │ │ └── HistoryComponent.tscn │ │ │ ├── input │ │ │ │ ├── Input.cs │ │ │ │ └── Input.cs.uid │ │ │ ├── input_info │ │ │ │ ├── InputInfo.cs │ │ │ │ ├── InputInfo.cs.uid │ │ │ │ ├── InputInfo.tscn │ │ │ │ ├── components │ │ │ │ │ └── command_info │ │ │ │ │ │ ├── CommandInfo.cs │ │ │ │ │ │ ├── CommandInfo.cs.uid │ │ │ │ │ │ └── CommandInfo.tscn │ │ │ │ └── theme │ │ │ │ │ └── yat_input_info_theme.tres │ │ │ ├── output │ │ │ │ ├── Output.cs │ │ │ │ ├── Output.cs.uid │ │ │ │ └── Output.tscn │ │ │ └── selected_node │ │ │ │ ├── SelectedNode.cs │ │ │ │ ├── SelectedNode.cs.uid │ │ │ │ └── SelectedNode.tscn │ │ └── theme │ │ │ ├── yat_base_terminal_label_theme.tres │ │ │ ├── yat_base_terminal_line_edit_theme.tres │ │ │ ├── yat_base_terminal_panel_container_theme.tres │ │ │ ├── yat_base_terminal_rich_text_label_theme.tres │ │ │ └── yat_base_terminal_theme.tres │ ├── game_terminal │ │ ├── GameTerminal.cs │ │ ├── GameTerminal.cs.uid │ │ ├── GameTerminal.tscn │ │ └── components │ │ │ ├── quick_commands_context │ │ │ ├── QuickCommandsContext.cs │ │ │ ├── QuickCommandsContext.cs.uid │ │ │ └── QuickCommandsContext.tscn │ │ │ └── terminal_switcher │ │ │ ├── TerminalSwitcher.cs │ │ │ ├── TerminalSwitcher.cs.uid │ │ │ ├── TerminalSwitcher.tscn │ │ │ └── theme │ │ │ ├── yat_terminal_switcher_button_normal.tres │ │ │ ├── yat_terminal_switcher_tab_selected.tres │ │ │ ├── yat_terminal_switcher_tab_unselected.tres │ │ │ └── yat_terminal_switcher_theme.tres │ ├── input_container │ │ ├── InputContainer.cs │ │ ├── InputContainer.cs.uid │ │ ├── InputContainer.tscn │ │ └── yat_input_container_theme.tres │ ├── preferences │ │ ├── Preferences.cs │ │ ├── Preferences.cs.uid │ │ ├── Preferences.tscn │ │ ├── components │ │ │ ├── preferences_section │ │ │ │ ├── PreferencesSection.cs │ │ │ │ ├── PreferencesSection.cs.uid │ │ │ │ ├── PreferencesSection.tscn │ │ │ │ └── yat_preferences_section_theme.tres │ │ │ └── preferences_tab │ │ │ │ ├── PreferencesTab.cs │ │ │ │ ├── PreferencesTab.cs.uid │ │ │ │ └── PreferencesTab.tscn │ │ └── yat_preferences_theme.tres │ ├── registered_commands │ │ ├── RegisteredCommands.cs │ │ ├── RegisteredCommands.cs.uid │ │ └── RegisteredCommands.tscn │ ├── terminal_manager │ │ ├── TerminalManager.cs │ │ ├── TerminalManager.cs.uid │ │ └── TerminalManager.tscn │ ├── yat_enable │ │ ├── YatEnable.cs │ │ ├── YatEnable.cs.uid │ │ └── YatEnable.tscn │ └── yat_window │ │ ├── YatWindow.cs │ │ ├── YatWindow.cs.uid │ │ ├── YatWindow.tscn │ │ ├── context_menu │ │ ├── ContextMenu.cs │ │ ├── ContextMenu.cs.uid │ │ ├── ContextMenu.tscn │ │ ├── context_submenu │ │ │ ├── ContextSubmenu.cs │ │ │ ├── ContextSubmenu.cs.uid │ │ │ └── ContextSubmenu.tscn │ │ └── yat_context_menu_theme.tres │ │ └── theme │ │ ├── yat_window_theme.tres │ │ └── yat_yatwindow_theme.tres │ └── types │ ├── CommandData.cs │ ├── CommandData.cs.uid │ ├── CommandInputType.cs │ ├── CommandInputType.cs.uid │ ├── CommandResult.cs │ ├── CommandResult.cs.uid │ ├── NodeMethodInfo.cs │ └── NodeMethodInfo.cs.uid ├── example ├── SetCube.cs ├── SetCube.cs.uid ├── assets │ ├── ATTRIBUTION.txt │ ├── audio │ │ ├── glaciære - two months of moments - 01 Into the Maelstrom.mp3 │ │ └── glaciære - two months of moments - 01 Into the Maelstrom.mp3.import │ └── shaders │ │ ├── grid.gdshader │ │ └── grid.gdshader.uid ├── props │ └── static_cube │ │ └── StaticCube.tscn └── scenes │ ├── game │ ├── Game.cs │ ├── Game.cs.uid │ └── Game.tscn │ ├── main_menu │ ├── MainMenu.gd │ ├── MainMenu.gd.uid │ └── MainMenu.tscn │ └── player │ ├── Player.cs │ ├── Player.cs.uid │ └── Player.tscn └── script_templates └── Node ├── Command.cs ├── Command.cs.uid ├── ExtensibleCommand.cs ├── ExtensibleCommand.cs.uid ├── Extension.cs └── Extension.cs.uid /addons/yat/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 MASSHUU12 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /addons/yat/Plugin.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dy62kn3wtbhng 2 | -------------------------------------------------------------------------------- /addons/yat/README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 |

YAT

4 |

YAT is an addon that provides a customizable, in-game terminal for your project.

5 |
6 | 7 | > [!NOTE] 8 | > This project is in the early stages of development. Many things may be added, 9 | > removed or changed. 10 | 11 | YAT stands for Yet Another Terminal. The goal of this project is to create a 12 | real terminal integrated with Godot that allows you to perform actions whether 13 | in the game, editor, or user system. This is intended to facilitate game 14 | development, debugging, and prototyping. 15 | 16 | ## Prerequisites 17 | 18 | - [.NET SDK 8^](https://dotnet.microsoft.com/en-us/download) 19 | - [.NET enabled Godot 4.2^](https://godotengine.org/download) 20 | - C# 12^ 21 | 22 | Make sure to update your [.csproj](./docs/USAGE.md). 23 | 24 | ## Showcase 25 | 26 | 27 | 28 | ### Features 29 | 30 | - Over 35 built-in commands 31 | - Small size footprint (< 512 KB) 32 | - Custom commands (regular & ~~threaded~~), extensions and windows 33 | - Automatic input validation (arguments, options) 34 | - Customizable debug screen (FPS, CPU, GPU, etc.) 35 | - Access to the node tree (experimental) 36 | - Plugin customization 37 | - Quick Commands 38 | - Autocompletion 39 | - Script templates 40 | - Ability to restrict access to the plugin 41 | - Automatic update 42 | 43 | ## Documentation 44 | 45 | Instructions on how to get started can be found in the 46 | [USAGE.md](./docs/USAGE.md) file. 47 | 48 | You can find the documentation in the [docs](./docs/) folder 49 | and example in the [example](../../example/) folder. 50 | 51 | The project also has templates in the 52 | [script_templates](../../script_templates/) folder, which can make it easier to 53 | create commands, etc. 54 | 55 | ## License 56 | 57 | Licensed under [MIT license](./LICENSE). 58 | -------------------------------------------------------------------------------- /addons/yat/assets/fonts/JetBrains_Mono/JetBrainsMono-Italic-VariableFont_wght.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MASSHUU12/godot-yat/a27fc24f34e6cef64fcba0b628c3ef02f136ccfc/addons/yat/assets/fonts/JetBrains_Mono/JetBrainsMono-Italic-VariableFont_wght.ttf -------------------------------------------------------------------------------- /addons/yat/assets/fonts/JetBrains_Mono/JetBrainsMono-Italic-VariableFont_wght.ttf.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="font_data_dynamic" 4 | type="FontFile" 5 | uid="uid://1w31rhjhd4qx" 6 | path="res://.godot/imported/JetBrainsMono-Italic-VariableFont_wght.ttf-080d711e11747737336297903178cc0f.fontdata" 7 | 8 | [deps] 9 | 10 | source_file="res://addons/yat/assets/fonts/JetBrains_Mono/JetBrainsMono-Italic-VariableFont_wght.ttf" 11 | dest_files=["res://.godot/imported/JetBrainsMono-Italic-VariableFont_wght.ttf-080d711e11747737336297903178cc0f.fontdata"] 12 | 13 | [params] 14 | 15 | Rendering=null 16 | antialiasing=1 17 | generate_mipmaps=false 18 | disable_embedded_bitmaps=true 19 | multichannel_signed_distance_field=false 20 | msdf_pixel_range=8 21 | msdf_size=48 22 | allow_system_fallback=true 23 | force_autohinter=false 24 | hinting=1 25 | subpixel_positioning=1 26 | keep_rounding_remainders=true 27 | oversampling=0.0 28 | Fallbacks=null 29 | fallbacks=[] 30 | Compress=null 31 | compress=true 32 | preload=[] 33 | language_support={} 34 | script_support={} 35 | opentype_features={} 36 | -------------------------------------------------------------------------------- /addons/yat/assets/fonts/JetBrains_Mono/JetBrainsMono-VariableFont_wght.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MASSHUU12/godot-yat/a27fc24f34e6cef64fcba0b628c3ef02f136ccfc/addons/yat/assets/fonts/JetBrains_Mono/JetBrainsMono-VariableFont_wght.ttf -------------------------------------------------------------------------------- /addons/yat/assets/fonts/JetBrains_Mono/JetBrainsMono-VariableFont_wght.ttf.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="font_data_dynamic" 4 | type="FontFile" 5 | uid="uid://dsa5x2qgsn705" 6 | path="res://.godot/imported/JetBrainsMono-VariableFont_wght.ttf-625e1dbb1828121b15f51627253037e2.fontdata" 7 | 8 | [deps] 9 | 10 | source_file="res://addons/yat/assets/fonts/JetBrains_Mono/JetBrainsMono-VariableFont_wght.ttf" 11 | dest_files=["res://.godot/imported/JetBrainsMono-VariableFont_wght.ttf-625e1dbb1828121b15f51627253037e2.fontdata"] 12 | 13 | [params] 14 | 15 | Rendering=null 16 | antialiasing=1 17 | generate_mipmaps=false 18 | disable_embedded_bitmaps=true 19 | multichannel_signed_distance_field=false 20 | msdf_pixel_range=8 21 | msdf_size=48 22 | allow_system_fallback=true 23 | force_autohinter=false 24 | hinting=1 25 | subpixel_positioning=1 26 | keep_rounding_remainders=true 27 | oversampling=0.0 28 | Fallbacks=null 29 | fallbacks=[] 30 | Compress=null 31 | compress=true 32 | preload=[] 33 | language_support={} 34 | script_support={} 35 | opentype_features={} 36 | -------------------------------------------------------------------------------- /addons/yat/docs/.gdignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MASSHUU12/godot-yat/a27fc24f34e6cef64fcba0b628c3ef02f136ccfc/addons/yat/docs/.gdignore -------------------------------------------------------------------------------- /addons/yat/docs/CALLING_METHODS_ON_NODES.md: -------------------------------------------------------------------------------- 1 |
2 |

Calling methods on nodes

3 |

Here you will find information on how to call methods on selected nodes, 4 | how to select them and many more.

5 |
6 | 7 | ### Calling methods on nodes 8 | 9 | > [!NOTE] 10 | > Please keep in mind that this feature is still in development. Many things may not work as expected. 11 | > 12 | > Method chaining is not yet working as it should. At the moment, the chained methods will be run one at a time on the selected node, not on the returned data. 13 | 14 | The terminal in YAT can operate in two modes: by default, the terminal treats any input as **commands** and tries to parse them. 15 | 16 | The second mode allows you to run **methods** on the currently selected **node**, this mode is triggered by giving a `$` character at the beginning of the input data. 17 | 18 | To run a method, you just need to specify the whole name, in the case of methods built in Godot, the names are written in `snake_case`. 19 | 20 | ### Changing selected node 21 | 22 | To change the selected node, use the `cn` command. 23 | 24 | ### Checking available methods 25 | 26 | To see what methods are available for a particular node, use the `ls` command with the `-m` option. For the currently selected node, use `ls . -m`. 27 | -------------------------------------------------------------------------------- /addons/yat/docs/CUSTOM_WINDOWS.md: -------------------------------------------------------------------------------- 1 |
2 |

Custom windows

3 |

Here you can find information on creating custom windows for YAT commands.

4 |
5 | 6 | ### Custom windows 7 | 8 | YAT internally uses the `YatWindow` node to create windows. 9 | If you want to create your own windows for your commands, it's recommended to create them by inheriting from **YatWindow**. 10 | 11 | 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. 12 | 13 | Any windows should be added to **Yat.Windows** for order and clarity. 14 | 15 | You can add your window this way: 16 | 17 | ```cs 18 | Yat.Windows.AddChild(_yourWindow); 19 | ``` 20 | 21 | ### Scaling with the main viewport 22 | 23 | The **YatWindow** is able to scale to always contain itself in the main viewport. 24 | To use this functionality, all you need to do is to use **base._Ready()** in the **_Ready** method of your window. 25 | 26 | Using the variable **ViewportEdgeOffset** you can adjust how much the window will be smaller than the main viewport. 27 | -------------------------------------------------------------------------------- /addons/yat/docs/QUICK_COMMANDS.md: -------------------------------------------------------------------------------- 1 |
2 |

Quick Commands

3 |

Quick Commands are user-defined command prompts.

4 |
5 | 6 | > Quick Commands are saved in **user://yat_qc.tres** 7 | 8 | ### Managing Quick Commands 9 | 10 | You can manage them via the `qc` command. 11 | 12 | Example of adding a command to Quick Commands: 13 | 14 | ```bash 15 | qc add -name="Red Hello" -command="echo [color=red]Hello[/color]" 16 | ``` 17 | 18 | ### Running Quick Commands 19 | 20 | Quick Commands can be run in several different ways: 21 | 22 | - via the terminal context menu 23 | - using the command `qc run -name=command_name` 24 | - by typing its full name in the terminal (spaces are supported) 25 | -------------------------------------------------------------------------------- /addons/yat/docs/TERMINAL.md: -------------------------------------------------------------------------------- 1 |
2 |

Terminal

3 |

Here you will find information on the operation of the terminal.

4 |
5 | 6 | ### Aborting the command 7 | 8 | > Note that sending an interrupt signal does not necessarily mean immediate termination of the command. 9 | > 10 | > Whether and when the command terminates depends on the command and whether it respects the request. 11 | 12 | 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). 13 | 14 | To terminate the command you must use the keybinding **yat_terminal_interrupt**. 15 | 16 | ### Context menu 17 | 18 | YAT uses the keybinding **yat_context_menu** to launch the context menu. 19 | 20 | ### Signals 21 | 22 | | Name | Arguments | Description | 23 | | ---------------------- | -------------- | -------------------------------------------------- | 24 | | CloseRequested | N/A | Sent when terminal is requested to close. | 25 | | TitleChangeRequested | title (string) | Sent when change to terminal's title is requested. | 26 | | PositionResetRequested | N/A | Sent when terminal position reset is requested. | 27 | | SizeResetRequested | N/A | Sent when terminal size reset is requested. | 28 | -------------------------------------------------------------------------------- /addons/yat/docs/YAT_ENABLE.md: -------------------------------------------------------------------------------- 1 |
2 |

YatEnable

3 |

Here you can find information on the YatEnable functionality that allows you to restrict access to the terminal.

4 |
5 | 6 |
7 | 8 | If you don't want users to access the terminal, you can easily **block** access to YAT in several different ways. By default YAT is **accessible**, you can change this in the `YatEnable` scene, which is a child of the `YAT` scene. 9 | 10 | Checking whether the requirements to allow access to YAT have been met is done only once during the startup of the plugin. 11 | 12 | Requirements can be combined, when **one** of them is met YAT will become available. 13 | 14 | ### File 15 | 16 | You can set the terminal to become accessible only if the specified file (default ".yatenable") is in the **user://** and/or **res://** directory. 17 | 18 | ### Terminal argument 19 | 20 | The access restriction can also be lifted when the specified argument (default "--yat") is passed to the executable file. 21 | 22 | The argument can be passed this way: 23 | 24 | ```sh 25 | my_awesome_game -- --yat 26 | ``` 27 | 28 | Note the two hyphens preceding the argument, without them, it won't work because Godot will consume the input. 29 | -------------------------------------------------------------------------------- /addons/yat/docs/assets/yat_icon_baner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MASSHUU12/godot-yat/a27fc24f34e6cef64fcba0b628c3ef02f136ccfc/addons/yat/docs/assets/yat_icon_baner.png -------------------------------------------------------------------------------- /addons/yat/docs/classes/BaseTerminal.md: -------------------------------------------------------------------------------- 1 |
2 |

BaseTerminal

3 |

A base class containing all the components needed to run commands.

4 |
5 | 6 | ### Description 7 | 8 | **Inherits**: Control 9 | 10 | ### Properties 11 | 12 | | Type | Name | Default | 13 | | ---------------------- | ----------------- | ---------------- | 14 | | bool | Locked | - | 15 | | bool | Current | true | 16 | | Input | Input | - | 17 | | Output | Output | - | 18 | | SelectedNode | SelectedNode | - | 19 | | CommandManager | CommandManager | - | 20 | | CommandValidator | CommandValidator | - | 21 | | FullWindowDisplay | FullWindowDisplay | - | 22 | | ECommandResult | LastCommandResult | Unavailable (-1) | 23 | | LinkedList | History | new | 24 | | LinkedListNode | HistoryNode | null | 25 | 26 | ### Methods 27 | 28 | | Type | Definition | 29 | | ---- | ------------------------------------------------------ | 30 | | void | Print (string text, PrintType type = PrintType.Normal) | 31 | | void | Print (T text, PrintType type = PrintType.Normal) | 32 | | void | Clear () | 33 | 34 | ### Signals 35 | 36 | **CloseRequested** () 37 | 38 | **TitleChanged** (string title) 39 | 40 | **PositionResetRequested** () 41 | 42 | **SizeResetRequested** () 43 | 44 | **MethodCalled** (StringName method, Variant returnValue, EMethodStatus status) 45 | 46 | ### Enumerations 47 | 48 | **-** 49 | -------------------------------------------------------------------------------- /addons/yat/docs/classes/Extensible.md: -------------------------------------------------------------------------------- 1 |
2 |

Extensible

3 |

Base class, on the basis of which extensible commands are created.

4 |
5 | 6 | ### Description 7 | 8 | **Inherits**: Node 9 | 10 | This class is used to create extensible command on top of it and allows registering and store all extensions. 11 | 12 | ### Properties 13 | 14 | | Type | Name | Default | 15 | | ---------------------------------------------------- | ---------- | ------- | 16 | | Dictionary> | Extensions | new | 17 | 18 | ### Methods 19 | 20 | | Type | Definition | 21 | | ----------------------------------- | ------------------------------------------------------------ | 22 | | static bool | RegisterExtension (StringName commandName, Type extension) | 23 | | static bool | UnregisterExtension (StringName commandName, Type extension) | 24 | | virtual CommandResult | ExecuteExtension (Type extension, CommandData args) | 25 | | virtual StringBuilder | GenerateExtensionsManual () | 26 | | static Dictionary | GetCommandExtensions (StringName commandName) | 27 | 28 | ### Signals 29 | 30 | **-** 31 | 32 | ### Enumerations 33 | 34 | **-** 35 | -------------------------------------------------------------------------------- /addons/yat/docs/classes/FullWindowDisplay.md: -------------------------------------------------------------------------------- 1 |
2 |

FullWindowDisplay

3 |

Overlay used in the terminal to display an independent block of text occupying all available space with BBCode support.

4 |
5 | 6 | ### Description 7 | 8 | **Inherits**: Control 9 | 10 | ### Properties 11 | 12 | | Type | Name | Default | 13 | | ----------- | ----------- | ------- | 14 | | bool | IsOpen | false | 15 | | MainDisplay | MainDisplay | - | 16 | 17 | ### Methods 18 | 19 | | Type | Definition | 20 | | ---- | ------------- | 21 | | void | Open (string) | 22 | | void | Close () | 23 | 24 | ### Signals 25 | 26 | **Opened** () 27 | 28 | **Closed** () 29 | 30 | ### Enumerations 31 | 32 | **-** 33 | -------------------------------------------------------------------------------- /addons/yat/docs/classes/Input.md: -------------------------------------------------------------------------------- 1 |
2 |

Input

3 |

Single-line text field sending collected data to run.

4 |
5 | 6 | ### Description 7 | 8 | **Inherits**: LineEdit 9 | 10 | The `Input` is a text field used in the terminal. When the entered data is submited, it is passed to the terminal to run. 11 | 12 | ### Properties 13 | 14 | | Type | Name | Default | 15 | | ------------------- | -------- | ------- | 16 | | Export BaseTerminal | Terminal | - | 17 | 18 | ### Methods 19 | 20 | | Type | Definition | 21 | | ---- | ----------------- | 22 | | void | MoveCaretToEnd () | 23 | 24 | ### Signals 25 | 26 | **-** 27 | 28 | ### Enumerations 29 | 30 | **-** 31 | -------------------------------------------------------------------------------- /addons/yat/docs/classes/Output.md: -------------------------------------------------------------------------------- 1 |
2 |

Output

3 |

Displays text in the terminal window.

4 |
5 | 6 | ### Description 7 | 8 | **Inherits**: RichTextLabel 9 | 10 | `Output` displays data returned by commands, or other classes. Supports `BBCode`. 11 | 12 | ### Properties 13 | 14 | | Type | Name | Default | 15 | | ---- | ---- | ------- | 16 | | - | - | - | 17 | 18 | ### Methods 19 | 20 | | Type | Definition | 21 | | ---- | ------------------------------------------------------------------------------------ | 22 | | void | Print (string message, LogOutput output = LogOutput.Terminal) | 23 | | void | Error (string message, LogOutput output = LogOutput.Terminal) | 24 | | void | Warning (string message, LogOutput output = LogOutput.Terminal) | 25 | | void | Info (string message, LogOutput output = LogOutput.Terminal) | 26 | | void | Success (string message, LogOutput output = LogOutput.Terminal) | 27 | | void | Debug (string message, LogOutput output = LogOutput.Terminal) | 28 | | void | Trace (string message, bool detailed = false, LogOutput output = LogOutput.Terminal) | 29 | 30 | ### Signals 31 | 32 | #### - 33 | 34 | ### Enumerations 35 | 36 | flags **LogOutput** 37 | 38 | - **None** = 0 39 | - **Terminal** = 1 40 | - **Editor** = 2 41 | - **EditorRich** = 4 42 | -------------------------------------------------------------------------------- /addons/yat/docs/classes/Parser.md: -------------------------------------------------------------------------------- 1 |
2 |

Parser

3 |

A class used to parse data.

4 |
5 | 6 | ### Description 7 | 8 | **Inherits**: N/A 9 | 10 | ### Properties 11 | 12 | | Type | Name | Default | 13 | | ---- | ---- | ------- | 14 | | - | - | - | 15 | 16 | ### Methods 17 | 18 | | Type | Definition | 19 | | ------------------ | ----------------------------- | 20 | | string[] | ParseCommand (string command) | 21 | | (string, string[]) | ParseMethod (string method) | 22 | 23 | ### Signals 24 | 25 | **-** 26 | 27 | ### Enumerations 28 | 29 | **-** 30 | -------------------------------------------------------------------------------- /addons/yat/docs/classes/Reflection.md: -------------------------------------------------------------------------------- 1 |
2 |

Reflection

3 |

A static class supporting the use of reflection.

4 |
5 | 6 | ### Description 7 | 8 | **Inherits**: N/A 9 | 10 | This class is used to perform reflection actions on objects, e.g., checking whether an object has a given attribute. 11 | 12 | ### Properties 13 | 14 | **-** 15 | 16 | ### Methods 17 | 18 | | Type | Definition | 19 | | ------------------ | ----------------------------------------------------------------------------- | 20 | | static EventInfo[] | GetEvents (this object obj, BindingFlags bindingFlags = BindingFlags.Default) | 21 | | static T | GetAttribute (this object obj) | 22 | | static T[] | GetAttributes (this object obj) | 23 | | static bool | HasAttribute (this object obj) | 24 | | static bool | HasInterface (this object obj) where T : notnull | 25 | | static bool | HasInterface (Type type, StringName interfaceName) | 26 | 27 | ### Signals 28 | 29 | **-** 30 | 31 | ### Enumerations 32 | 33 | **-** 34 | -------------------------------------------------------------------------------- /addons/yat/docs/classes/RegisteredCommands.md: -------------------------------------------------------------------------------- 1 |
2 |

RegisteredCommands

3 |

Class responsible for storing and registering commands.

4 |
5 | 6 | ### Description 7 | 8 | **Inherits**: Node 9 | 10 | This class gives access to registered and quick commands, adding new ones, and is in charge of registering built-in commands. 11 | 12 | ### Properties 13 | 14 | | Type | Name | Default | 15 | | ------------------------------- | ------------- | ------- | 16 | | static Dictionary | Registered | new | 17 | | Export QuickCommands | QuickCommands | new | 18 | 19 | ### Methods 20 | 21 | | Type | Definition | 22 | | ---- | --------------------------------------------- | 23 | | void | static AddCommand (Type commandType) | 24 | | void | static AddCommand (params Type[] commands) | 25 | | bool | AddQuickCommand (string name, string command) | 26 | | bool | RemoveQuickCommand (string name) | 27 | | bool | GetQuickCommands () | 28 | 29 | ### Signals 30 | 31 | **QuickCommandsChanged** () 32 | 33 | ### Enumerations 34 | 35 | enum **AddingResult** 36 | 37 | - **Success** 38 | - **UnknownCommand** 39 | - **MissingAttribute** 40 | -------------------------------------------------------------------------------- /addons/yat/docs/classes/Scene.md: -------------------------------------------------------------------------------- 1 |
2 |

Scene

3 |

A class containing scene-specific methods.

4 |
5 | 6 | ### Description 7 | 8 | **Inherits**: N/A 9 | 10 | ### Properties 11 | 12 | | Type | Name | Default | 13 | | ---- | ---- | ------- | 14 | | - | - | - | 15 | 16 | ### Methods 17 | 18 | | Type | Definition | 19 | | ------------------------------ | ----------------------------------------------------------------------------- | 20 | | static bool | PrintChildren (BaseTerminal terminal, string path) | 21 | | static Node | GetFromPathOrDefault (string path, Node defaultNode, out string newPath) | 22 | | static IEnumerator | GetNodeMethods (Node node) | 23 | | static bool | TryFindNodeMethodInfo (Node node, string methodName, out NodeMethodInfo info) | 24 | | static NodeMethodInfo | GetNodeMethodInfo (Dictionary method) | 25 | | static MethodValidationResult | ValidateMethod (this Node node, StringName method) | 26 | | static Variant | CallMethod (this Node node, StringName method, params Variant[] args) | 27 | 28 | ### Signals 29 | 30 | **-** 31 | 32 | ### Enumerations 33 | 34 | **-** 35 | -------------------------------------------------------------------------------- /addons/yat/docs/classes/Storage.md: -------------------------------------------------------------------------------- 1 |
2 |

Storage

3 |

Class for managing resources.

4 |
5 | 6 | ### Description 7 | 8 | **Inherits**: N/A 9 | 10 | Supported paths are: 11 | - `user://`: User-specific path that is different for each OS. 12 | - `res://`: Read-only path that points to the project folder. 13 | - `relative`: Relative paths are relative to the current working directory. 14 | - `absolute`: Absolute paths are absolute paths on the filesystem. 15 | 16 | The actual directory paths for `user://` are: 17 | - `Windows`: %APPDATA%\Godot\app_userdata\[project_name] 18 | - `Linux`: ~/.local/share/godot/app_userdata/[project_name] 19 | - `macOS`: ~/Library/Application Support/Godot/app_userdata/[project_name] 20 | 21 | See: https://docs.godotengine.org/en/stable/tutorials/io/data_paths.html. 22 | 23 | ### Properties 24 | 25 | | Type | Name | Default | 26 | | ---- | ---- | ------- | 27 | | - | - | - | 28 | 29 | ### Methods 30 | 31 | | Type | Definition | 32 | | ----------- | -------------------------------------------------------------------------------------------------------------- | 33 | | static bool | SaveResource ( Resource resource, string path, ResourceSaver.SaverFlags flags = ResourceSaver.SaverFlags.None) | 34 | | static T | LoadResource (string path) | 35 | 36 | ### Signals 37 | 38 | **-** 39 | 40 | ### Enumerations 41 | 42 | **-** 43 | -------------------------------------------------------------------------------- /addons/yat/docs/classes/YAT.md: -------------------------------------------------------------------------------- 1 |
2 |

YAT

3 |

The main class of the entire project, autoload.

4 |
5 | 6 | ### Description 7 | 8 | **Inherits**: Node 9 | 10 | This class gives access to and manages all the most important aspects of the plugin. 11 | 12 | ### Properties 13 | 14 | | Type | Name | Default | 15 | | ------------------ | ------------------ | ------- | 16 | | bool | YatEnabled | true | 17 | | Node | Windows | - | 18 | | BaseTerminal | CurrentTerminal | - | 19 | | RegisteredCommands | Commands | - | 20 | | PreferencesManager | PreferencesManager | - | 21 | | TerminalManager | TerminalManager | - | 22 | 23 | ### Methods 24 | 25 | | Type | Definition | 26 | | ---- | ---------- | 27 | | - | - | 28 | 29 | ### Signals 30 | 31 | _ 32 | 33 | ### Enumerations 34 | 35 | _ 36 | -------------------------------------------------------------------------------- /addons/yat/docs/classes/YatWindow.md: -------------------------------------------------------------------------------- 1 |
2 |

YatWindow

3 |

Base class to create custom windows.

4 |
5 | 6 | ### Description 7 | 8 | **Inherits**: Window 9 | 10 | A class used to create custom windows with a consistent appearance, for example, used in the GameTerminal class. 11 | 12 | ### Properties 13 | 14 | | Type | Name | Default | 15 | | ------------------------ | --------------------- | ---------------------- | 16 | | Export ushort | ViewportEdgeOffset | - | 17 | | Export EWindowPosition | DefaultWindowPosition | EWindowPosition.Center | 18 | | bool | AllowToGoOffScreen | true | 19 | | ContextMenu | ContextMenu | - | 20 | | Vector2I | InitialSize | - | 21 | | bool | IsWindowMoving | false | 22 | | Protected YAT | _yat | - | 23 | | Protected PanelContainer | _content | - | 24 | 25 | ### Methods 26 | 27 | | Type | Definition | 28 | | -------------- | ----------------------------------------- | 29 | | void | ResetPosition () | 30 | | void | Move (EWindowPosition position, uint = 0) | 31 | | protected void | MoveTopLeft (uint) | 32 | | protected void | MoveTopRight (uint) | 33 | | protected void | MoveBottomRight (uint) | 34 | | protected void | MoveBottomLeft (uint) | 35 | | protected void | MoveToTheCenter (uint) | 36 | | Protected void | UpdateOptions (YatPreferences) | 37 | 38 | ### Signals 39 | 40 | **WindowMoved** (Vector2 position) 41 | 42 | ### Enumerations 43 | 44 | enum **EWindowPosition** 45 | 46 | - **TopLeft** 47 | - **TopRight** 48 | - **BottomLeft** 49 | - **BottomRight** 50 | - **Center** 51 | -------------------------------------------------------------------------------- /addons/yat/plugin.cfg: -------------------------------------------------------------------------------- 1 | [plugin] 2 | 3 | name="YAT" 4 | description="YAT is an addon that provides a customizable, in-game terminal for your Godot project. Currently in beta." 5 | author="MASSHUU" 6 | version="1.31.1-beta" 7 | script="Plugin.cs" 8 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/CpuInfoItem.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using YAT.Attributes; 3 | 4 | namespace YAT.Debug; 5 | 6 | [Title("CPU")] 7 | public partial class CpuInfoItem : DebugScreenItem 8 | { 9 | #nullable disable 10 | private RichTextLabel _label; 11 | #nullable restore 12 | 13 | private readonly string _arch = Engine.GetArchitectureName(); 14 | private readonly string _cpuName = OS.GetProcessorName(); 15 | private readonly int _cpuCount = OS.GetProcessorCount(); 16 | 17 | public override void _Ready() 18 | { 19 | base._Ready(); 20 | 21 | LayoutDirection = LayoutDirectionEnum.Rtl; 22 | 23 | _label = CreateLabel(); 24 | _label.Text = $"{_cpuName} {_arch} ({_cpuCount} cores)"; 25 | VContainer.AddChild(_label); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/CpuInfoItem.cs.uid: -------------------------------------------------------------------------------- 1 | uid://5x8cp4sw5v20 2 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/DebugScreen.cs.uid: -------------------------------------------------------------------------------- 1 | uid://2p66ke5dqtg3 2 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/DebugScreenItem.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | 3 | namespace YAT.Debug; 4 | 5 | public partial class DebugScreenItem : PanelContainer 6 | { 7 | #nullable disable 8 | public YAT Yat { get; private set; } 9 | public VBoxContainer VContainer { get; private set; } 10 | #nullable restore 11 | 12 | public static RichTextLabel CreateLabel(Color? color = null) 13 | { 14 | RichTextLabel label = new() 15 | { 16 | BbcodeEnabled = true, 17 | FitContent = true, 18 | AutowrapMode = 0, 19 | ScrollActive = false 20 | }; 21 | 22 | if (color is not null) 23 | { 24 | label.AddThemeColorOverride("default_color", color.Value); 25 | } 26 | 27 | return label; 28 | } 29 | 30 | public static string ColorText(string text, Color color) 31 | { 32 | return $"[color={color}]{text}[/color]"; 33 | } 34 | 35 | public override void _Ready() 36 | { 37 | Yat = GetNode("/root/YAT"); 38 | VContainer = new() 39 | { 40 | SizeFlagsHorizontal = 0, 41 | SizeFlagsVertical = 0 42 | }; 43 | AddChild(VContainer); 44 | } 45 | 46 | public virtual void Update() { } 47 | } 48 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/DebugScreenItem.cs.uid: -------------------------------------------------------------------------------- 1 | uid://t7ve6vj0dool 2 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/EngineInfoItem.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using Godot; 3 | using YAT.Attributes; 4 | 5 | namespace YAT.Debug; 6 | 7 | [Title("Engine")] 8 | public partial class EngineInfoItem : DebugScreenItem 9 | { 10 | #nullable disable 11 | private RichTextLabel _label; 12 | #nullable restore 13 | 14 | public override void _Ready() 15 | { 16 | base._Ready(); 17 | 18 | LayoutDirection = LayoutDirectionEnum.Rtl; 19 | 20 | _label = CreateLabel(); 21 | _label.Text = string.Format( 22 | CultureInfo.InvariantCulture, 23 | "Godot {0} ({1} template)", 24 | Engine.GetVersionInfo()["string"].AsString(), 25 | OS.IsDebugBuild() ? "Debug" : "Release" 26 | ); 27 | VContainer.AddChild(_label); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/EngineInfoItem.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dh2o5kb31vsy8 2 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/FpsItem.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using YAT.Attributes; 3 | using YAT.Resources; 4 | 5 | using static Godot.Performance; 6 | 7 | namespace YAT.Debug; 8 | 9 | [Title("FPS")] 10 | public partial class FpsItem : DebugScreenItem 11 | { 12 | #nullable disable 13 | private RichTextLabel _label, _times; 14 | #nullable restore 15 | 16 | public override void _Ready() 17 | { 18 | base._Ready(); 19 | 20 | _label = CreateLabel(); 21 | VContainer.AddChild(_label); 22 | _times = CreateLabel(); 23 | VContainer.AddChild(_times); 24 | } 25 | 26 | public override void Update() 27 | { 28 | float fps = (float)GetMonitor(Monitor.TimeFps); 29 | float process = (float)GetMonitor(Monitor.TimeProcess) * 1000; 30 | float physics = (float)GetMonitor(Monitor.TimePhysicsProcess) * 1000; 31 | YatPreferences pref = Yat.PreferencesManager.Preferences; 32 | 33 | _label.Clear(); 34 | _label.PushFontSize(24); 35 | _label.PushColor(fps < 30 ? pref.ErrorColor : pref.SuccessColor); 36 | _label.AppendText($"{fps} FPS"); 37 | _label.PopAll(); 38 | 39 | _times.Clear(); 40 | _times.PushFontSize(12); 41 | _times.AppendText("Process: "); 42 | if (fps < 30) 43 | { 44 | _times.PushColor(pref.ErrorColor); 45 | } 46 | 47 | _times.AppendText($"{process:0.00} ms\n"); 48 | if (fps < 30) 49 | { 50 | _times.Pop(); 51 | } 52 | 53 | _times.AppendText("Physics: "); 54 | if (fps < 30) 55 | { 56 | _times.PushColor(pref.ErrorColor); 57 | } 58 | 59 | _times.AppendText($"{physics:0.000} ms"); 60 | if (fps < 30) 61 | { 62 | _times.Pop(); 63 | } 64 | _times.Pop(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/FpsItem.cs.uid: -------------------------------------------------------------------------------- 1 | uid://xdectly84vfa 2 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/GpuInfoItem.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using Godot; 3 | using YAT.Attributes; 4 | 5 | namespace YAT.Debug; 6 | 7 | [Title("GPU")] 8 | public partial class GpuInfoItem : DebugScreenItem 9 | { 10 | private readonly RenderingDevice _device = RenderingServer.GetRenderingDevice(); 11 | 12 | #nullable disable 13 | private RichTextLabel _label; 14 | private string _vendor; 15 | private string _deviceName; 16 | #nullable restore 17 | 18 | public override void _Ready() 19 | { 20 | base._Ready(); 21 | 22 | LayoutDirection = LayoutDirectionEnum.Rtl; 23 | 24 | _deviceName = _device.GetDeviceName(); 25 | _vendor = _device.GetDeviceVendorName(); 26 | 27 | _label = CreateLabel(); 28 | VContainer.AddChild(_label); 29 | } 30 | 31 | public override void Update() 32 | { 33 | Vector2I monitorSize = DisplayServer.ScreenGetSize( 34 | DisplayServer.WindowGetCurrentScreen() 35 | ); 36 | 37 | _label.Text = string.Format( 38 | CultureInfo.InvariantCulture, 39 | "{0} {1} {2}x{3} ({4}x{5})", 40 | _deviceName, 41 | _vendor, 42 | monitorSize.X, 43 | monitorSize.Y, 44 | _device.ScreenGetWidth(), 45 | _device.ScreenGetHeight() 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/GpuInfoItem.cs.uid: -------------------------------------------------------------------------------- 1 | uid://g8rse8cbmmnl 2 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/LookingAtInfo.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using Godot.Collections; 3 | using YAT.Attributes; 4 | using YAT.Helpers; 5 | 6 | namespace YAT.Debug; 7 | 8 | [Title("LookingAt")] 9 | public partial class LookingAtInfo : DebugScreenItem 10 | { 11 | #nullable disable 12 | private RichTextLabel _label; 13 | #nullable restore 14 | private const uint RAY_LENGTH = 1024; 15 | 16 | private const string PREFIX = "Looking at: "; 17 | private const string NOTHING = PREFIX + "Nothing"; 18 | private const string NO_CAMERA = PREFIX + "No camera"; 19 | 20 | public override void _Ready() 21 | { 22 | base._Ready(); 23 | 24 | _label = CreateLabel(); 25 | VContainer.AddChild(_label); 26 | } 27 | 28 | public override void Update() 29 | { 30 | Dictionary? result = World.RayCast(Yat.GetViewport(), RAY_LENGTH); 31 | 32 | if (result is null) 33 | { 34 | _label.Text = NO_CAMERA; 35 | return; 36 | } 37 | 38 | if (result.Count == 0) 39 | { 40 | _label.Text = NOTHING; 41 | return; 42 | } 43 | 44 | Node node = result["collider"].As(); 45 | Vector2 position = result["position"].As(); 46 | 47 | if (node is null) 48 | { 49 | _label.Text = NOTHING; 50 | return; 51 | } 52 | 53 | _label.Text = PREFIX + node.Name + " at " + position; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/LookingAtInfo.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bgpyf6saegeop 2 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/MemoryInfoItem.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using Godot.Collections; 3 | using YAT.Attributes; 4 | using YAT.Helpers; 5 | 6 | namespace YAT.Debug; 7 | 8 | [Title("Memory")] 9 | public partial class MemoryInfoItem : DebugScreenItem 10 | { 11 | #nullable disable 12 | private RichTextLabel _label; 13 | #nullable restore 14 | 15 | public override void _Ready() 16 | { 17 | base._Ready(); 18 | 19 | _label = CreateLabel(new(0.552941f, 0.647059f, 0.952941f, 1)); 20 | VContainer.AddChild(_label); 21 | } 22 | 23 | public override void Update() 24 | { 25 | Dictionary mem = Godot.OS.GetMemoryInfo(); 26 | long physical = mem["physical"].AsInt64(); 27 | long free = mem["free"].AsInt64(); 28 | long stack = mem["stack"].AsInt64(); 29 | double vram = Performance.GetMonitor(Performance.Monitor.RenderVideoMemUsed); 30 | 31 | float freePercent = free / physical * 100f; 32 | 33 | _label.Clear(); 34 | _label.AppendText( 35 | $"RAM: {(freePercent < 15 36 | ? ColorText( 37 | Numeric.SizeToString(free, 3), 38 | Yat.PreferencesManager.Preferences.ErrorColor 39 | ) 40 | : Numeric.SizeToString(free, 3) 41 | )}/{Numeric.SizeToString(physical, 3)}\n" 42 | + $"Stack: {Numeric.SizeToString(stack, 1)}\n" 43 | + $"VRAM: {Numeric.SizeToString((long)vram, 2)}" 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/MemoryInfoItem.cs.uid: -------------------------------------------------------------------------------- 1 | uid://cai5cv4rqlise 2 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/OsInfoItem.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using YAT.Attributes; 3 | 4 | namespace YAT.Debug; 5 | 6 | [Title("OS")] 7 | public partial class OsInfoItem : DebugScreenItem 8 | { 9 | #nullable disable 10 | private RichTextLabel _label; 11 | #nullable restore 12 | 13 | private readonly string _osName = OS.GetName(); 14 | private readonly string _displayServerName = DisplayServer.GetName(); 15 | 16 | public override void _Ready() 17 | { 18 | base._Ready(); 19 | 20 | LayoutDirection = LayoutDirectionEnum.Rtl; 21 | 22 | _label = CreateLabel(); 23 | _label.Text = $"{_osName} {OS.GetVersion()} {OS.GetLocale()} {( 24 | _osName == _displayServerName 25 | ? string.Empty 26 | : $"({_displayServerName})")}"; 27 | VContainer.AddChild(_label); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/OsInfoItem.cs.uid: -------------------------------------------------------------------------------- 1 | uid://delb8et1fdv63 2 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/SceneObjectsInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using Godot; 3 | using YAT.Attributes; 4 | 5 | using static Godot.Performance; 6 | 7 | namespace YAT.Debug; 8 | 9 | [Title("SceneObjects")] 10 | public partial class SceneObjectsInfo : DebugScreenItem 11 | { 12 | #nullable disable 13 | private RichTextLabel _label; 14 | #nullable restore 15 | 16 | public override void _Ready() 17 | { 18 | base._Ready(); 19 | 20 | _label = CreateLabel(new(0.819608f, 0.627451f, 0.305882f, 1)); 21 | VContainer.AddChild(_label); 22 | } 23 | 24 | public override void Update() 25 | { 26 | int objects = (int)GetMonitor(Monitor.ObjectCount); 27 | int nodes = (int)GetMonitor(Monitor.ObjectNodeCount); 28 | int orphans = (int)GetMonitor(Monitor.ObjectOrphanNodeCount); 29 | int resources = (int)GetMonitor(Monitor.ObjectResourceCount); 30 | 31 | _label.Text = string.Format( 32 | CultureInfo.InvariantCulture, 33 | "Objects: {0}\nResources: {1}\nNodes: {2}\nOrphans: {3}", 34 | objects, 35 | resources, 36 | nodes, 37 | orphans 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/SceneObjectsInfo.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dwpa5b2p34jvi 2 | -------------------------------------------------------------------------------- /addons/yat/src/Debug/yat_debug_screen_theme.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Theme" load_steps=2 format=3 uid="uid://cymypue85kfr7"] 2 | 3 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_pfsv5"] 4 | 5 | [resource] 6 | Label/colors/font_outline_color = Color(0, 0, 0, 1) 7 | Label/constants/outline_size = 4 8 | Label/font_sizes/font_size = 14 9 | MarginContainer/constants/margin_bottom = 8 10 | MarginContainer/constants/margin_left = 8 11 | MarginContainer/constants/margin_right = 8 12 | MarginContainer/constants/margin_top = 8 13 | PanelContainer/styles/panel = SubResource("StyleBoxEmpty_pfsv5") 14 | RichTextLabel/colors/font_outline_color = Color(0, 0, 0, 1) 15 | RichTextLabel/constants/outline_size = 4 16 | RichTextLabel/font_sizes/bold_font_size = 14 17 | RichTextLabel/font_sizes/bold_italics_font_size = 14 18 | RichTextLabel/font_sizes/italics_font_size = 14 19 | RichTextLabel/font_sizes/mono_font_size = 14 20 | RichTextLabel/font_sizes/normal_font_size = 14 21 | -------------------------------------------------------------------------------- /addons/yat/src/Net/EConnectionStatus.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Net; 2 | 3 | public enum EConnectionStatus : ushort 4 | { 5 | Success = 0, 6 | Unsupported = 1, 7 | Unknown = 2, 8 | AccessDenied = 3 9 | } 10 | -------------------------------------------------------------------------------- /addons/yat/src/Net/EConnectionStatus.cs.uid: -------------------------------------------------------------------------------- 1 | uid://r651ak7qrpc 2 | -------------------------------------------------------------------------------- /addons/yat/src/Net/Networking.cs.uid: -------------------------------------------------------------------------------- 1 | uid://deah4d8a2a0v8 2 | -------------------------------------------------------------------------------- /addons/yat/src/Net/NetworkingOptions.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Net; 2 | 3 | public record NetworkingOptions 4 | { 5 | public ushort Timeout { get; init; } = 10000; 6 | public ushort TTL { get; init; } = 30; 7 | public ushort BufferSize { get; init; } = 32; 8 | public bool DontFragment { get; init; } = true; 9 | public ushort Delay { get; init; } = 1000; 10 | } 11 | -------------------------------------------------------------------------------- /addons/yat/src/Net/NetworkingOptions.cs.uid: -------------------------------------------------------------------------------- 1 | uid://btfpljj4x8yrw 2 | -------------------------------------------------------------------------------- /addons/yat/src/Update/Release.cs.uid: -------------------------------------------------------------------------------- 1 | uid://hrl135bedc2c 2 | -------------------------------------------------------------------------------- /addons/yat/src/Update/ReleaseTagInfo.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Update; 2 | 3 | public record ReleaseTagInfo( 4 | SemanticVersion Version, 5 | string ZipballUrl, 6 | string TarballUrl, 7 | string CommitSha, 8 | string CommitUrl, 9 | string NodeId 10 | ); 11 | -------------------------------------------------------------------------------- /addons/yat/src/Update/ReleaseTagInfo.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bqwmae311ebqm 2 | -------------------------------------------------------------------------------- /addons/yat/src/Update/SemanticVersion.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bshl8cpn0fy7h 2 | -------------------------------------------------------------------------------- /addons/yat/src/Update/Updater.cs.uid: -------------------------------------------------------------------------------- 1 | uid://chmy86stn5gfc 2 | -------------------------------------------------------------------------------- /addons/yat/src/Update/UpdaterWindow.cs.uid: -------------------------------------------------------------------------------- 1 | uid://db0b7p6im6xwx 2 | -------------------------------------------------------------------------------- /addons/yat/src/YAT.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using YAT.Helpers; 3 | using YAT.Scenes; 4 | using YAT.Classes.Managers; 5 | 6 | namespace YAT; 7 | 8 | public partial class YAT : Node 9 | { 10 | #nullable disable 11 | public Node Windows { get; private set; } 12 | public YatEnable YatEnable { get; private set; } 13 | public RegisteredCommands Commands { get; private set; } 14 | public TerminalManager TerminalManager { get; private set; } 15 | public PreferencesManager PreferencesManager { get; private set; } 16 | #nullable restore 17 | 18 | public override void _Ready() 19 | { 20 | Windows = GetNode("./Windows"); 21 | YatEnable = GetNode("./YatEnable"); 22 | Commands = GetNode("./RegisteredCommands"); 23 | TerminalManager = GetNode("./TerminalManager"); 24 | PreferencesManager = GetNode("%PreferencesManager"); 25 | 26 | Keybindings.LoadDefaultActions(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /addons/yat/src/YAT.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bh03f2wxlpfm8 2 | -------------------------------------------------------------------------------- /addons/yat/src/YAT.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=9 format=3 uid="uid://dhbvghhlqawa4"] 2 | 3 | [ext_resource type="Script" uid="uid://bh03f2wxlpfm8" path="res://addons/yat/src/YAT.cs" id="1_683p6"] 4 | [ext_resource type="PackedScene" uid="uid://b8xfvdai1l0vo" path="res://addons/yat/src/classes/managers/preferences_manager/PreferencesManager.tscn" id="4_5x7ox"] 5 | [ext_resource type="PackedScene" uid="uid://c4oxru3g4p038" path="res://addons/yat/src/scenes/terminal_manager/TerminalManager.tscn" id="4_tgqer"] 6 | [ext_resource type="FontFile" uid="uid://dsa5x2qgsn705" path="res://addons/yat/assets/fonts/JetBrains_Mono/JetBrainsMono-VariableFont_wght.ttf" id="5_3fowk"] 7 | [ext_resource type="PackedScene" uid="uid://r45e18qb3ekv" path="res://addons/yat/src/scenes/registered_commands/RegisteredCommands.tscn" id="5_j53i0"] 8 | [ext_resource type="Script" uid="uid://pw0ipbpc5i4d" path="res://addons/yat/src/resources/preferences/YatPreferences.cs" id="6_l2tdx"] 9 | [ext_resource type="PackedScene" uid="uid://bkrycicg7xrko" path="res://addons/yat/src/scenes/yat_enable/YatEnable.tscn" id="7_ar0j0"] 10 | 11 | [sub_resource type="Resource" id="Resource_x0850"] 12 | script = ExtResource("6_l2tdx") 13 | Prompt = ">" 14 | ShowPrompt = true 15 | HistoryLimit = 15 16 | AutoScroll = true 17 | FontSize = 16 18 | DefaultWidth = 728 19 | DefaultHeight = 384 20 | BaseFontSize = 16 21 | BaseFont = ExtResource("5_3fowk") 22 | InputColor = Color(0.87451, 0.87451, 0.87451, 0.6) 23 | BackgroundColor = Color(0.113725, 0.133333, 0.160784, 1) 24 | OutputColor = Color(0.87451, 0.87451, 0.87451, 0.501961) 25 | ErrorColor = Color(1, 0.470588, 0.419608, 1) 26 | WarningColor = Color(1, 0.866667, 0.396078, 1) 27 | SuccessColor = Color(0.647059, 1, 0.541176, 1) 28 | 29 | [node name="YAT" type="Node"] 30 | process_mode = 3 31 | script = ExtResource("1_683p6") 32 | 33 | [node name="RegisteredCommands" parent="." instance=ExtResource("5_j53i0")] 34 | 35 | [node name="TerminalManager" parent="." instance=ExtResource("4_tgqer")] 36 | 37 | [node name="PreferencesManager" parent="." instance=ExtResource("4_5x7ox")] 38 | unique_name_in_owner = true 39 | Preferences = SubResource("Resource_x0850") 40 | 41 | [node name="YatEnable" parent="." instance=ExtResource("7_ar0j0")] 42 | 43 | [node name="Windows" type="Node" parent="."] 44 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/ArgumentAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace YAT.Attributes; 5 | 6 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 7 | public sealed class ArgumentAttribute : CommandInputAttribute 8 | { 9 | public ArgumentAttribute(string name, string type, string description = "") 10 | : base(name, type, description) { } 11 | 12 | public override string ToString() 13 | { 14 | string types = string.Join(" | ", Types.Select(t => t.Type)); 15 | 16 | return $"[b]{Name}[/b]: {types} - {Description}"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/ArgumentAttribute.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bawx4tp10u6r5 2 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/CommandAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Attributes; 2 | 3 | [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)] 4 | public sealed class CommandAttribute : System.Attribute 5 | { 6 | public string Name { get; private set; } 7 | /// 8 | /// Note: Supports BBCode. 9 | /// 10 | public string Description { get; private set; } 11 | /// 12 | /// Note: Supports BBCode. 13 | /// 14 | public string Manual { get; private set; } 15 | public string[] Aliases { get; private set; } 16 | 17 | public CommandAttribute(string name, string description = "", string manual = "", params string[] aliases) 18 | { 19 | Name = name; 20 | Description = description; 21 | Manual = manual; 22 | Aliases = aliases; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/CommandAttribute.cs.uid: -------------------------------------------------------------------------------- 1 | uid://ojc7n6436jrl 2 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/CommandInputAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using YAT.Classes; 4 | using YAT.Helpers; 5 | 6 | namespace YAT.Attributes; 7 | 8 | [AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] 9 | public class CommandInputAttribute : Attribute 10 | { 11 | public readonly string Name, Description; 12 | public readonly List Types = new(); 13 | 14 | public CommandInputAttribute(string name, string type, string description = "") 15 | { 16 | Name = name; 17 | Description = description; 18 | 19 | if (string.IsNullOrEmpty(name)) 20 | throw new ArgumentException($"{nameof(name)} cannot be empty.", nameof(name)); 21 | 22 | if (string.IsNullOrEmpty(type)) 23 | throw new ArgumentNullException(Messages.InvalidCommandInputType(type, name)); 24 | 25 | foreach (var t in type.Split('|')) 26 | { 27 | if (Parser.TryParseCommandInputType(t, out var commandInputType)) 28 | { 29 | Types.Add(commandInputType); 30 | continue; 31 | } 32 | 33 | throw new ArgumentException(Messages.InvalidCommandInputType(t, name)); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/CommandInputAttribute.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bag74yttuxd7b 2 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/DescriptionAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Attributes; 2 | 3 | [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)] 4 | public sealed class DescriptionAttribute : System.Attribute 5 | { 6 | public string Description { get; private set; } 7 | 8 | public DescriptionAttribute(string description) 9 | { 10 | Description = description; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/DescriptionAttribute.cs.uid: -------------------------------------------------------------------------------- 1 | uid://xq4338e4c3sa 2 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/ExtensionAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Attributes; 2 | 3 | [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)] 4 | public sealed class ExtensionAttribute : System.Attribute 5 | { 6 | public string Name { get; private set; } 7 | public string Description { get; private set; } 8 | public string Manual { get; private set; } 9 | public string[] Aliases { get; private set; } 10 | 11 | public ExtensionAttribute(string name, string description = "", string manual = "", params string[] aliases) 12 | { 13 | Name = name; 14 | Description = description; 15 | Manual = manual; 16 | Aliases = aliases; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/ExtensionAttribute.cs.uid: -------------------------------------------------------------------------------- 1 | uid://cp2tyb444rbwq 2 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/IgnoreAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace YAT.Attributes; 4 | 5 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] 6 | public sealed class IgnoreAttribute : Attribute { } 7 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/IgnoreAttribute.cs.uid: -------------------------------------------------------------------------------- 1 | uid://c1vg7x3cjhipr 2 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/NoValidateAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Attributes; 2 | 3 | [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)] 4 | public sealed class NoValidateAttribute : System.Attribute { } 5 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/NoValidateAttribute.cs.uid: -------------------------------------------------------------------------------- 1 | uid://cimtta1vxycw8 2 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/OptionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace YAT.Attributes; 5 | 6 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 7 | public sealed class OptionAttribute : CommandInputAttribute 8 | { 9 | public object? DefaultValue { get; private set; } 10 | 11 | public OptionAttribute(string name, string type, string description = "", object? defaultValue = null) 12 | : base(name, type, description) 13 | { 14 | DefaultValue = defaultValue; 15 | } 16 | 17 | public override string ToString() 18 | { 19 | string types = string.Join(" | ", Types.Select(t => t.Type)); 20 | 21 | return $"[b]{Name}[/b]: {types} - {Description}"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/OptionAttribute.cs.uid: -------------------------------------------------------------------------------- 1 | uid://7o0x1r0pkbcp 2 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/ThreadedAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Attributes; 2 | 3 | [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)] 4 | public sealed class ThreadedAttribute : System.Attribute { } 5 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/ThreadedAttribute.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dthecunr1adtl 2 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/TitleAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Attributes; 2 | 3 | [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)] 4 | public sealed class TitleAttribute : System.Attribute 5 | { 6 | public string Title { get; private set; } 7 | 8 | public TitleAttribute(string title) 9 | { 10 | Title = title; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/TitleAttribute.cs.uid: -------------------------------------------------------------------------------- 1 | uid://tie5hvabu834 2 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/UsageAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Attributes; 2 | 3 | [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)] 4 | public sealed class UsageAttribute : System.Attribute 5 | { 6 | public string Usage { get; private set; } 7 | 8 | public UsageAttribute(string usage) 9 | { 10 | Usage = usage; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /addons/yat/src/attributes/UsageAttribute.cs.uid: -------------------------------------------------------------------------------- 1 | uid://0r6gl6o0rpvh 2 | -------------------------------------------------------------------------------- /addons/yat/src/classes/CommandType.cs: -------------------------------------------------------------------------------- 1 | using YAT.Enums; 2 | 3 | namespace YAT.Classes; 4 | 5 | public class CommandType 6 | { 7 | public string Name { get; init; } = string.Empty; 8 | public ECommandInputType Type { get; init; } = ECommandInputType.Void; 9 | public bool IsArray { get; init; } 10 | public string TypeDefinition { get; protected set; } 11 | 12 | public CommandType(string name, ECommandInputType type, bool isArray) 13 | { 14 | Name = name; 15 | Type = type; 16 | IsArray = isArray; 17 | TypeDefinition = Name; 18 | } 19 | 20 | public CommandType() 21 | { 22 | TypeDefinition = GenerateTypeDefinition(); 23 | } 24 | 25 | protected virtual string GenerateTypeDefinition() => Name; 26 | } 27 | -------------------------------------------------------------------------------- /addons/yat/src/classes/CommandType.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dm5824l14bujo 2 | -------------------------------------------------------------------------------- /addons/yat/src/classes/CommandTypeEnum.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text; 3 | using YAT.Enums; 4 | 5 | namespace YAT.Classes; 6 | 7 | public class CommandTypeEnum : CommandType 8 | { 9 | public readonly Dictionary Values; 10 | 11 | public CommandTypeEnum(string name, bool isArray, Dictionary values) 12 | : base(name, ECommandInputType.Enum, isArray) 13 | { 14 | Values = values; 15 | TypeDefinition = GenerateTypeDefinition(); 16 | } 17 | 18 | protected override string GenerateTypeDefinition() 19 | { 20 | StringBuilder ss = new(); 21 | 22 | var enumerator = Values.GetEnumerator(); 23 | while (enumerator.MoveNext()) 24 | { 25 | var item = enumerator.Current; 26 | 27 | _ = ss.Append( 28 | (ss.Length == 0 ? string.Empty : ", ") + 29 | $"{item.Key}({item.Value})" 30 | ); 31 | } 32 | 33 | return ss.ToString(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /addons/yat/src/classes/CommandTypeEnum.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bw7swo3u7y6jm 2 | -------------------------------------------------------------------------------- /addons/yat/src/classes/CommandTypeRanged.cs: -------------------------------------------------------------------------------- 1 | using YAT.Enums; 2 | 3 | namespace YAT.Classes; 4 | 5 | public class CommandTypeRanged : CommandType 6 | { 7 | public readonly float Min = float.MinValue; 8 | public readonly float Max = float.MaxValue; 9 | 10 | public CommandTypeRanged(string name, ECommandInputType type, bool isArray, float min, float max) 11 | : base(name, type, isArray) 12 | { 13 | Min = min; 14 | Max = max; 15 | TypeDefinition = GenerateTypeDefinition(); 16 | } 17 | 18 | public CommandTypeRanged(string name, ECommandInputType type, bool isArray) 19 | : base(name, type, isArray) 20 | { 21 | TypeDefinition = GenerateTypeDefinition(); 22 | } 23 | 24 | public CommandTypeRanged() : base() { } 25 | 26 | protected override string GenerateTypeDefinition() 27 | { 28 | return $"{Name}({( 29 | Min == float.MinValue ? string.Empty : Min 30 | )}:{( 31 | Max == float.MaxValue ? string.Empty : Max 32 | )})"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /addons/yat/src/classes/CommandTypeRanged.cs.uid: -------------------------------------------------------------------------------- 1 | uid://cb16qpfmjhldm 2 | -------------------------------------------------------------------------------- /addons/yat/src/classes/Extensible.cs.uid: -------------------------------------------------------------------------------- 1 | uid://ou0xjnvsjf7h 2 | -------------------------------------------------------------------------------- /addons/yat/src/classes/LruCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace YAT.Classes; 5 | 6 | public class LRUCache where TKey : notnull where TValue : notnull 7 | { 8 | private readonly ushort capacity; 9 | private readonly Dictionary>> cache; 10 | private readonly LinkedList> lruList; 11 | 12 | public LRUCache(ushort capacity) 13 | { 14 | if (capacity == 0) 15 | { 16 | throw new ArgumentException("Capacity must be greater than 0.", nameof(capacity)); 17 | } 18 | 19 | this.capacity = capacity; 20 | cache = new(capacity); 21 | lruList = new(); 22 | } 23 | 24 | /// 25 | /// Gets the value associated with the specified key. 26 | /// 27 | /// The type of the value. 28 | /// The key of the value to get. 29 | /// The value associated with the specified key, or the default value of if the key is not found. 30 | public TValue Get(TKey key) 31 | { 32 | if (cache.TryGetValue(key, out var node)) 33 | { 34 | // Move the accessed item to the front of the list 35 | lruList.Remove(node); 36 | lruList.AddFirst(node); 37 | return node.Value.Value; 38 | } 39 | return default!; 40 | } 41 | 42 | /// 43 | /// Adds a new key-value pair to the cache. 44 | /// If the cache is already at capacity, the least recently used item is removed. 45 | /// 46 | /// The key of the item to add. 47 | /// The value of the item to add. 48 | public void Add(TKey key, TValue value) 49 | { 50 | if (cache.Count >= capacity && lruList.Last is not null) 51 | { 52 | // Remove the least recently used item 53 | var lastNode = lruList.Last; 54 | lruList.RemoveLast(); 55 | _ = cache.Remove(lastNode!.Value.Key); 56 | } 57 | 58 | lruList.AddFirst(new LinkedListNode>(new(key, value))); 59 | cache[key] = lruList.First!; 60 | } 61 | 62 | public int Size => cache.Count; 63 | } 64 | 65 | public class LRUItem where TKey : notnull where TValue : notnull 66 | { 67 | public TKey Key { get; } 68 | public TValue Value { get; } 69 | 70 | public LRUItem(TKey key, TValue value) 71 | { 72 | Key = key; 73 | Value = value; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /addons/yat/src/classes/LruCache.cs.uid: -------------------------------------------------------------------------------- 1 | uid://m75ohdjaj6ic 2 | -------------------------------------------------------------------------------- /addons/yat/src/classes/Parser.cs.uid: -------------------------------------------------------------------------------- 1 | uid://ijq1jiuuh1it 2 | -------------------------------------------------------------------------------- /addons/yat/src/classes/Pipeline.cs.uid: -------------------------------------------------------------------------------- 1 | uid://ds6y7t7fptxi0 2 | -------------------------------------------------------------------------------- /addons/yat/src/classes/clipboard/Clipboard.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dwu5gtenf2k1d 2 | -------------------------------------------------------------------------------- /addons/yat/src/classes/clipboard/CopyImageToClipboard.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [string]$imagePath 3 | ) 4 | 5 | # Check if the path provided is valid 6 | if (-not (Test-Path $imagePath -PathType Leaf)) { 7 | Write-Host "Invalid image path. Please provide a valid path to an image file." 8 | exit 1 9 | } 10 | 11 | Add-Type -AssemblyName System.Windows.Forms 12 | 13 | $imageBytes = [System.IO.File]::ReadAllBytes($imagePath) 14 | $imageStream = New-Object System.IO.MemoryStream(,$imageBytes) 15 | $image = [System.Drawing.Image]::FromStream($imageStream) 16 | $bitmap = New-Object System.Drawing.Bitmap($image) 17 | 18 | [System.Windows.Forms.Clipboard]::SetImage($bitmap) 19 | 20 | $imageStream.Dispose() 21 | $image.Dispose() 22 | $bitmap.Dispose() 23 | 24 | Write-Host "Image copied to clipboard successfully." 25 | -------------------------------------------------------------------------------- /addons/yat/src/classes/managers/command_manager/CommandManager.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dohlxoi5nh0ie 2 | -------------------------------------------------------------------------------- /addons/yat/src/classes/managers/command_manager/CommandManager.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=2 format=3 uid="uid://3gcpwd2vlow"] 2 | 3 | [ext_resource type="Script" uid="uid://dohlxoi5nh0ie" path="res://addons/yat/src/classes/managers/command_manager/CommandManager.cs" id="1_a1dj7"] 4 | 5 | [node name="CommandManager" type="Node"] 6 | script = ExtResource("1_a1dj7") 7 | -------------------------------------------------------------------------------- /addons/yat/src/classes/managers/preferences_manager/PreferencesManager.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using YAT.Resources; 3 | 4 | namespace YAT.Classes.Managers; 5 | 6 | public partial class PreferencesManager : Node 7 | { 8 | [Signal] public delegate void PreferencesUpdatedEventHandler(YatPreferences preferences); 9 | 10 | [Export] public YatPreferences Preferences { get; set; } = new(); 11 | 12 | private const string PREFERENCES_PATH = "user://yat_preferences.tres"; 13 | #nullable disable 14 | private YatPreferences _defaultPreferences; 15 | #nullable restore 16 | 17 | public override void _Ready() 18 | { 19 | _defaultPreferences = Preferences.Duplicate() as YatPreferences; 20 | 21 | _ = Load(); 22 | } 23 | 24 | public void RestoreDefaults() 25 | { 26 | Preferences = (_defaultPreferences.Duplicate() as YatPreferences)!; 27 | _ = EmitSignal(SignalName.PreferencesUpdated, Preferences!); 28 | } 29 | 30 | public bool Save() 31 | { 32 | return ResourceSaver.Save(Preferences, PREFERENCES_PATH) == Error.Ok; 33 | } 34 | 35 | public bool Load() 36 | { 37 | if (!ResourceLoader.Exists(PREFERENCES_PATH)) 38 | { 39 | return false; 40 | } 41 | 42 | Preferences = ResourceLoader.Load( 43 | PREFERENCES_PATH, 44 | cacheMode: ResourceLoader.CacheMode.Replace 45 | ); 46 | _ = EmitSignal(SignalName.PreferencesUpdated, Preferences); 47 | 48 | return true; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /addons/yat/src/classes/managers/preferences_manager/PreferencesManager.cs.uid: -------------------------------------------------------------------------------- 1 | uid://cvqhej3pldqta 2 | -------------------------------------------------------------------------------- /addons/yat/src/classes/managers/preferences_manager/PreferencesManager.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=2 format=3 uid="uid://b8xfvdai1l0vo"] 2 | 3 | [ext_resource type="Script" uid="uid://cvqhej3pldqta" path="res://addons/yat/src/classes/managers/preferences_manager/PreferencesManager.cs" id="1_dp104"] 4 | 5 | [node name="PreferencesManager" type="Node"] 6 | script = ExtResource("1_dp104") 7 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Cat.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bhhbjnjdlfgwr 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/CheckUpdate.cs: -------------------------------------------------------------------------------- 1 | using YAT.Attributes; 2 | using YAT.Classes; 3 | using YAT.Interfaces; 4 | using YAT.Types; 5 | using YAT.Update; 6 | 7 | namespace YAT.Commands; 8 | 9 | [Command("cu")] 10 | [Description("Check if YAT update is available.")] 11 | public sealed class CheckUpdate : ICommand 12 | { 13 | public CommandResult Execute(CommandData data) 14 | { 15 | (bool isSuccess, ReleaseTagInfo? info) = Release.GetLatestVersion(); 16 | SemanticVersion? currentVersion = Updater.GetCurrentVersion(); 17 | 18 | if (!isSuccess || info is null) 19 | { 20 | return ICommand.Failure( 21 | "YAT was unable to download information about new releases." 22 | ); 23 | } 24 | 25 | if (currentVersion is null) 26 | { 27 | return ICommand.Failure("YAT version information is unavailable."); 28 | } 29 | 30 | if (info.Version == currentVersion) 31 | { 32 | return ICommand.Success( 33 | message: $"YAT {currentVersion} is up-to-date." 34 | ); 35 | } 36 | 37 | if (info.Version > currentVersion) 38 | { 39 | return ICommand.Success( 40 | message: $"A new version of YAT {info.Version} is available.\n" 41 | + "Navigate to the editor to update YAT." 42 | ); 43 | } 44 | 45 | return ICommand.Failure("Something went wrong."); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /addons/yat/src/commands/CheckUpdate.cs.uid: -------------------------------------------------------------------------------- 1 | uid://01lf3iecnkug 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Cls.cs: -------------------------------------------------------------------------------- 1 | using YAT.Attributes; 2 | using YAT.Interfaces; 3 | using YAT.Types; 4 | 5 | namespace YAT.Commands; 6 | 7 | [Command("cls", "Clears the console.", aliases: "clear")] 8 | public sealed class Cls : ICommand 9 | { 10 | public CommandResult Execute(CommandData data) 11 | { 12 | data.Terminal.Clear(); 13 | 14 | return ICommand.Success(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Cls.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bsaa6iht50uki 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Cn.cs.uid: -------------------------------------------------------------------------------- 1 | uid://b2ufb5gixhgjd 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Cowsay.cs.uid: -------------------------------------------------------------------------------- 1 | uid://b4neghitvas8o 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Crash.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using YAT.Attributes; 3 | using YAT.Interfaces; 4 | using YAT.Types; 5 | 6 | namespace YAT.Commands; 7 | 8 | [Command("crash", "Crashes the game.")] 9 | [Option("-message", "string", "The message to when crashing.", ":c")] 10 | public sealed class Crash : ICommand 11 | { 12 | public CommandResult Execute(CommandData data) 13 | { 14 | OS.Crash((string)data.Options["-message"]); 15 | 16 | return ICommand.Success(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Crash.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bnm8o4qcbnna2 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Cs.cs.uid: -------------------------------------------------------------------------------- 1 | uid://yxdixp21jiav 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Dollar.cs.uid: -------------------------------------------------------------------------------- 1 | uid://c36rb0q8r48hb 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Ds.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Linq; 4 | using System.Text; 5 | using YAT.Attributes; 6 | using YAT.Debug; 7 | using YAT.Helpers; 8 | using YAT.Interfaces; 9 | using YAT.Types; 10 | 11 | namespace YAT.Commands; 12 | 13 | [Command("ds", "Displays items in the debug screen.")] 14 | [Argument("screens", "stop|all|string", "Debug screen/s to display.")] 15 | [Option("-h", "bool", "Displays this help message.")] 16 | [Option("--interval", "float(0.05:)", "Update interval.", 0f)] 17 | public sealed class Ds : ICommand 18 | { 19 | private static DebugScreen? _debug; 20 | 21 | public CommandResult Execute(CommandData data) 22 | { 23 | bool showHelp = (bool)data.Options["-h"]; 24 | string screens = (string)data.Arguments["screens"]; 25 | float interval = (float)data.Options["--interval"]; 26 | 27 | _debug ??= data.Yat.GetTree().Root.GetNode("/root/DebugScreen"); 28 | 29 | _debug.UpdateInterval = interval == 0f 30 | ? DebugScreen.DefaultUpdateInterval 31 | : interval; 32 | 33 | if (showHelp) 34 | { 35 | return ICommand.Ok(message: Help()); 36 | } 37 | 38 | switch (screens.ToLowerInvariant()) 39 | { 40 | case "all": 41 | _debug.RunAll(); 42 | break; 43 | case "stop": 44 | _debug.RunSelected(); 45 | break; 46 | default: 47 | _debug.RunSelected(screens.Split(",", StringSplitOptions.TrimEntries)); 48 | break; 49 | } 50 | 51 | return ICommand.Success(); 52 | } 53 | 54 | private static string Help() 55 | { 56 | StringBuilder message = new("Registered debug items:\n"); 57 | 58 | foreach (Type type in DebugScreen.RegisteredItems.Values 59 | .SelectMany(static x => x) 60 | ) 61 | { 62 | string title = type.GetAttribute()?.Title ?? type.Name; 63 | _ = message.AppendLine( 64 | CultureInfo.InvariantCulture, 65 | $"- [b]{title}[/b]: {type.Name}" 66 | ); 67 | } 68 | 69 | return message.ToString(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Ds.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dp4h00blmum03 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Echo.cs: -------------------------------------------------------------------------------- 1 | using YAT.Attributes; 2 | using YAT.Interfaces; 3 | using YAT.Types; 4 | 5 | namespace YAT.Commands; 6 | 7 | [Command("echo")] 8 | [Description("Displays the specified text.")] 9 | [Argument("message", "string", "The text to display.")] 10 | public sealed class Echo : ICommand 11 | { 12 | public CommandResult Execute(CommandData data) 13 | { 14 | string message = (string)data.Arguments["message"]; 15 | return ICommand.Ok([message], message); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Echo.cs.uid: -------------------------------------------------------------------------------- 1 | uid://c1hyvohmen6hk 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Forcegc.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using YAT.Attributes; 3 | using YAT.Interfaces; 4 | using YAT.Types; 5 | 6 | namespace YAT.Commands; 7 | 8 | [Command("forcegc", aliases: new[] { "fgc" })] 9 | [Description("Forces the garbage collector to run.")] 10 | [Option("-g", "int(0:)", "The number of the oldest generation to be garbage collected.", 0)] 11 | [Option( 12 | "-m", 13 | "int(0:3)", 14 | "A value that specifies whether the GC is forced - 1 (default - 0), optimized - 2 or aggressive - 3.", 15 | 0 16 | )] 17 | [Option("-b", "bool", "A value that specifies whether the GC is blocking.")] 18 | [Option("-c", "bool", "A value that specifies whether the GC is forced to compact the heap.")] 19 | public sealed class Forcegc : ICommand 20 | { 21 | public CommandResult Execute(CommandData data) 22 | { 23 | int gen = (int)data.Options["-g"]; 24 | GCCollectionMode mode = (GCCollectionMode)data.Options["-m"]; 25 | bool block = (bool)data.Options["-b"]; 26 | bool compact = (bool)data.Options["-c"]; 27 | 28 | if (gen > GC.MaxGeneration) 29 | { 30 | return ICommand.Failure( 31 | $"The generation number must be between 0 and {GC.MaxGeneration}." 32 | ); 33 | } 34 | 35 | GC.Collect( 36 | mode == GCCollectionMode.Aggressive 37 | ? GC.MaxGeneration 38 | : gen, 39 | mode, 40 | mode == GCCollectionMode.Aggressive || block, 41 | mode == GCCollectionMode.Aggressive || compact 42 | ); 43 | return ICommand.Success(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Forcegc.cs.uid: -------------------------------------------------------------------------------- 1 | uid://ci7vcq280sl5a 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Fov.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using YAT.Attributes; 3 | using YAT.Interfaces; 4 | using YAT.Types; 5 | 6 | namespace YAT.Commands; 7 | 8 | [Command("fov", "Sets the field of view for the camera.")] 9 | [Argument("fov", "float(1:179)", "The field of view to set.")] 10 | public sealed class Fov : ICommand 11 | { 12 | public CommandResult Execute(CommandData data) 13 | { 14 | float fov = (float)data.Arguments["fov"]; 15 | Camera3D? camera = data.Yat.GetTree().Root.GetCamera3D(); 16 | 17 | if (camera is null) 18 | { 19 | return ICommand.Failure("No 3D camera found."); 20 | } 21 | 22 | camera.Fov = fov; 23 | 24 | return ICommand.Success([$"{fov}"], $"Field of view set to {fov}."); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Fov.cs.uid: -------------------------------------------------------------------------------- 1 | uid://c0f63qcf3hem1 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/History.cs.uid: -------------------------------------------------------------------------------- 1 | uid://deevh7iy6pp4a 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Inspect.cs.uid: -------------------------------------------------------------------------------- 1 | uid://16h6me4tupfi 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Ip.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Text; 3 | using Godot; 4 | using Godot.Collections; 5 | using YAT.Attributes; 6 | using YAT.Interfaces; 7 | using YAT.Scenes; 8 | using YAT.Types; 9 | 10 | namespace YAT.Commands; 11 | 12 | [Command("ip")] 13 | [Description("Displays information about the local network interfaces.")] 14 | [Argument("action", "addr", "The action to perform.")] 15 | public sealed class Ip : ICommand 16 | { 17 | public CommandResult Execute(CommandData data) 18 | { 19 | string action = (string)data.Arguments["action"]; 20 | 21 | if (action == "addr") 22 | { 23 | return ICommand.Success([PrintLocalInterfaces(data.Terminal)]); 24 | } 25 | 26 | return ICommand.Success(); 27 | } 28 | 29 | private static string PrintLocalInterfaces(BaseTerminal terminal) 30 | { 31 | StringBuilder sb = new(); 32 | Array interfaces = IP.GetLocalInterfaces(); 33 | 34 | if (interfaces.Count == 0) 35 | { 36 | _ = sb.AppendLine("No local interfaces found."); 37 | } 38 | 39 | foreach (Dictionary? iface in interfaces) 40 | { 41 | _ = sb.AppendLine( 42 | CultureInfo.InvariantCulture, 43 | $"[b]{iface["index"]}[/b]: {iface["friendly"]} ({iface["name"]})" 44 | ); 45 | _ = sb.AppendLine("Addresses:"); 46 | 47 | foreach (string addr in iface["addresses"].AsStringArray()) 48 | { 49 | _ = sb.AppendLine(CultureInfo.InvariantCulture, $"\t{addr}"); 50 | } 51 | 52 | _ = sb.AppendLine(); 53 | } 54 | 55 | terminal.Print(sb.ToString()); 56 | return sb.ToString(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Ip.cs.uid: -------------------------------------------------------------------------------- 1 | uid://crnnqg2cc2ewv 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Lcr.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using YAT.Attributes; 3 | using YAT.Enums; 4 | using YAT.Helpers; 5 | using YAT.Interfaces; 6 | using YAT.Types; 7 | 8 | namespace YAT.Commands; 9 | 10 | [Command("lcr", "Shows the result of the last command.")] 11 | [Option("-l", "bool", "Also displays name of the result.")] 12 | public sealed class Lcr : ICommand 13 | { 14 | public CommandResult Execute(CommandData data) 15 | { 16 | ECommandResult result = data.Terminal.LastCommandResult; 17 | 18 | return ICommand.Ok( 19 | [result.ToString()], 20 | (bool)data.Options["-l"] 21 | ? $"{result} ({(int)result})" 22 | : ((int)result).ToStringInvariant() 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Lcr.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dx1n0hj48ajue 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/List.cs.uid: -------------------------------------------------------------------------------- 1 | uid://b0oinkoqsvrtw 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Load.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dxj32x551bml2 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Locale.cs.uid: -------------------------------------------------------------------------------- 1 | uid://datti053vxx37 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Ls.cs.uid: -------------------------------------------------------------------------------- 1 | uid://ctytfpug6r4c2 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Man.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using YAT.Attributes; 4 | using YAT.Classes; 5 | using YAT.Helpers; 6 | using YAT.Interfaces; 7 | using YAT.Scenes; 8 | using YAT.Types; 9 | 10 | namespace YAT.Commands; 11 | 12 | [Command("man", "Displays the manual for a command.")] 13 | [Argument("command_name", "string", 14 | "The name of the command to display the manual for." 15 | )] 16 | [Option("-e", "bool", 17 | "Embed the manual in the terminal. Instead of opening in a new window." 18 | )] 19 | public sealed class Man : ICommand 20 | { 21 | private static readonly LRUCache _cache = new(10); 22 | 23 | public CommandResult Execute(CommandData data) 24 | { 25 | string commandName = (string)data.Arguments["command_name"]; 26 | bool embed = (bool)data.Options["-e"]; 27 | 28 | if (!RegisteredCommands.Registered.TryGetValue( 29 | commandName, 30 | out Type? value 31 | )) 32 | { 33 | return ICommand.InvalidCommand(Messages.UnknownCommand(commandName)); 34 | } 35 | 36 | ICommand command = (ICommand)Activator.CreateInstance(value)!; 37 | 38 | // Check if the command manual is already in the cache. 39 | if (_cache.Get(commandName) is string manual) 40 | { 41 | if (embed) 42 | { 43 | data.Terminal.Print(manual); 44 | } 45 | else 46 | { 47 | data.Terminal.FullWindowDisplay.Open(manual); 48 | } 49 | 50 | return ICommand.Success(); 51 | } 52 | 53 | StringBuilder bManual = command.GenerateCommandManual(); 54 | _ = bManual.Append(command.GenerateArgumentsManual()) 55 | .Append(command.GenerateOptionsManual()) 56 | .Append(command.GenerateSignalsManual()); 57 | 58 | if (command is Extensible extensible) 59 | { 60 | _ = bManual.Append(extensible.GenerateExtensionsManual()); 61 | } 62 | 63 | _cache.Add(commandName, bManual.ToString()); 64 | 65 | if (embed) 66 | { 67 | data.Terminal.Print(bManual); 68 | } 69 | else 70 | { 71 | data.Terminal.FullWindowDisplay.Open(bManual.ToString()); 72 | } 73 | 74 | return ICommand.Success(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Man.cs.uid: -------------------------------------------------------------------------------- 1 | uid://vricwghk4nph 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Pause.cs: -------------------------------------------------------------------------------- 1 | using YAT.Attributes; 2 | using YAT.Interfaces; 3 | using YAT.Types; 4 | 5 | namespace YAT.Commands; 6 | 7 | [Command("pause", "Toggles the game pause state.")] 8 | public sealed class Pause : ICommand 9 | { 10 | public CommandResult Execute(CommandData data) 11 | { 12 | data.Yat.GetTree().Paused = !data.Yat.GetTree().Paused; 13 | 14 | return ICommand.Success([data.Yat.GetTree().Paused.ToString()]); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Pause.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dt7ulnxnm481h 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Ping.cs.uid: -------------------------------------------------------------------------------- 1 | uid://7b7grvhyv8c7 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Preferences.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using YAT.Attributes; 3 | using YAT.Interfaces; 4 | using YAT.Types; 5 | 6 | namespace YAT.Commands; 7 | 8 | [Command("preferences", aliases: "prefs")] 9 | [Description("Creates a window with the available preferences.")] 10 | public sealed class Preferences : ICommand 11 | { 12 | #nullable disable 13 | private static Scenes.Preferences _windowInstance; 14 | #nullable restore 15 | private static readonly PackedScene _prefsWindow = GD.Load( 16 | "uid://ca2i4r24ny7y3" 17 | ); 18 | 19 | public CommandResult Execute(CommandData data) 20 | { 21 | bool instanceValid = GodotObject.IsInstanceValid(_windowInstance); 22 | 23 | if (instanceValid) 24 | { 25 | CloseWindow(); 26 | return ICommand.Success(); 27 | } 28 | 29 | _windowInstance = _prefsWindow.Instantiate(); 30 | data.Yat.Windows.AddChild(_windowInstance); 31 | 32 | return ICommand.Success(); 33 | } 34 | 35 | private static void CloseWindow() 36 | { 37 | _windowInstance.QueueFree(); 38 | _windowInstance = null; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Preferences.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dwqklgs5x6kne 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/QuickCommands.cs.uid: -------------------------------------------------------------------------------- 1 | uid://fq3m77huunf 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Quit.cs: -------------------------------------------------------------------------------- 1 | using YAT.Attributes; 2 | using YAT.Interfaces; 3 | using YAT.Scenes; 4 | using YAT.Types; 5 | 6 | namespace YAT.Commands; 7 | 8 | [Command("quit", "By default quits the game.", aliases: "exit")] 9 | [Option("-t", "bool", "Closes the terminal.")] 10 | public sealed class Quit : ICommand 11 | { 12 | #nullable disable 13 | private YAT _yat; 14 | private BaseTerminal _terminal; 15 | #nullable restore 16 | 17 | public CommandResult Execute(CommandData data) 18 | { 19 | bool t = (bool)data.Options["-t"]; 20 | 21 | _yat = data.Yat; 22 | _terminal = data.Terminal; 23 | 24 | if (t) 25 | { 26 | CloseTerminal(); 27 | } 28 | else 29 | { 30 | QuitTheGame(); 31 | } 32 | 33 | return ICommand.Success(); 34 | } 35 | 36 | private void CloseTerminal() 37 | { 38 | _ = _yat.CallDeferred("CloseTerminal"); 39 | } 40 | 41 | private void QuitTheGame() 42 | { 43 | _terminal.Print("Quitting..."); 44 | _yat.GetTree().Quit(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Quit.cs.uid: -------------------------------------------------------------------------------- 1 | uid://davwo3pipf3ex 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Reset.cs: -------------------------------------------------------------------------------- 1 | using YAT.Attributes; 2 | using YAT.Interfaces; 3 | using YAT.Types; 4 | 5 | namespace YAT.Commands; 6 | 7 | [Command( 8 | "reset", 9 | "Resets the terminal to its default position and/or size." 10 | )] 11 | [Argument("action", "all|position|size", "The action to perform.")] 12 | public sealed class Reset : ICommand 13 | { 14 | public CommandResult Execute(CommandData data) 15 | { 16 | switch ((string)data.Arguments["action"]) 17 | { 18 | case "size": 19 | _ = data.Terminal.EmitSignal(nameof(data.Terminal.SizeResetRequested)); 20 | break; 21 | case "position": 22 | _ = data.Terminal.EmitSignal(nameof(data.Terminal.PositionResetRequested)); 23 | break; 24 | case "all": 25 | _ = data.Terminal.EmitSignal(nameof(data.Terminal.SizeResetRequested)); 26 | _ = data.Terminal.EmitSignal(nameof(data.Terminal.PositionResetRequested)); 27 | break; 28 | default: 29 | break; 30 | } 31 | 32 | return ICommand.Success(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Reset.cs.uid: -------------------------------------------------------------------------------- 1 | uid://cscjewmfet1su 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Restart.cs: -------------------------------------------------------------------------------- 1 | using YAT.Attributes; 2 | using YAT.Interfaces; 3 | using YAT.Types; 4 | 5 | namespace YAT.Commands; 6 | 7 | [Command("restart", "Restarts the level.", aliases: "reboot")] 8 | public sealed class Restart : ICommand 9 | { 10 | public CommandResult Execute(CommandData data) 11 | { 12 | data.Terminal.Print($"Restarting {data.Yat.GetTree().CurrentScene.Name}..."); 13 | _ = data.Yat.GetTree().ReloadCurrentScene(); 14 | 15 | return ICommand.Success(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Restart.cs.uid: -------------------------------------------------------------------------------- 1 | uid://c2n7kj2gqw428 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Set.cs: -------------------------------------------------------------------------------- 1 | using YAT.Attributes; 2 | using YAT.Classes; 3 | using YAT.Interfaces; 4 | using YAT.Types; 5 | 6 | namespace YAT.Commands; 7 | 8 | [Command("set", "Sets a variable to a value.")] 9 | [Argument("variable", "string", "The name of the variable to set.")] 10 | [Argument("value", "string", "The value to set the variable to.")] 11 | public partial class Set : Extensible, ICommand 12 | { 13 | public CommandResult Execute(CommandData data) 14 | { 15 | var extensions = GetCommandExtensions("set"); 16 | 17 | if (extensions is null) 18 | { 19 | return ICommand.Failure("No extensions found."); 20 | } 21 | 22 | return extensions.TryGetValue((string)data.Arguments["variable"], out var extension) 23 | ? ExecuteExtension(extension, data with { RawData = data.RawData[1..] }) 24 | : ICommand.Failure("Variable not found."); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Set.cs.uid: -------------------------------------------------------------------------------- 1 | uid://cqq4pchlvkshy 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Sleep.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using YAT.Attributes; 3 | using YAT.Helpers; 4 | using YAT.Interfaces; 5 | using YAT.Types; 6 | 7 | namespace YAT.Commands; 8 | 9 | [Command("sleep")] 10 | [Description( 11 | "Suspends the current thread for the specified number of milliseconds. " 12 | + "Command used for testing purposes." 13 | )] 14 | [Argument("ms", "int(0:", "Number of miliseconds.")] 15 | [Threaded] 16 | public sealed class Sleep : ICommand 17 | { 18 | public CommandResult Execute(CommandData data) 19 | { 20 | Thread.Sleep((int)data.Arguments["ms"]); 21 | return ICommand.Ok([((int)data.Arguments["ms"]).ToStringInvariant()]); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Sleep.cs.uid: -------------------------------------------------------------------------------- 1 | uid://vu1oyrnx78ob 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Sr.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using Godot; 3 | using YAT.Attributes; 4 | using YAT.Interfaces; 5 | using YAT.Types; 6 | 7 | namespace YAT.Commands; 8 | 9 | [Command("sr", "Set the screen resolution.")] 10 | [Option("-w", "int(1:)", "The width of the screen resolution.", -1)] 11 | [Option("-h", "int(1:)", "The height of the screen resolution.", -1)] 12 | [Option("-s", "float(0:2)", "Resolution scale.", -1f)] 13 | [Option("-fsr", "bool", "Enable AMD FSR 1.0")] 14 | [Option("-fsr2", "bool", "Enable AMD FSR 2.2")] 15 | public sealed class Sr : ICommand 16 | { 17 | public CommandResult Execute(CommandData data) 18 | { 19 | int width = (int)data.Options["-w"]; 20 | int height = (int)data.Options["-h"]; 21 | float scale = (float)data.Options["-s"]; 22 | bool fsr = (bool)data.Options["-fsr"]; 23 | bool fsr2 = (bool)data.Options["-fsr2"]; 24 | 25 | Viewport viewport = data.Yat.GetViewport(); 26 | Window window = viewport.GetWindow(); 27 | 28 | window.Size = new( 29 | width == -1 ? window.Size.X : width, 30 | height == -1 ? window.Size.Y : height 31 | ); 32 | 33 | viewport.Scaling3DScale = scale == -1f 34 | ? viewport.Scaling3DScale 35 | : scale; 36 | 37 | window.MoveToCenter(); 38 | 39 | viewport.Scaling3DMode = Viewport.Scaling3DModeEnum.Bilinear; 40 | 41 | if (fsr) 42 | { 43 | viewport.Scaling3DMode = Viewport.Scaling3DModeEnum.Fsr; 44 | } 45 | 46 | if (fsr2) 47 | { 48 | viewport.Scaling3DMode = Viewport.Scaling3DModeEnum.Fsr2; 49 | } 50 | 51 | data.Terminal.Output.Print( 52 | string.Format( 53 | CultureInfo.InvariantCulture, 54 | "Screen resolution: {0}x{1}, scale: {2} ({3}x{4}), mode: {5}.", 55 | window.Size.X, window.Size.Y, 56 | viewport.Scaling3DScale, 57 | (int)(window.Size.X * viewport.Scaling3DScale), 58 | (int)(window.Size.Y * viewport.Scaling3DScale), 59 | viewport.Scaling3DMode 60 | ) 61 | ); 62 | 63 | return ICommand.Success([$"{window.Size.X}x{window.Size.Y}"]); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Sr.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dub8efdyhoxft 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Ss.cs.uid: -------------------------------------------------------------------------------- 1 | uid://0d00q0eepib6 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Sys.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using YAT.Attributes; 3 | using YAT.Interfaces; 4 | using YAT.Types; 5 | using static YAT.Helpers.OS; 6 | 7 | namespace YAT.Commands; 8 | 9 | [Command("sys", "Runs a system command.")] 10 | [Argument( 11 | "command", 12 | "string", 13 | "The command to run (if contains more than one word, you need to wrap it in " 14 | + "the parentheses)." 15 | )] 16 | [Option("-program", "string", 17 | "The program to run the command with (default to systems specific terminal).", 18 | "" 19 | )] 20 | [Threaded] 21 | public sealed class Sys : ICommand 22 | { 23 | public CommandResult Execute(CommandData data) 24 | { 25 | string program = (string)data.Options["-program"]; 26 | string command = (string)data.Arguments["command"]; 27 | string commandName = command.Split(' ')[0]; 28 | string commandArgs = command[commandName.Length..].Trim() ?? string.Empty; 29 | 30 | StringBuilder result = RunCommand( 31 | commandName, 32 | out EExecutionResult status, 33 | program, 34 | commandArgs 35 | ); 36 | 37 | if (status == EExecutionResult.Success) 38 | { 39 | data.Terminal.Output.Print(result.ToString()); 40 | } 41 | else 42 | { 43 | data.Terminal.Output.Error(result.ToString()); 44 | } 45 | 46 | return ICommand.Success(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Sys.cs.uid: -------------------------------------------------------------------------------- 1 | uid://ctu8obu1q2k3y 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Tfs.cs: -------------------------------------------------------------------------------- 1 | using YAT.Attributes; 2 | using YAT.Interfaces; 3 | using YAT.Types; 4 | using static Godot.DisplayServer; 5 | 6 | namespace YAT.Commands; 7 | 8 | [Command("tfs", "Toggles the full screen mode.")] 9 | [Option("-e", "bool", "Enables the exclusive full screen mode.")] 10 | public sealed class Tfs : ICommand 11 | { 12 | public CommandResult Execute(CommandData data) 13 | { 14 | bool exclusive = (bool)data.Options["-e"]; 15 | 16 | if (WindowGetMode() == WindowMode.Windowed) 17 | { 18 | WindowSetMode( 19 | exclusive 20 | ? WindowMode.ExclusiveFullscreen 21 | : WindowMode.Fullscreen 22 | ); 23 | } 24 | else 25 | { 26 | WindowSetMode(WindowMode.Windowed); 27 | } 28 | 29 | return ICommand.Success( 30 | [WindowGetMode().ToString()], 31 | $"Toggled screen mode to {WindowGetMode()}." 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Tfs.cs.uid: -------------------------------------------------------------------------------- 1 | uid://gghijqx777rm 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Timescale.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using YAT.Attributes; 3 | using YAT.Helpers; 4 | using YAT.Interfaces; 5 | using YAT.Types; 6 | 7 | namespace YAT.Commands; 8 | 9 | [Command("timescale", "Sets the timescale.")] 10 | [Option("-set", "float", "Sets the timescale to the specified number.", 1.0f)] 11 | public sealed class Timescale : ICommand 12 | { 13 | public CommandResult Execute(CommandData data) 14 | { 15 | Engine.TimeScale = (float)data.Options["-set"]; 16 | 17 | return ICommand.Success( 18 | [Engine.TimeScale.ToStringInvariant()] 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Timescale.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bbvnf1d08xlwl 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/ToggleAudio.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using YAT.Attributes; 3 | using YAT.Interfaces; 4 | using YAT.Types; 5 | 6 | namespace YAT.Commands; 7 | 8 | [Command("toggleaudio", "Toggles audio on or off.")] 9 | [Option("-id", "int(0:32767)", "The ID of the audio bus to toggle.", -1)] 10 | [Option("-name", "string", "The name of the audio bus to toggle.")] 11 | public sealed class ToggleAudio : ICommand 12 | { 13 | public CommandResult Execute(CommandData data) 14 | { 15 | int id = (int)data.Options["-id"]; 16 | string name = (string)data.Options["-name"]; 17 | 18 | if (id == -1 && string.IsNullOrEmpty(name)) 19 | { 20 | ToggleAll(); 21 | return ICommand.Success(); 22 | } 23 | 24 | if (id != -1 && !ToggleById(id)) 25 | { 26 | return ICommand.InvalidArguments("Invalid audio bus ID."); 27 | } 28 | 29 | return !string.IsNullOrEmpty(name) && !ToggleByName(name) 30 | ? ICommand.InvalidArguments("Invalid audio bus name.") 31 | : ICommand.Success(); 32 | } 33 | 34 | private static void ToggleAll() 35 | { 36 | for (int i = 0; i < AudioServer.BusCount; i++) 37 | { 38 | AudioServer.SetBusMute(i, !AudioServer.IsBusMute(i)); 39 | } 40 | } 41 | 42 | private static bool ToggleById(int id) 43 | { 44 | if (id < 0 || id >= AudioServer.BusCount) 45 | { 46 | return false; 47 | } 48 | 49 | AudioServer.SetBusMute(id, !AudioServer.IsBusMute(id)); 50 | 51 | return true; 52 | } 53 | 54 | private static bool ToggleByName(string name) 55 | { 56 | int id = AudioServer.GetBusIndex(name); 57 | 58 | if (id == -1) 59 | { 60 | return false; 61 | } 62 | 63 | AudioServer.SetBusMute(id, !AudioServer.IsBusMute(id)); 64 | 65 | return true; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /addons/yat/src/commands/ToggleAudio.cs.uid: -------------------------------------------------------------------------------- 1 | uid://cltxkcn65v28i 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/TraceRoute.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Net; 3 | using System.Text; 4 | using YAT.Attributes; 5 | using YAT.Helpers; 6 | using YAT.Interfaces; 7 | using YAT.Net; 8 | using YAT.Types; 9 | 10 | namespace YAT.Commands; 11 | 12 | [Command("traceroute", aliases: "trace")] 13 | [Description("Displays the route that packets take to reach the specified host.")] 14 | [Argument("hostname", "string", "The host to trace the route to.")] 15 | [Option("-t", "int(1:32767)", "The maximum time to wait for each reply, in milliseconds.", 10000)] 16 | [Option("-ttl", "int(1:255)", "The maximum number of hops to search for the target.", 30)] 17 | [Option("-b", "int(1:32767)", "The size of the buffer to send with the request.", 32)] 18 | [Option("-f", "bool", "Specifies that the packet can be fragmented.")] 19 | [Threaded] 20 | public sealed class TraceRoute : ICommand 21 | { 22 | public CommandResult Execute(CommandData data) 23 | { 24 | string hostname = (string)data.Arguments["hostname"]; 25 | NetworkingOptions options = new() 26 | { 27 | Timeout = (ushort)(int)data.Options["-t"], 28 | TTL = (ushort)(int)data.Options["-ttl"], 29 | BufferSize = (ushort)(int)data.Options["-b"], 30 | DontFragment = !(bool)data.Options["-f"] 31 | }; 32 | 33 | data.Terminal.Output.Print($"Tracing route to {hostname}..."); 34 | 35 | IEnumerable addresses = Networking.GetTraceRoute( 36 | hostname, 37 | options, 38 | data.CancellationToken 39 | ); 40 | StringBuilder result = new(); 41 | 42 | foreach (IPAddress? address in addresses) 43 | { 44 | _ = result.AppendLine(address?.ToString()); 45 | } 46 | 47 | return ICommand.Ok([result.ToString()], result.ToString()); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /addons/yat/src/commands/TraceRoute.cs.uid: -------------------------------------------------------------------------------- 1 | uid://buddnp2cb6lqi 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Version.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using YAT.Attributes; 3 | using YAT.Classes; 4 | using YAT.Interfaces; 5 | using YAT.Types; 6 | using YAT.Update; 7 | 8 | namespace YAT.Commands; 9 | 10 | [Command("version", "Displays the current game version.")] 11 | [Option("--yat", "bool", "Display YAT version.")] 12 | public sealed class Version : ICommand 13 | { 14 | private static readonly string _gameName, _gameVersion, _version; 15 | 16 | static Version() 17 | { 18 | _gameName = ProjectSettings.GetSetting("application/config/name").ToString(); 19 | _gameVersion = ProjectSettings.GetSetting("application/config/version").ToString(); 20 | 21 | if (string.IsNullOrEmpty(_gameName)) 22 | { 23 | _gameName = "Your Awesome Game"; 24 | } 25 | 26 | if (string.IsNullOrEmpty(_gameVersion)) 27 | { 28 | _gameVersion = "v0.0.0"; 29 | } 30 | 31 | _version = $"{_gameName} {_gameVersion}"; 32 | } 33 | 34 | public CommandResult Execute(CommandData data) 35 | { 36 | bool yat = (bool)data.Options["--yat"]; 37 | 38 | if (yat) 39 | { 40 | SemanticVersion? yatVersion = Updater.GetCurrentVersion(); 41 | 42 | return yatVersion is null 43 | ? ICommand.Failure("YAT version information is unavailable.") 44 | : ICommand.Ok(message: $"YAT {yatVersion}"); 45 | } 46 | 47 | return ICommand.Ok([_version], _version); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Version.cs.uid: -------------------------------------------------------------------------------- 1 | uid://b0qiou6hacija 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/View.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using Godot; 5 | using YAT.Attributes; 6 | using YAT.Helpers; 7 | using YAT.Interfaces; 8 | using YAT.Types; 9 | using static Godot.RenderingServer; 10 | 11 | namespace YAT.Commands; 12 | 13 | [Command( 14 | "view", 15 | "Changes the rendering mode of the viewport.\n" 16 | + "You can use either the name of the mode or the integer value.\n" 17 | + "See: [url=https://docs.godotengine.org/en/stable/classes/" 18 | + "class_renderingserver.html#class-renderingserver-method-set-debug-" 19 | + "generate-wireframes]ViewportDebugDraw[/url]." 20 | )] 21 | [Argument("mode", "string|int(0:)", "The type of debug draw to use.")] 22 | public sealed class View : ICommand 23 | { 24 | private static readonly int MAX_DRAW_MODE; 25 | private static readonly List Modes = []; 26 | 27 | static View() 28 | { 29 | Array values = Enum.GetValues(); 30 | MAX_DRAW_MODE = values.Length - 1; 31 | 32 | foreach (object? mode in values) 33 | { 34 | Modes.Add(mode!.ToString()!.ToLowerInvariant()); 35 | } 36 | } 37 | 38 | #nullable disable 39 | private YAT _yat; 40 | #nullable restore 41 | 42 | public CommandResult Execute(CommandData data) 43 | { 44 | string mode = (string)data.Arguments["mode"]; 45 | 46 | _yat = data.Yat; 47 | 48 | if (Modes.Contains(mode)) 49 | { 50 | return SetDebugDraw( 51 | Enum.Parse(mode, true) 52 | ); 53 | } 54 | 55 | if (!int.TryParse(mode, out int iMode)) 56 | { 57 | return ICommand.InvalidArguments($"Invalid mode: {mode}."); 58 | } 59 | 60 | return !IsValidMode(iMode) 61 | ? ICommand.InvalidArguments( 62 | $"Invalid mode: {mode}. Valid range: 0 to {MAX_DRAW_MODE}." 63 | ) 64 | : SetDebugDraw((ViewportDebugDraw)iMode); 65 | } 66 | 67 | private CommandResult SetDebugDraw(ViewportDebugDraw debugDraw) 68 | { 69 | ViewportSetDebugDraw(_yat.GetViewport().GetViewportRid(), debugDraw); 70 | 71 | return ICommand.Success( 72 | [((int)debugDraw).ToStringInvariant()], 73 | $"Set viewport debug draw to {debugDraw} ({(int)debugDraw})." 74 | ); 75 | } 76 | 77 | private static bool IsValidMode(int mode) 78 | { 79 | return mode >= 0 && mode <= MAX_DRAW_MODE; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /addons/yat/src/commands/View.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dqcvayp8d21n 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Watch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using YAT.Attributes; 4 | using YAT.Classes; 5 | using YAT.Interfaces; 6 | using YAT.Scenes; 7 | using YAT.Types; 8 | 9 | namespace YAT.Commands; 10 | 11 | [Threaded] 12 | [Command("watch")] 13 | [Description("Runs user-defined commands at regular intervals." + 14 | "\nNote: Not threaded commands might not work as expected." 15 | )] 16 | [Argument("command", "string", "The command to run.")] 17 | [Option("--interval", "float(0.5:60)", "The interval at which to run the command.", 1f)] 18 | public sealed class Watch : ICommand 19 | { 20 | public CommandResult Execute(CommandData data) 21 | { 22 | string[]? parsed = Parser.ParseCommand((string)data.Arguments["command"]); 23 | string commandName = parsed[0]; 24 | 25 | if (!RegisteredCommands.Registered.TryGetValue(commandName, out Type? type)) 26 | { 27 | return ICommand.InvalidArguments( 28 | $"Command '{commandName}' not found, exiting watch." 29 | ); 30 | } 31 | 32 | if (type.Name == nameof(Watch)) 33 | { 34 | return ICommand.Failure( 35 | "Cannot watch the watch command, exiting watch." 36 | ); 37 | } 38 | 39 | float interval = (float)data.Options["--interval"] * 1000; 40 | 41 | while (!data.CancellationToken.IsCancellationRequested) 42 | { 43 | bool success = data.Terminal.CommandManager 44 | .Run(parsed, data.Terminal); 45 | 46 | if (!success) 47 | { 48 | return ICommand.Failure( 49 | $"Error executing command '{commandName}', exiting watch." 50 | ); 51 | } 52 | 53 | Thread.Sleep((int)interval); 54 | } 55 | 56 | return ICommand.Success(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Watch.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dbsoon3sg802h 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Wenv.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using YAT.Attributes; 3 | using YAT.Interfaces; 4 | using YAT.Types; 5 | 6 | namespace YAT.Commands; 7 | 8 | [Command("wenv", "Manages the world environment.")] 9 | [Argument("action", "remove|restore", "Removes or restores the world environment.")] 10 | public sealed class Wenv : ICommand 11 | { 12 | #nullable disable 13 | private static Environment _world3DEnvironment; 14 | #nullable restore 15 | 16 | public CommandResult Execute(CommandData data) 17 | { 18 | string action = (string)data.Arguments["action"]; 19 | World3D world = data.Yat.GetTree().Root.World3D; 20 | 21 | return action == "remove" 22 | ? RemoveEnvironment(world) 23 | : RestoreEnvironment(world); 24 | } 25 | 26 | private static CommandResult RestoreEnvironment(World3D world) 27 | { 28 | if (world is null) 29 | { 30 | return ICommand.Failure("No world to restore environment to."); 31 | } 32 | 33 | if (_world3DEnvironment is null) 34 | { 35 | return ICommand.Failure("No environment to restore."); 36 | } 37 | 38 | world.Environment = _world3DEnvironment; 39 | _world3DEnvironment = null; 40 | 41 | return ICommand.Success(message: "Restored environment."); 42 | } 43 | 44 | private static CommandResult RemoveEnvironment(World3D world) 45 | { 46 | Environment? env = world?.Environment; 47 | 48 | if (world is null) 49 | { 50 | return ICommand.Failure("No world to remove environment from."); 51 | } 52 | 53 | if (env is null) 54 | { 55 | return ICommand.Failure("No environment to remove."); 56 | } 57 | 58 | _world3DEnvironment = env; 59 | world.Environment = null; 60 | 61 | return ICommand.Success(message: "Removed environment."); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Wenv.cs.uid: -------------------------------------------------------------------------------- 1 | uid://s225lk2nh5e 2 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Whereami.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using Godot; 3 | using YAT.Attributes; 4 | using YAT.Interfaces; 5 | using YAT.Scenes; 6 | using YAT.Types; 7 | 8 | namespace YAT.Commands; 9 | 10 | [Command("whereami", "Prints the current scene name and path.", aliases: "wai")] 11 | [Option("-l", "bool", "Prints the full path to the scene file.")] 12 | [Option("-s", "bool", "Prints info about currently selected node.")] 13 | [Option("-e", "bool", "Prints the path to the executable.")] 14 | public sealed class Whereami : ICommand 15 | { 16 | public CommandResult Execute(CommandData data) 17 | { 18 | bool s = (bool)data.Options["-s"]; 19 | bool e = (bool)data.Options["-e"]; 20 | bool longForm = (bool)data.Options["-l"]; 21 | 22 | string p = e 23 | ? GetExecutablePath() 24 | : GetSceneInfo(data.Terminal, s, longForm); 25 | return ICommand.Ok([p], p); 26 | } 27 | 28 | private static string GetExecutablePath() 29 | { 30 | return OS.GetExecutablePath().GetBaseDir(); 31 | } 32 | 33 | private static string GetSceneInfo(BaseTerminal terminal, bool s, bool l) 34 | { 35 | Node scene = terminal.GetTree().CurrentScene; 36 | scene = s ? terminal.SelectedNode.Current : scene; 37 | 38 | return string.Format( 39 | CultureInfo.InvariantCulture, 40 | "{0} {1}", 41 | scene.GetPath(), 42 | l ? "(" + scene.SceneFilePath + ")" : string.Empty 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /addons/yat/src/commands/Whereami.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dch2hs7rk7ygm 2 | -------------------------------------------------------------------------------- /addons/yat/src/enums/ECommandAdditionStatus.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Enums; 2 | 3 | public enum ECommandAdditionStatus 4 | { 5 | Success, 6 | UnknownCommand, 7 | MissingAttribute, 8 | ExistentCommand 9 | } 10 | -------------------------------------------------------------------------------- /addons/yat/src/enums/ECommandAdditionStatus.cs.uid: -------------------------------------------------------------------------------- 1 | uid://ciu61yd3fsgel 2 | -------------------------------------------------------------------------------- /addons/yat/src/enums/ECommandInputType.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Enums; 2 | 3 | public enum ECommandInputType 4 | { 5 | Void, 6 | Int, 7 | Float, 8 | String, 9 | Bool, 10 | Constant, 11 | Enum 12 | } 13 | -------------------------------------------------------------------------------- /addons/yat/src/enums/ECommandInputType.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dskso7n5bsihp 2 | -------------------------------------------------------------------------------- /addons/yat/src/enums/ECommandResult.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Enums; 2 | 3 | public enum ECommandResult 4 | { 5 | Unavailable = -1, 6 | Success = 0, 7 | Failure = 1, 8 | InvalidArguments = 2, 9 | InvalidCommand = 3, 10 | InvalidPermissions = 4, 11 | InvalidState = 5, 12 | NotImplemented = 6, 13 | UnknownCommand = 7, 14 | UnknownError = 8, 15 | Ok = 9 16 | } 17 | -------------------------------------------------------------------------------- /addons/yat/src/enums/ECommandResult.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bmm8h1yo1fvj5 2 | -------------------------------------------------------------------------------- /addons/yat/src/enums/EDebugScreenItemPosition.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Enums; 2 | 3 | public enum EDebugScreenItemPosition 4 | { 5 | None = -1, 6 | TopLeft, 7 | TopRight, 8 | BottomLeft, 9 | BottomRight, 10 | } 11 | -------------------------------------------------------------------------------- /addons/yat/src/enums/EDebugScreenItemPosition.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bqbkq01vt4ffq 2 | -------------------------------------------------------------------------------- /addons/yat/src/enums/EInputType.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Enums; 2 | 3 | public enum EInputType 4 | { 5 | String, 6 | Bool, 7 | Int, 8 | Float, 9 | Color 10 | } 11 | -------------------------------------------------------------------------------- /addons/yat/src/enums/EInputType.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dtf67ies1hbpc 2 | -------------------------------------------------------------------------------- /addons/yat/src/enums/EMethodStatus.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Enums; 2 | 3 | public enum EMethodStatus 4 | { 5 | Success, 6 | Failed 7 | } 8 | -------------------------------------------------------------------------------- /addons/yat/src/enums/EMethodStatus.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dbr6ij16uaeb0 2 | -------------------------------------------------------------------------------- /addons/yat/src/enums/EPrintType.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Enums; 2 | 3 | public enum EPrintType 4 | { 5 | Normal, 6 | Error, 7 | Warning, 8 | Success 9 | } 10 | -------------------------------------------------------------------------------- /addons/yat/src/enums/EPrintType.cs.uid: -------------------------------------------------------------------------------- 1 | uid://cf864dvllbepc 2 | -------------------------------------------------------------------------------- /addons/yat/src/enums/ERejectionReason.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Enums; 2 | 3 | public enum ERejectionReason 4 | { 5 | InvalidNode, 6 | InvalidNodePath 7 | } 8 | -------------------------------------------------------------------------------- /addons/yat/src/enums/ERejectionReason.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bbd65ktl36pym 2 | -------------------------------------------------------------------------------- /addons/yat/src/enums/ESceneChangeFailureReason.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Enums; 2 | 3 | public enum ESceneChangeFailureReason 4 | { 5 | CantOpen, 6 | DoesNotExist, 7 | CantInstantiate, 8 | } 9 | -------------------------------------------------------------------------------- /addons/yat/src/enums/ESceneChangeFailureReason.cs.uid: -------------------------------------------------------------------------------- 1 | uid://ddgwnawf6kj4o 2 | -------------------------------------------------------------------------------- /addons/yat/src/enums/EStringConversionResult.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Enums; 2 | 3 | public enum EStringConversionResult 4 | { 5 | Success, 6 | Invalid, 7 | OutOfRange 8 | } 9 | -------------------------------------------------------------------------------- /addons/yat/src/enums/EStringConversionResult.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bi0kv8srlc8fl 2 | -------------------------------------------------------------------------------- /addons/yat/src/enums/MethodValidationResult.cs: -------------------------------------------------------------------------------- 1 | namespace YAT.Enums; 2 | 3 | public enum MethodValidationResult 4 | { 5 | Success, 6 | InvalidInstance, 7 | InvalidMethod, 8 | } 9 | -------------------------------------------------------------------------------- /addons/yat/src/enums/MethodValidationResult.cs.uid: -------------------------------------------------------------------------------- 1 | uid://b2fwo4r2gjxgx 2 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/Keybindings.cs.uid: -------------------------------------------------------------------------------- 1 | uid://chr0bdpes5f3t 2 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/Messages.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | 3 | namespace YAT.Helpers; 4 | 5 | public static class Messages 6 | { 7 | // Unknown 8 | public static string UnknownCommand(StringName command) 9 | => $"{command} is not a valid command."; 10 | public static string UnknownMethod(string something, string method) 11 | => $"{something} does not have a method named {method}."; 12 | 13 | // Missing 14 | public static string MissingInterface(string something, StringName @interface) 15 | => $"{something} does not implement {@interface}."; 16 | public static string MissingArguments(StringName command, params string[] args) 17 | => $"{command} expected {string.Join(", ", args)} to be provided."; 18 | public static string MissingAttribute(string something, StringName attribute) 19 | => $"{something} is missing the {attribute} attribute."; 20 | public static string MissingValue(StringName command, StringName option) 21 | => $"{command} expected {option} to be provided."; 22 | 23 | // Invalid 24 | public static string InvalidNodePath(string path) 25 | => $"{path} is not a valid node path."; 26 | public static string InvalidArgument(StringName command, string argument, string expected) 27 | => $"{command} expected {Text.EscapeBBCode(argument)} to be an: {expected}."; 28 | public static string InvalidMethod(string method) 29 | => $"{method} is not a valid method."; 30 | public static string InvalidOption(StringName command, string opt) 31 | => $"{command} does not have an option named {opt}."; 32 | public static string InvalidCommandInputType(string type, StringName command) 33 | => $"Invalid command input type '{type}' for command '{command}'."; 34 | 35 | // Other 36 | public static string NodeHasNoChildren(string path) 37 | => $"{path} has no children."; 38 | public static string ValueOutOfRange(string value, float min, float max) 39 | => $"{value} is out of range. Expected a value between {min} and {max}."; 40 | public static string ArgumentValueOutOfRange(StringName command, StringName argument, float min, float max) 41 | => $"{command} expected {argument} to be between {min} and {max}."; 42 | 43 | public static string DisposedNode => "The node has been disposed."; 44 | } 45 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/Messages.cs.uid: -------------------------------------------------------------------------------- 1 | uid://837fqr86d2nx 2 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/Numeric.cs.uid: -------------------------------------------------------------------------------- 1 | uid://clf3ib1qifgw5 2 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/OS.cs.uid: -------------------------------------------------------------------------------- 1 | uid://ckqoqcasog402 2 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/Reflection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | 5 | namespace YAT.Helpers; 6 | 7 | public static class Reflection 8 | { 9 | public static IEnumerable GetEvents( 10 | this object obj, 11 | BindingFlags bindingFlags = BindingFlags.Default 12 | ) 13 | { 14 | Type type = obj.GetType(); 15 | 16 | return type.GetEvents(bindingFlags); 17 | } 18 | 19 | public static T? GetAttribute(this object obj) where T : Attribute 20 | { 21 | return Attribute.GetCustomAttribute(obj.GetType(), typeof(T)) 22 | is not T attribute 23 | ? null 24 | : attribute; 25 | } 26 | 27 | public static IEnumerable? GetAttributes(this object obj) where T : Attribute 28 | { 29 | return Attribute.GetCustomAttributes(obj.GetType(), typeof(T)) 30 | is not T[] attributes 31 | ? null 32 | : attributes; 33 | } 34 | 35 | public static bool HasAttribute(this object obj) where T : Attribute 36 | { 37 | return Attribute.GetCustomAttribute(obj.GetType(), typeof(T)) is not null; 38 | } 39 | 40 | public static bool HasInterface(this object obj) where T : notnull 41 | { 42 | return obj is Type type 43 | ? type.HasInterface(typeof(T).FullName ?? string.Empty) 44 | : obj.GetType().GetInterface(typeof(T).FullName ?? string.Empty, true) is not null; 45 | } 46 | 47 | public static bool HasInterface(this Type type, string interfaceName) 48 | { 49 | return type.GetInterface(interfaceName, true) is not null; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/Reflection.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bn48c62b1i0bk 2 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/Scene.cs.uid: -------------------------------------------------------------------------------- 1 | uid://bt1u3dn5beua1 2 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/Storage.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | 3 | namespace YAT.Helpers; 4 | 5 | public static class Storage 6 | { 7 | public static bool SaveResource( 8 | Resource resource, 9 | string path, 10 | ResourceSaver.SaverFlags flags = ResourceSaver.SaverFlags.None 11 | ) 12 | { 13 | return ResourceSaver.Save(resource, path, flags) switch 14 | { 15 | Error.Ok => true, 16 | _ => false, 17 | }; 18 | } 19 | 20 | public static T? LoadResource(string path) where T : Resource 21 | { 22 | return !ResourceLoader.Exists(path, nameof(T)) 23 | ? null 24 | : ResourceLoader.Load(path); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/Storage.cs.uid: -------------------------------------------------------------------------------- 1 | uid://blje6cb07dx 2 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/Text.cs.uid: -------------------------------------------------------------------------------- 1 | uid://nc55lqoa4dfy 2 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/World.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using Godot.Collections; 3 | 4 | namespace YAT.Helpers; 5 | 6 | public static class World 7 | { 8 | public static Dictionary? RayCast(Viewport viewport, float rayLength = 1000) 9 | { 10 | Camera3D? camera = viewport.GetCamera3D(); 11 | Vector2 mousePos = viewport.GetMousePosition(); 12 | 13 | if (camera is null) 14 | { 15 | return null; 16 | } 17 | 18 | Vector3 origin = camera.ProjectRayOrigin(mousePos); 19 | Vector3 end = origin + (camera.ProjectRayNormal(mousePos) * rayLength); 20 | PhysicsRayQueryParameters3D query = PhysicsRayQueryParameters3D.Create(origin, end); 21 | query.CollideWithAreas = true; 22 | query.CollideWithBodies = true; 23 | 24 | return camera.GetWorld3D().DirectSpaceState.IntersectRay(query); 25 | } 26 | 27 | public static Node? SearchNode(Node root, string name, bool recursive = true) 28 | { 29 | return !GodotObject.IsInstanceValid(root) 30 | ? null 31 | : root.FindChild(name, recursive, false); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/World.cs.uid: -------------------------------------------------------------------------------- 1 | uid://c8s8clob2voev 2 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/ZipExtractor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.IO.Compression; 5 | using System.Linq; 6 | 7 | namespace YAT.Helpers; 8 | 9 | public static class ZipExtractor 10 | { 11 | public static bool ExtractFolderFromZipFile( 12 | string filePath, 13 | string extractPath, 14 | string folderToExtract 15 | ) 16 | { 17 | try 18 | { 19 | using ZipArchive archive = ZipFile.OpenRead(filePath); 20 | 21 | IEnumerable result = from currEntry in archive.Entries 22 | where currEntry.FullName.Contains(folderToExtract) 23 | where !string.IsNullOrEmpty(currEntry.Name) 24 | select currEntry; 25 | 26 | foreach (ZipArchiveEntry entry in result) 27 | { 28 | string[] pathElements = entry.FullName.Split(Path.DirectorySeparatorChar); 29 | int folderIndex = Array.IndexOf(pathElements, folderToExtract); 30 | 31 | // folderIndex + 1 to skip folder with the addon itself 32 | if (folderIndex == -1 || folderIndex + 1 > pathElements.Length) 33 | { 34 | continue; 35 | } 36 | 37 | string relativePath = string.Join( 38 | Path.DirectorySeparatorChar, 39 | pathElements[(folderIndex + 1)..] 40 | ); 41 | string path = Path.Combine(extractPath, relativePath); 42 | 43 | if (path.EndsWith($"{Path.DirectorySeparatorChar}", StringComparison.InvariantCulture)) 44 | { 45 | _ = Directory.CreateDirectory(path); 46 | } 47 | else 48 | { 49 | _ = Directory.CreateDirectory(Path.GetDirectoryName(path)!); 50 | 51 | using FileStream fileStream = new(path, FileMode.Create); 52 | using Stream entryStream = entry.Open(); 53 | 54 | entryStream.CopyTo(fileStream); 55 | } 56 | } 57 | return true; 58 | } 59 | catch (Exception e) when ( 60 | e is ArgumentException 61 | or IOException 62 | or FileNotFoundException 63 | or InvalidDataException 64 | or UnauthorizedAccessException 65 | or DirectoryNotFoundException 66 | ) 67 | { 68 | return false; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /addons/yat/src/helpers/ZipExtractor.cs.uid: -------------------------------------------------------------------------------- 1 | uid://ddxd0rrwxabvc 2 | -------------------------------------------------------------------------------- /addons/yat/src/interfaces/ICommand.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dwufkkn4o1ljb 2 | -------------------------------------------------------------------------------- /addons/yat/src/interfaces/IExtension.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Text; 3 | using YAT.Attributes; 4 | using YAT.Enums; 5 | using YAT.Helpers; 6 | using YAT.Types; 7 | 8 | namespace YAT.Interfaces; 9 | 10 | public partial interface IExtension 11 | { 12 | public CommandResult Execute(CommandData args); 13 | 14 | public virtual string GenerateExtensionManual() 15 | { 16 | StringBuilder sb = new(); 17 | ExtensionAttribute? attribute = Reflection.GetAttribute(this); 18 | 19 | if (string.IsNullOrEmpty(attribute?.Manual)) 20 | { 21 | return $"Extension {attribute?.Name} does not have a manual."; 22 | } 23 | 24 | _ = sb.AppendLine($"[font_size=18]{attribute.Name}[/font_size]") 25 | .AppendLine(attribute.Description) 26 | .AppendLine('\n' + attribute.Manual) 27 | .AppendLine("\n[b]Aliases[/b]:") 28 | .AppendLine(attribute.Aliases.Length > 0 29 | ? string.Join("\n", attribute.Aliases.Select(alias => $"[ul]\t{alias}[/ul]")) 30 | : "[ul]\tNone[/ul]"); 31 | 32 | return sb.ToString(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /addons/yat/src/interfaces/IExtension.cs.uid: -------------------------------------------------------------------------------- 1 | uid://nbj6xtyive12 2 | -------------------------------------------------------------------------------- /addons/yat/src/resources/preferences/YatPreferences.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using YAT.Attributes; 3 | using YAT.Enums; 4 | 5 | namespace YAT.Resources; 6 | 7 | public partial class YatPreferences : Resource 8 | { 9 | #region Terminal 10 | [ExportGroup("Terminal")] 11 | [Export] public string Prompt { get; set; } = ">"; 12 | [Export] public bool ShowPrompt { get; set; } = true; 13 | [Export(PropertyHint.Range, "1,255,1")] 14 | public uint HistoryLimit { get; set; } = 15; 15 | // [Export] public bool AutoFocus { get; set; } = true; 16 | [Export] public bool AutoScroll { get; set; } = true; 17 | // [Export] public bool AutoComplete { get; set; } = true; 18 | // [Export] public bool AutoCompleteOnTab { get; set; } = true; 19 | // [Export] public bool AutoCompleteOnEnter { get; set; } = true; 20 | [Export(PropertyHint.Range, "1, 64, 0")] public ushort FontSize { get; set; } = 16; 21 | [Export] public int DefaultWidth { get; set; } = 728; 22 | [Export] public int DefaultHeight { get; set; } = 384; 23 | #endregion Terminal 24 | 25 | #region Window 26 | [ExportGroup("Window")] 27 | [Export(PropertyHint.Range, "1, 64, 0")] 28 | public ushort BaseFontSize { get; set; } = 16; 29 | [Ignore] 30 | [Export] 31 | public Font BaseFont { get; set; } = ThemeDB.FallbackFont; 32 | #endregion Window 33 | 34 | #region Colors 35 | [ExportGroup("Colors")] 36 | [Export] public Color InputColor { get; set; } = new("dfdfdf99"); // #dfdfdf99 37 | [Ignore] 38 | [Export] public Color BackgroundColor { get; set; } = new("1d2229"); // #192229 39 | [Export] public Color OutputColor { get; set; } = new("dfdfdf80"); // #dfdfdf80 40 | [Export] public Color ErrorColor { get; set; } = new("ff786b"); // #ff7866 41 | [Export] public Color WarningColor { get; set; } = new("ffdd65"); // #ffdd65 42 | [Export] public Color SuccessColor { get; set; } = new("a5ff8a"); // #a5ff8a 43 | #endregion Colors 44 | } 45 | -------------------------------------------------------------------------------- /addons/yat/src/resources/preferences/YatPreferences.cs.uid: -------------------------------------------------------------------------------- 1 | uid://pw0ipbpc5i4d 2 | -------------------------------------------------------------------------------- /addons/yat/src/resources/quick_commands/QuickCommands.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using Godot.Collections; 3 | 4 | namespace YAT.Resources 5 | { 6 | public partial class QuickCommands : Resource 7 | { 8 | [Export] public Dictionary Commands { get; set; } = new(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /addons/yat/src/resources/quick_commands/QuickCommands.cs.uid: -------------------------------------------------------------------------------- 1 | uid://dblig1tkrnt36 2 | -------------------------------------------------------------------------------- /addons/yat/src/resources/quick_commands/QuickCommands.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Resource" load_steps=2 format=3 uid="uid://dw46ro2jvb3ip"] 2 | 3 | [ext_resource type="Script" uid="uid://dblig1tkrnt36" path="res://addons/yat/src/resources/quick_commands/QuickCommands.cs" id="1_4um1j"] 4 | 5 | [resource] 6 | script = ExtResource("1_4um1j") 7 | Commands = Dictionary[String, String]({}) 8 | -------------------------------------------------------------------------------- /addons/yat/src/resources/yat_tooltip_theme.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Theme" load_steps=2 format=3 uid="uid://dqsefo8kmb7dj"] 2 | 3 | [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_16rg6"] 4 | content_margin_left = 8.0 5 | content_margin_top = 2.0 6 | content_margin_right = 8.0 7 | content_margin_bottom = 2.0 8 | bg_color = Color(0.113725, 0.133333, 0.160784, 1) 9 | border_width_left = 1 10 | border_width_top = 1 11 | border_width_right = 1 12 | border_width_bottom = 1 13 | border_color = Color(0, 0, 0, 1) 14 | corner_radius_top_left = 3 15 | corner_radius_top_right = 3 16 | corner_radius_bottom_right = 3 17 | corner_radius_bottom_left = 3 18 | corner_detail = 5 19 | 20 | [resource] 21 | TooltipLabel/colors/font_color = Color(0.875, 0.875, 0.875, 1) 22 | TooltipLabel/colors/font_outline_color = Color(0, 0, 0, 0) 23 | TooltipLabel/colors/font_shadow_color = Color(0, 0, 0, 0) 24 | TooltipLabel/constants/outline_size = 0 25 | TooltipLabel/constants/shadow_offset_x = 1 26 | TooltipLabel/constants/shadow_offset_y = 1 27 | TooltipLabel/font_sizes/font_size = 16 28 | TooltipPanel/styles/panel = SubResource("StyleBoxFlat_16rg6") 29 | -------------------------------------------------------------------------------- /addons/yat/src/scenes/base_terminal/BaseTerminal.cs.uid: -------------------------------------------------------------------------------- 1 | uid://cvqjohbhnbacs 2 | -------------------------------------------------------------------------------- /addons/yat/src/scenes/base_terminal/components/autocompletion/Autocompletion.cs.uid: -------------------------------------------------------------------------------- 1 | uid://b0u2xgptk78me 2 | -------------------------------------------------------------------------------- /addons/yat/src/scenes/base_terminal/components/autocompletion/Autocompletion.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=2 format=3 uid="uid://duldfph1vr1yb"] 2 | 3 | [ext_resource type="Script" uid="uid://b0u2xgptk78me" path="res://addons/yat/src/scenes/base_terminal/components/autocompletion/Autocompletion.cs" id="2_5lpve"] 4 | 5 | [node name="Autocompletion" type="Node"] 6 | script = ExtResource("2_5lpve") 7 | -------------------------------------------------------------------------------- /addons/yat/src/scenes/base_terminal/components/command_validator/CommandValidator.cs.uid: -------------------------------------------------------------------------------- 1 | uid://fu0xvcmkqm6s 2 | -------------------------------------------------------------------------------- /addons/yat/src/scenes/base_terminal/components/command_validator/CommandValidator.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=2 format=3 uid="uid://x1dyt4bknu3x"] 2 | 3 | [ext_resource type="Script" uid="uid://fu0xvcmkqm6s" path="res://addons/yat/src/scenes/base_terminal/components/command_validator/CommandValidator.cs" id="1_py04w"] 4 | 5 | [node name="CommandValidator" type="Node"] 6 | script = ExtResource("1_py04w") 7 | -------------------------------------------------------------------------------- /addons/yat/src/scenes/base_terminal/components/full_window_display/FullWindowDisplay.cs: -------------------------------------------------------------------------------- 1 | using Godot; 2 | using YAT.Helpers; 3 | 4 | namespace YAT.Scenes; 5 | 6 | public partial class FullWindowDisplay : Control 7 | { 8 | [Signal] public delegate void OpenedEventHandler(); 9 | [Signal] public delegate void ClosedEventHandler(); 10 | 11 | #nullable disable 12 | public bool IsOpen => Visible; 13 | public RichTextLabel MainDisplay { get; private set; } 14 | private Label _helpLabel; 15 | #nullable restore 16 | 17 | public override void _Ready() 18 | { 19 | MainDisplay = GetNode("%MainDisplay"); 20 | _helpLabel = GetNode