├── 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("%HelpLabel");
21 | }
22 |
23 | public override void _Input(InputEvent @event)
24 | {
25 | if (@event.IsActionPressed(Keybindings.TerminalCloseFullWindowDisplay))
26 | {
27 | Close();
28 | }
29 | }
30 |
31 | public void Open(string text)
32 | {
33 | GenerateHelp();
34 |
35 | MainDisplay.Clear();
36 | _ = MainDisplay.CallDeferred("append_text", text);
37 | Visible = true;
38 |
39 | _ = EmitSignal(SignalName.Opened);
40 | }
41 |
42 | public void Close()
43 | {
44 | if (!Visible)
45 | {
46 | return;
47 | }
48 |
49 | MainDisplay.Clear();
50 | Visible = false;
51 |
52 | _ = EmitSignal(SignalName.Closed);
53 | }
54 |
55 | private void GenerateHelp()
56 | {
57 | InputEvent closeKey = InputMap.ActionGetEvents(
58 | Keybindings.TerminalCloseFullWindowDisplay
59 | )[0];
60 |
61 | _helpLabel.Text = $"{closeKey.AsText()} - Close";
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/full_window_display/FullWindowDisplay.cs.uid:
--------------------------------------------------------------------------------
1 | uid://p8nu46p5cwln
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/full_window_display/FullWindowDisplay.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://cm6kd53al1tcc"]
2 |
3 | [ext_resource type="Theme" uid="uid://csssl8ua88ca4" path="res://addons/yat/src/scenes/base_terminal/theme/yat_base_terminal_theme.tres" id="1_2e7rg"]
4 | [ext_resource type="Script" uid="uid://p8nu46p5cwln" path="res://addons/yat/src/scenes/base_terminal/components/full_window_display/FullWindowDisplay.cs" id="1_5wycr"]
5 |
6 | [node name="FullWindowDisplay" type="Control"]
7 | layout_mode = 3
8 | anchors_preset = 15
9 | anchor_right = 1.0
10 | anchor_bottom = 1.0
11 | grow_horizontal = 2
12 | grow_vertical = 2
13 | script = ExtResource("1_5wycr")
14 |
15 | [node name="PanelContainer" type="PanelContainer" parent="."]
16 | layout_mode = 1
17 | anchors_preset = 15
18 | anchor_right = 1.0
19 | anchor_bottom = 1.0
20 | grow_horizontal = 2
21 | grow_vertical = 2
22 | theme = ExtResource("1_2e7rg")
23 |
24 | [node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
25 | layout_mode = 2
26 |
27 | [node name="MainDisplay" type="RichTextLabel" parent="PanelContainer/VBoxContainer"]
28 | unique_name_in_owner = true
29 | layout_mode = 2
30 | size_flags_vertical = 3
31 | focus_mode = 2
32 | bbcode_enabled = true
33 | text = "Lorem ipsum dolor sit amet"
34 | selection_enabled = true
35 |
36 | [node name="HelpContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer"]
37 | layout_mode = 2
38 | theme_override_constants/margin_left = 8
39 | theme_override_constants/margin_right = 8
40 |
41 | [node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/VBoxContainer/HelpContainer"]
42 | layout_mode = 2
43 |
44 | [node name="HSeparator" type="HSeparator" parent="PanelContainer/VBoxContainer/HelpContainer/VBoxContainer"]
45 | layout_mode = 2
46 |
47 | [node name="HelpLabel" type="Label" parent="PanelContainer/VBoxContainer/HelpContainer/VBoxContainer"]
48 | unique_name_in_owner = true
49 | layout_mode = 2
50 | size_flags_horizontal = 3
51 | size_flags_vertical = 6
52 | text = "Q - Quit"
53 | vertical_alignment = 1
54 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/history_component/HistoryComponent.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Godot;
3 |
4 | namespace YAT.Scenes;
5 |
6 | public partial class HistoryComponent : Node
7 | {
8 | public readonly LinkedList History = new();
9 | public LinkedListNode? CurrentNode { get; private set; }
10 |
11 | private YAT? _yat;
12 |
13 | public override void _Ready()
14 | {
15 | _yat = GetNode("/root/YAT");
16 | }
17 |
18 | public void Add(string command)
19 | {
20 | if (History.Count >= _yat!.PreferencesManager.Preferences.HistoryLimit)
21 | {
22 | History.RemoveFirst();
23 | }
24 |
25 | CurrentNode = null;
26 | _ = History.AddLast(command);
27 | }
28 |
29 | public LinkedListNode? MovePrevious()
30 | {
31 | if (CurrentNode is null && History.Count > 0)
32 | {
33 | CurrentNode = History.Last;
34 | return CurrentNode;
35 | }
36 | else if (CurrentNode?.Previous is not null)
37 | {
38 | CurrentNode = CurrentNode.Previous;
39 | return CurrentNode;
40 | }
41 |
42 | return null;
43 | }
44 |
45 | public LinkedListNode? MoveNext()
46 | {
47 | if (CurrentNode?.Next is not null)
48 | {
49 | CurrentNode = CurrentNode.Next;
50 | return CurrentNode;
51 | }
52 |
53 | CurrentNode = null;
54 | return null;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/history_component/HistoryComponent.cs.uid:
--------------------------------------------------------------------------------
1 | uid://ypk8ip37ehf3
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/history_component/HistoryComponent.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=2 format=3 uid="uid://bwxwmhplic873"]
2 |
3 | [ext_resource type="Script" uid="uid://ypk8ip37ehf3" path="res://addons/yat/src/scenes/base_terminal/components/history_component/HistoryComponent.cs" id="1_7nwxk"]
4 |
5 | [node name="HistoryComponent" type="Node"]
6 | script = ExtResource("1_7nwxk")
7 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/input/Input.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 | using YAT.Classes;
3 |
4 | namespace YAT.Scenes;
5 |
6 | public partial class Input : LineEdit
7 | {
8 | #nullable disable
9 | [Export] public BaseTerminal Terminal { get; set; }
10 |
11 | private YAT _yat;
12 | #nullable restore
13 |
14 | public override void _Ready()
15 | {
16 | _yat = GetNode("/root/YAT");
17 | _yat.Ready += () =>
18 | {
19 | _yat.TerminalManager.TerminalOpened += () =>
20 | {
21 | if (Terminal.Current && !Terminal.FullWindowDisplay.IsOpen)
22 | {
23 | GrabFocus();
24 | }
25 | };
26 | };
27 |
28 | TextSubmitted += OnTextSubmitted;
29 | }
30 |
31 | private void OnTextSubmitted(string input)
32 | {
33 | if (Terminal.Locked || string.IsNullOrEmpty(input))
34 | {
35 | return;
36 | }
37 |
38 | input = GetQuickCommand(input);
39 |
40 | string[] command = Parser.ParseCommand(input);
41 |
42 | if (command.Length == 0)
43 | {
44 | return;
45 | }
46 |
47 | Terminal.HistoryComponent.Add(input);
48 | _ = Terminal.CommandManager.Run(command, Terminal);
49 | Clear();
50 | }
51 |
52 | private string GetQuickCommand(string input)
53 | {
54 | return _yat.Commands.QuickCommands.Commands.TryGetValue(input, out string? value)
55 | ? value
56 | : input;
57 | }
58 |
59 | public void MoveCaretToEnd()
60 | {
61 | CaretColumn = Text.Length;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/input/Input.cs.uid:
--------------------------------------------------------------------------------
1 | uid://bgb4ta2rplwnl
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/input_info/InputInfo.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 |
3 | namespace YAT.Scenes;
4 |
5 | public partial class InputInfo : PanelContainer
6 | {
7 | #nullable disable
8 | public RichTextLabel _text;
9 | private MarginContainer _container;
10 | #nullable restore
11 |
12 | public override void _Ready()
13 | {
14 | _text = GetNode("%Text");
15 | _container = GetNode("./MarginContainer");
16 | Visible = false;
17 | }
18 |
19 | public void DisplayCommandInfo(string text)
20 | {
21 | _text.Text = text;
22 | Visible = true;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/input_info/InputInfo.cs.uid:
--------------------------------------------------------------------------------
1 | uid://c026kne8u1bhw
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/input_info/InputInfo.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://crxh4uxlaoyrq"]
2 |
3 | [ext_resource type="Theme" uid="uid://dsum3emookvm" path="res://addons/yat/src/scenes/base_terminal/components/input_info/theme/yat_input_info_theme.tres" id="1_hqw0x"]
4 | [ext_resource type="Script" uid="uid://c026kne8u1bhw" path="res://addons/yat/src/scenes/base_terminal/components/input_info/InputInfo.cs" id="1_yrxu5"]
5 |
6 | [node name="InputInfo" type="PanelContainer"]
7 | size_flags_horizontal = 0
8 | theme = ExtResource("1_hqw0x")
9 | script = ExtResource("1_yrxu5")
10 |
11 | [node name="MarginContainer" type="MarginContainer" parent="."]
12 | layout_mode = 2
13 |
14 | [node name="Text" type="RichTextLabel" parent="MarginContainer"]
15 | unique_name_in_owner = true
16 | clip_contents = false
17 | layout_mode = 2
18 | bbcode_enabled = true
19 | text = "command arg arg2 -o -o2"
20 | fit_content = true
21 | scroll_active = false
22 | autowrap_mode = 0
23 | shortcut_keys_enabled = false
24 | deselect_on_focus_loss_enabled = false
25 | drag_and_drop_selection_enabled = false
26 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/input_info/components/command_info/CommandInfo.cs.uid:
--------------------------------------------------------------------------------
1 | uid://nuvt0h482ni4
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/input_info/components/command_info/CommandInfo.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=2 format=3 uid="uid://c522nry8jbfon"]
2 |
3 | [ext_resource type="Script" uid="uid://nuvt0h482ni4" path="res://addons/yat/src/scenes/base_terminal/components/input_info/components/command_info/CommandInfo.cs" id="1_cjppm"]
4 |
5 | [node name="CommandInfo" type="Node"]
6 | script = ExtResource("1_cjppm")
7 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/input_info/theme/yat_input_info_theme.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Theme" load_steps=4 format=3 uid="uid://dsum3emookvm"]
2 |
3 | [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_m21qy"]
4 | bg_color = Color(0.0823529, 0.0980392, 0.121569, 0.25098)
5 | border_width_left = 1
6 | border_width_top = 1
7 | border_width_right = 1
8 | border_width_bottom = 1
9 | border_color = Color(0.0823529, 0.0980392, 0.121569, 0.188235)
10 | corner_radius_top_left = 4
11 | corner_radius_top_right = 4
12 | corner_radius_bottom_right = 4
13 | corner_radius_bottom_left = 4
14 |
15 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_uwely"]
16 |
17 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_yaecl"]
18 |
19 | [resource]
20 | MarginContainer/constants/margin_bottom = 6
21 | MarginContainer/constants/margin_left = 8
22 | MarginContainer/constants/margin_right = 8
23 | MarginContainer/constants/margin_top = 6
24 | PanelContainer/styles/panel = SubResource("StyleBoxFlat_m21qy")
25 | RichTextLabel/colors/default_color = Color(0.87451, 0.87451, 0.87451, 0.501961)
26 | RichTextLabel/font_sizes/bold_font_size = 12
27 | RichTextLabel/font_sizes/bold_italics_font_size = 12
28 | RichTextLabel/font_sizes/italics_font_size = 12
29 | RichTextLabel/font_sizes/mono_font_size = 12
30 | RichTextLabel/font_sizes/normal_font_size = 12
31 | RichTextLabel/styles/focus = SubResource("StyleBoxEmpty_uwely")
32 | RichTextLabel/styles/normal = SubResource("StyleBoxEmpty_yaecl")
33 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/output/Output.cs.uid:
--------------------------------------------------------------------------------
1 | uid://d18ns14t2u66
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/output/Output.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=2 format=3 uid="uid://b6tsk66eajwde"]
2 |
3 | [ext_resource type="Script" uid="uid://d18ns14t2u66" path="res://addons/yat/src/scenes/base_terminal/components/output/Output.cs" id="1_ntaaq"]
4 |
5 | [node name="Output" type="RichTextLabel"]
6 | anchors_preset = 15
7 | anchor_right = 1.0
8 | anchor_bottom = 1.0
9 | grow_horizontal = 2
10 | grow_vertical = 2
11 | size_flags_horizontal = 3
12 | size_flags_vertical = 3
13 | focus_mode = 2
14 | bbcode_enabled = true
15 | text = "YAT - Yet Another Terminal
16 | MIT 2023 - MASSHUU12"
17 | shortcut_keys_enabled = false
18 | selection_enabled = true
19 | script = ExtResource("1_ntaaq")
20 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/selected_node/SelectedNode.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 | using YAT.Enums;
3 |
4 | namespace YAT.Scenes;
5 |
6 | public partial class SelectedNode : Node
7 | {
8 | [Signal]
9 | public delegate void CurrentNodeChangedEventHandler(Node node);
10 | [Signal]
11 | public delegate void CurrentNodeChangeFailedEventHandler(ERejectionReason reason);
12 |
13 | #nullable disable
14 | public Node Current { get; private set; }
15 |
16 | private BaseTerminal _terminal;
17 | #nullable restore
18 |
19 | public override void _Ready()
20 | {
21 | _terminal = GetNode("../");
22 | Current = GetTree().Root;
23 | }
24 |
25 | ///
26 | /// Changes the selected node to the specified node path.
27 | ///
28 | /// The node path of the new selected node.
29 | /// True if the selected node was successfully changed, false otherwise.
30 | public bool ChangeSelectedNode(NodePath node)
31 | {
32 | if (node?.IsEmpty != false)
33 | {
34 | _ = EmitSignal(SignalName.CurrentNodeChangeFailed,
35 | (ushort)ERejectionReason.InvalidNodePath
36 | );
37 | return false;
38 | }
39 |
40 | Node newSelectedNode;
41 | if (IsInstanceValid(Current))
42 | {
43 | newSelectedNode = Current.GetNodeOrNull(node);
44 | newSelectedNode ??= GetNodeOrNull(node);
45 | }
46 | else
47 | {
48 | newSelectedNode = GetNodeOrNull(node);
49 | }
50 |
51 | if (!IsInstanceValid(newSelectedNode))
52 | {
53 | _ = EmitSignal(SignalName.CurrentNodeChangeFailed,
54 | (ushort)ERejectionReason.InvalidNode
55 | );
56 | return false;
57 | }
58 |
59 | Current = newSelectedNode;
60 | _ = EmitSignal(SignalName.CurrentNodeChanged, Current);
61 |
62 | return true;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/selected_node/SelectedNode.cs.uid:
--------------------------------------------------------------------------------
1 | uid://dxolkcan38v7o
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/components/selected_node/SelectedNode.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=2 format=3 uid="uid://b2ljvgvvny52r"]
2 |
3 | [ext_resource type="Script" uid="uid://dxolkcan38v7o" path="res://addons/yat/src/scenes/base_terminal/components/selected_node/SelectedNode.cs" id="1_dkjle"]
4 |
5 | [node name="SelectedNode" type="Node"]
6 | script = ExtResource("1_dkjle")
7 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/theme/yat_base_terminal_label_theme.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StyleBoxFlat" format=3 uid="uid://bps5qi2kfwh86"]
2 |
3 | [resource]
4 | content_margin_left = 8.0
5 | content_margin_right = 8.0
6 | bg_color = Color(0.6, 0.6, 0.6, 0)
7 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/theme/yat_base_terminal_line_edit_theme.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StyleBoxFlat" format=3 uid="uid://dron3rskgcrdd"]
2 |
3 | [resource]
4 | content_margin_top = 4.0
5 | content_margin_bottom = 4.0
6 | bg_color = Color(0.6, 0.6, 0.6, 0)
7 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/theme/yat_base_terminal_panel_container_theme.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StyleBoxFlat" format=3 uid="uid://dvbv662ikwtt5"]
2 |
3 | [resource]
4 | bg_color = Color(0.113725, 0.133333, 0.160784, 1)
5 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/theme/yat_base_terminal_rich_text_label_theme.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StyleBoxFlat" format=3 uid="uid://cysgs5mb1c0jj"]
2 |
3 | [resource]
4 | content_margin_left = 16.0
5 | content_margin_top = 16.0
6 | content_margin_right = 16.0
7 | bg_color = Color(0.113725, 0.133333, 0.160784, 0.752941)
8 | border_color = Color(0.113725, 0.133333, 0.160784, 0.752941)
9 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/base_terminal/theme/yat_base_terminal_theme.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Theme" load_steps=5 format=3 uid="uid://csssl8ua88ca4"]
2 |
3 | [ext_resource type="StyleBox" uid="uid://bps5qi2kfwh86" path="res://addons/yat/src/scenes/base_terminal/theme/yat_base_terminal_label_theme.tres" id="1_oqkbl"]
4 | [ext_resource type="StyleBox" uid="uid://dron3rskgcrdd" path="res://addons/yat/src/scenes/base_terminal/theme/yat_base_terminal_line_edit_theme.tres" id="2_bmswo"]
5 | [ext_resource type="StyleBox" uid="uid://dvbv662ikwtt5" path="res://addons/yat/src/scenes/base_terminal/theme/yat_base_terminal_panel_container_theme.tres" id="3_haqrw"]
6 | [ext_resource type="StyleBox" uid="uid://cysgs5mb1c0jj" path="res://addons/yat/src/scenes/base_terminal/theme/yat_base_terminal_rich_text_label_theme.tres" id="3_s35bd"]
7 |
8 | [resource]
9 | HBoxContainer/constants/separation = 0
10 | Label/colors/font_color = Color(0.87451, 0.87451, 0.87451, 0.6)
11 | Label/styles/normal = ExtResource("1_oqkbl")
12 | LineEdit/colors/font_color = Color(0.87451, 0.87451, 0.87451, 0.6)
13 | LineEdit/colors/font_placeholder_color = Color(0.875, 0.875, 0.875, 0.6)
14 | LineEdit/styles/focus = ExtResource("2_bmswo")
15 | LineEdit/styles/normal = ExtResource("2_bmswo")
16 | LineEdit/styles/read_only = ExtResource("2_bmswo")
17 | PanelContainer/styles/panel = ExtResource("3_haqrw")
18 | RichTextLabel/colors/default_color = Color(0.87451, 0.87451, 0.87451, 0.501961)
19 | RichTextLabel/styles/focus = ExtResource("3_s35bd")
20 | RichTextLabel/styles/normal = ExtResource("3_s35bd")
21 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/game_terminal/GameTerminal.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Godot;
3 | using YAT.Helpers;
4 | using YAT.Resources;
5 |
6 | namespace YAT.Scenes;
7 |
8 | public partial class GameTerminal : YatWindow
9 | {
10 | #nullable disable
11 | public BaseTerminal CurrentTerminal { get; private set; }
12 | public TerminalSwitcher TerminalSwitcher { get; private set; }
13 | #nullable restore
14 |
15 | public override void _Ready()
16 | {
17 | base._Ready();
18 |
19 | TerminalSwitcher = GetNode("%TerminalSwitcher");
20 |
21 | CurrentTerminal = TerminalSwitcher.CurrentTerminal;
22 | CurrentTerminal.TitleChangeRequested += title => Title = title;
23 | CurrentTerminal.PositionResetRequested += ResetPosition;
24 | CurrentTerminal.SizeResetRequested += () => Size = InitialSize;
25 |
26 | #if GODOT4_3_OR_GREATER
27 | ContextMenu.AddSubmenuNodeItem(
28 | "QuickCommands",
29 | GetNode("ContextMenu/QuickCommandsContext")
30 | );
31 | #else
32 | ContextMenu.AddSubmenuItem("QuickCommands", "QuickCommandsContext");
33 | #endif
34 | ContextMenu.AddItem("Preferences", 1);
35 | ContextMenu.IdPressed += ContextMenuItemSelected;
36 |
37 | MoveToCenter();
38 | }
39 |
40 | private void ContextMenuItemSelected(long id)
41 | {
42 | if (id == 1)
43 | {
44 | Commands.Preferences prefs = new();
45 | _ = prefs.Execute(new(
46 | _yat, CurrentTerminal, prefs, Array.Empty(), new(), new(), default
47 | ));
48 | }
49 | }
50 |
51 | public override void _Input(InputEvent @event)
52 | {
53 | if (@event.IsActionPressed(Keybindings.TerminalToggle))
54 | {
55 | _ = CallDeferred("emit_signal", SignalName.CloseRequested);
56 | }
57 | }
58 |
59 | private new void UpdateOptions(YatPreferences prefs)
60 | {
61 | Size = new(prefs.DefaultWidth, prefs.DefaultHeight);
62 |
63 | base.UpdateOptions(prefs);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/game_terminal/GameTerminal.cs.uid:
--------------------------------------------------------------------------------
1 | uid://dl7jsdpa5i3hb
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/game_terminal/GameTerminal.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=9 format=3 uid="uid://dsyqv187j7w76"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://o1hlj04h0rri" path="res://addons/yat/src/scenes/yat_window/YatWindow.tscn" id="2_0wq7x"]
4 | [ext_resource type="Script" uid="uid://dl7jsdpa5i3hb" path="res://addons/yat/src/scenes/game_terminal/GameTerminal.cs" id="2_17k82"]
5 | [ext_resource type="StyleBox" uid="uid://bps5qi2kfwh86" path="res://addons/yat/src/scenes/base_terminal/theme/yat_base_terminal_label_theme.tres" id="3_xmkp7"]
6 | [ext_resource type="StyleBox" uid="uid://dron3rskgcrdd" path="res://addons/yat/src/scenes/base_terminal/theme/yat_base_terminal_line_edit_theme.tres" id="4_pb6kd"]
7 | [ext_resource type="StyleBox" uid="uid://cysgs5mb1c0jj" path="res://addons/yat/src/scenes/base_terminal/theme/yat_base_terminal_rich_text_label_theme.tres" id="5_iupxt"]
8 | [ext_resource type="PackedScene" uid="uid://bwwlprkf31kug" path="res://addons/yat/src/scenes/game_terminal/components/terminal_switcher/TerminalSwitcher.tscn" id="6_q6yte"]
9 | [ext_resource type="PackedScene" uid="uid://pig28ykj8ss3" path="res://addons/yat/src/scenes/game_terminal/components/quick_commands_context/QuickCommandsContext.tscn" id="7_ofci7"]
10 |
11 | [sub_resource type="Theme" id="Theme_1ovvd"]
12 | default_font_size = 18
13 | HBoxContainer/constants/separation = 0
14 | Label/colors/font_color = Color(0.87451, 0.87451, 0.87451, 0.6)
15 | Label/styles/normal = ExtResource("3_xmkp7")
16 | LineEdit/colors/font_color = Color(0.87451, 0.87451, 0.87451, 0.6)
17 | LineEdit/colors/font_placeholder_color = Color(0.87451, 0.87451, 0.87451, 0.6)
18 | LineEdit/styles/focus = ExtResource("4_pb6kd")
19 | LineEdit/styles/normal = ExtResource("4_pb6kd")
20 | RichTextLabel/colors/default_color = Color(0.87451, 0.87451, 0.87451, 0.501961)
21 | RichTextLabel/styles/focus = ExtResource("5_iupxt")
22 | RichTextLabel/styles/normal = ExtResource("5_iupxt")
23 |
24 | [node name="GameTerminal" instance=ExtResource("2_0wq7x")]
25 | title = "YAT"
26 | size = Vector2i(728, 384)
27 | script = ExtResource("2_17k82")
28 | ViewportEdgeOffset = 48
29 |
30 | [node name="Content" parent="." index="0"]
31 | theme = SubResource("Theme_1ovvd")
32 |
33 | [node name="TerminalSwitcher" parent="Content" index="0" instance=ExtResource("6_q6yte")]
34 | unique_name_in_owner = true
35 | layout_mode = 2
36 |
37 | [node name="QuickCommandsContext" parent="ContextMenu" index="3" instance=ExtResource("7_ofci7")]
38 | visible = false
39 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/game_terminal/components/quick_commands_context/QuickCommandsContext.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using YAT.Helpers;
3 |
4 | namespace YAT.Scenes;
5 |
6 | public partial class QuickCommandsContext : ContextSubmenu
7 | {
8 | #nullable disable
9 | private YAT _yat;
10 | private TerminalSwitcher _terminalSwitcher;
11 | #nullable restore
12 |
13 | public override void _Ready()
14 | {
15 | base._Ready();
16 |
17 | _yat = GetNode("/root/YAT");
18 | _yat.Ready += () =>
19 | {
20 | _yat.Commands.QuickCommandsChanged += GetQuickCommands;
21 | GetQuickCommands();
22 | };
23 |
24 | _terminalSwitcher = GetNode("../../Content/TerminalSwitcher");
25 |
26 | IdPressed += OnQuickCommandsPressed;
27 | }
28 |
29 | private void GetQuickCommands()
30 | {
31 | _ = _yat.Commands.GetQuickCommands();
32 | Clear();
33 |
34 | foreach (KeyValuePair qc in _yat.Commands.QuickCommands.Commands)
35 | {
36 | AddItem(qc.Key);
37 | }
38 | }
39 |
40 | private void OnQuickCommandsPressed(long id)
41 | {
42 | string key = GetItemText((int)id);
43 |
44 | if (!_yat.Commands.QuickCommands.Commands.TryGetValue(key, out var command))
45 | {
46 | return;
47 | }
48 |
49 | _ = _terminalSwitcher.CurrentTerminal.CommandManager.Run(
50 | Text.SanitizeText(command),
51 | _terminalSwitcher.CurrentTerminal
52 | );
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/game_terminal/components/quick_commands_context/QuickCommandsContext.cs.uid:
--------------------------------------------------------------------------------
1 | uid://bfx1vaj3vbclm
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/game_terminal/components/quick_commands_context/QuickCommandsContext.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=5 format=3 uid="uid://pig28ykj8ss3"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://jdyvooorqjp2" path="res://addons/yat/src/scenes/yat_window/context_menu/context_submenu/ContextSubmenu.tscn" id="1_bnw12"]
4 | [ext_resource type="Script" uid="uid://bfx1vaj3vbclm" path="res://addons/yat/src/scenes/game_terminal/components/quick_commands_context/QuickCommandsContext.cs" id="2_6o8dw"]
5 | [ext_resource type="Script" uid="uid://dblig1tkrnt36" path="res://addons/yat/src/resources/quick_commands/QuickCommands.cs" id="3_nexgn"]
6 |
7 | [sub_resource type="Resource" id="Resource_14y2t"]
8 | script = ExtResource("3_nexgn")
9 | Commands = Dictionary[String, String]({})
10 |
11 | [node name="QuickCommandsContext" instance=ExtResource("1_bnw12")]
12 | script = ExtResource("2_6o8dw")
13 | QuickCommands = SubResource("Resource_14y2t")
14 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/game_terminal/components/terminal_switcher/TerminalSwitcher.cs.uid:
--------------------------------------------------------------------------------
1 | uid://dnib2gjrywl1n
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/game_terminal/components/terminal_switcher/TerminalSwitcher.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=5 format=3 uid="uid://bwwlprkf31kug"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://dfig0yknmx6b7" path="res://addons/yat/src/scenes/base_terminal/BaseTerminal.tscn" id="1_4hm75"]
4 | [ext_resource type="Script" uid="uid://dnib2gjrywl1n" path="res://addons/yat/src/scenes/game_terminal/components/terminal_switcher/TerminalSwitcher.cs" id="1_e2kn4"]
5 | [ext_resource type="Theme" uid="uid://bh7d0xeft70dh" path="res://addons/yat/src/scenes/game_terminal/components/terminal_switcher/theme/yat_terminal_switcher_theme.tres" id="1_v2cws"]
6 |
7 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_yfm05"]
8 |
9 | [node name="TerminalSwitcher" type="PanelContainer"]
10 | anchors_preset = 15
11 | anchor_right = 1.0
12 | anchor_bottom = 1.0
13 | grow_horizontal = 2
14 | grow_vertical = 2
15 | theme = ExtResource("1_v2cws")
16 | theme_override_styles/panel = SubResource("StyleBoxEmpty_yfm05")
17 | script = ExtResource("1_e2kn4")
18 |
19 | [node name="VBoxContainer" type="VBoxContainer" parent="."]
20 | layout_mode = 2
21 |
22 | [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
23 | layout_mode = 2
24 |
25 | [node name="TabBar" type="TabBar" parent="VBoxContainer/HBoxContainer"]
26 | unique_name_in_owner = true
27 | layout_mode = 2
28 | size_flags_horizontal = 3
29 | tab_close_display_policy = 1
30 | drag_to_rearrange_enabled = true
31 | tab_count = 1
32 | tab_0/title = "Terminal"
33 |
34 | [node name="Add" type="Button" parent="VBoxContainer/HBoxContainer"]
35 | unique_name_in_owner = true
36 | layout_mode = 2
37 | size_flags_horizontal = 8
38 | text = " + "
39 |
40 | [node name="InstancesContainer" type="PanelContainer" parent="VBoxContainer"]
41 | unique_name_in_owner = true
42 | layout_mode = 2
43 | size_flags_vertical = 3
44 |
45 | [node name="BaseTerminal" parent="VBoxContainer/InstancesContainer" instance=ExtResource("1_4hm75")]
46 | unique_name_in_owner = true
47 | layout_mode = 2
48 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/game_terminal/components/terminal_switcher/theme/yat_terminal_switcher_button_normal.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StyleBoxFlat" format=3 uid="uid://vh3j5ydrbq40"]
2 |
3 | [resource]
4 | content_margin_left = 8.0
5 | content_margin_top = 6.0
6 | content_margin_right = 8.0
7 | content_margin_bottom = 6.0
8 | bg_color = Color(0.0901961, 0.105882, 0.129412, 1)
9 | corner_radius_top_left = 6
10 | corner_radius_top_right = 6
11 | corner_radius_bottom_right = 6
12 | corner_radius_bottom_left = 6
13 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/game_terminal/components/terminal_switcher/theme/yat_terminal_switcher_tab_selected.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StyleBoxFlat" format=3 uid="uid://blle8xkq3vl1t"]
2 |
3 | [resource]
4 | content_margin_left = 12.0
5 | content_margin_top = 6.0
6 | content_margin_right = 12.0
7 | content_margin_bottom = 6.0
8 | bg_color = Color(0.0901961, 0.105882, 0.129412, 1)
9 | border_width_left = 4
10 | border_width_right = 4
11 | border_color = Color(0.8, 0.8, 0.8, 0)
12 | corner_radius_top_left = 6
13 | corner_radius_top_right = 6
14 | corner_radius_bottom_right = 6
15 | corner_radius_bottom_left = 6
16 | anti_aliasing_size = 0.016
17 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/game_terminal/components/terminal_switcher/theme/yat_terminal_switcher_tab_unselected.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StyleBoxFlat" format=3 uid="uid://dsl6r74qyyffw"]
2 |
3 | [resource]
4 | content_margin_left = 12.0
5 | content_margin_top = 6.0
6 | content_margin_right = 12.0
7 | content_margin_bottom = 6.0
8 | bg_color = Color(0.0901961, 0.105882, 0.129412, 1)
9 | border_width_left = 4
10 | border_width_right = 4
11 | border_color = Color(0.8, 0.8, 0.8, 0)
12 | corner_radius_top_left = 6
13 | corner_radius_top_right = 6
14 | corner_radius_bottom_right = 6
15 | corner_radius_bottom_left = 6
16 | anti_aliasing_size = 0.016
17 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/game_terminal/components/terminal_switcher/theme/yat_terminal_switcher_theme.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Theme" load_steps=5 format=3 uid="uid://bh7d0xeft70dh"]
2 |
3 | [ext_resource type="StyleBox" uid="uid://vh3j5ydrbq40" path="res://addons/yat/src/scenes/game_terminal/components/terminal_switcher/theme/yat_terminal_switcher_button_normal.tres" id="1_jcegf"]
4 | [ext_resource type="StyleBox" uid="uid://blle8xkq3vl1t" path="res://addons/yat/src/scenes/game_terminal/components/terminal_switcher/theme/yat_terminal_switcher_tab_selected.tres" id="1_v54mo"]
5 | [ext_resource type="StyleBox" uid="uid://dsl6r74qyyffw" path="res://addons/yat/src/scenes/game_terminal/components/terminal_switcher/theme/yat_terminal_switcher_tab_unselected.tres" id="2_23gb6"]
6 |
7 | [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_n76w0"]
8 | content_margin_left = 8.0
9 | content_margin_right = 8.0
10 | bg_color = Color(0.0685255, 0.0819031, 0.101969, 1)
11 | corner_radius_top_left = 6
12 | corner_radius_top_right = 6
13 | corner_radius_bottom_right = 6
14 | corner_radius_bottom_left = 6
15 |
16 | [resource]
17 | Button/styles/focus = ExtResource("1_jcegf")
18 | Button/styles/normal = ExtResource("1_jcegf")
19 | Button/styles/pressed = SubResource("StyleBoxFlat_n76w0")
20 | TabBar/font_sizes/font_size = 12
21 | TabBar/styles/tab_focus = ExtResource("1_v54mo")
22 | TabBar/styles/tab_hovered = ExtResource("1_v54mo")
23 | TabBar/styles/tab_selected = ExtResource("1_v54mo")
24 | TabBar/styles/tab_unselected = ExtResource("2_23gb6")
25 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/input_container/InputContainer.cs.uid:
--------------------------------------------------------------------------------
1 | uid://buyc2vcvxrfok
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/input_container/InputContainer.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://dgq3jncmxdomf"]
2 |
3 | [ext_resource type="Theme" uid="uid://c550tfu5s4jf3" path="res://addons/yat/src/scenes/input_container/yat_input_container_theme.tres" id="1_cib6j"]
4 | [ext_resource type="Script" uid="uid://buyc2vcvxrfok" path="res://addons/yat/src/scenes/input_container/InputContainer.cs" id="1_i2hav"]
5 |
6 | [node name="InputContainer" type="PanelContainer"]
7 | anchors_preset = 15
8 | anchor_right = 1.0
9 | anchor_bottom = 1.0
10 | grow_horizontal = 2
11 | grow_vertical = 2
12 | size_flags_horizontal = 3
13 | theme = ExtResource("1_cib6j")
14 | script = ExtResource("1_i2hav")
15 | Text = &"Lorem ipsum dolor sit amet"
16 |
17 | [node name="HBoxContainer" type="HBoxContainer" parent="."]
18 | layout_mode = 2
19 |
20 | [node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
21 | layout_mode = 2
22 | size_flags_horizontal = 3
23 |
24 | [node name="Label" type="Label" parent="HBoxContainer/VBoxContainer"]
25 | unique_name_in_owner = true
26 | layout_mode = 2
27 | text = "Name"
28 |
29 | [node name="LineEdit" type="LineEdit" parent="HBoxContainer/VBoxContainer"]
30 | unique_name_in_owner = true
31 | layout_mode = 2
32 |
33 | [node name="ColorPickerButton" type="ColorPickerButton" parent="HBoxContainer/VBoxContainer"]
34 | unique_name_in_owner = true
35 | layout_mode = 2
36 | text = "Color"
37 |
38 | [node name="SpinBox" type="SpinBox" parent="HBoxContainer/VBoxContainer"]
39 | unique_name_in_owner = true
40 | layout_mode = 2
41 |
42 | [node name="CheckBox" type="CheckBox" parent="HBoxContainer/VBoxContainer"]
43 | unique_name_in_owner = true
44 | layout_mode = 2
45 | text = "Lorem ipsum dolor sit amet"
46 |
47 | [node name="TakeHalfTheSize" type="Control" parent="HBoxContainer"]
48 | layout_mode = 2
49 | size_flags_horizontal = 3
50 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/input_container/yat_input_container_theme.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Theme" load_steps=6 format=3 uid="uid://c550tfu5s4jf3"]
2 |
3 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ei582"]
4 |
5 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_scx1t"]
6 |
7 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_2paqf"]
8 |
9 | [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cjo88"]
10 | bg_color = Color(0.6, 0.6, 0.6, 0)
11 | border_width_bottom = 1
12 | border_color = Color(0, 0, 0, 1)
13 |
14 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_2arwb"]
15 |
16 | [resource]
17 | CheckBox/font_sizes/font_size = 12
18 | CheckBox/styles/focus = SubResource("StyleBoxEmpty_ei582")
19 | ColorPickerButton/styles/focus = SubResource("StyleBoxEmpty_scx1t")
20 | Label/font_sizes/font_size = 12
21 | LineEdit/colors/font_color = Color(0.87451, 0.87451, 0.87451, 0.501961)
22 | LineEdit/styles/focus = SubResource("StyleBoxEmpty_2paqf")
23 | LineEdit/styles/normal = SubResource("StyleBoxFlat_cjo88")
24 | PanelContainer/styles/panel = SubResource("StyleBoxEmpty_2arwb")
25 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/preferences/Preferences.cs.uid:
--------------------------------------------------------------------------------
1 | uid://b45nsby66wolu
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/preferences/Preferences.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=4 format=3 uid="uid://ca2i4r24ny7y3"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://o1hlj04h0rri" path="res://addons/yat/src/scenes/yat_window/YatWindow.tscn" id="1_f8myu"]
4 | [ext_resource type="Script" uid="uid://b45nsby66wolu" path="res://addons/yat/src/scenes/preferences/Preferences.cs" id="2_1u1aj"]
5 | [ext_resource type="Theme" uid="uid://ugpwajpfdu4" path="res://addons/yat/src/scenes/preferences/yat_preferences_theme.tres" id="4_ti2tk"]
6 |
7 | [node name="Preferences" instance=ExtResource("1_f8myu")]
8 | title = "Preferences"
9 | script = ExtResource("2_1u1aj")
10 |
11 | [node name="Content" parent="." index="0"]
12 | theme = ExtResource("4_ti2tk")
13 |
14 | [node name="VBoxContainer" type="VBoxContainer" parent="Content" index="0"]
15 | layout_mode = 2
16 |
17 | [node name="HBoxContainer" type="HBoxContainer" parent="Content/VBoxContainer" index="0"]
18 | layout_mode = 2
19 |
20 | [node name="Load" type="Button" parent="Content/VBoxContainer/HBoxContainer" index="0"]
21 | unique_name_in_owner = true
22 | layout_mode = 2
23 | tooltip_text = "Load preferences from file"
24 | text = "Load"
25 |
26 | [node name="Save" type="Button" parent="Content/VBoxContainer/HBoxContainer" index="1"]
27 | unique_name_in_owner = true
28 | layout_mode = 2
29 | tooltip_text = "Save preferences to file"
30 | text = "Save"
31 |
32 | [node name="Update" type="Button" parent="Content/VBoxContainer/HBoxContainer" index="2"]
33 | unique_name_in_owner = true
34 | layout_mode = 2
35 | tooltip_text = "Update preferences without writing to a file"
36 | text = "Update"
37 |
38 | [node name="RestoreDefaults" type="Button" parent="Content/VBoxContainer/HBoxContainer" index="3"]
39 | unique_name_in_owner = true
40 | layout_mode = 2
41 | tooltip_text = "Restore default settings"
42 | text = "Restore Defaults"
43 |
44 | [node name="TabContainer" type="TabContainer" parent="Content/VBoxContainer" index="1"]
45 | unique_name_in_owner = true
46 | layout_mode = 2
47 | size_flags_vertical = 3
48 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/preferences/components/preferences_section/PreferencesSection.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 |
3 | namespace YAT.Scenes;
4 |
5 | public partial class PreferencesSection : PanelContainer
6 | {
7 | #nullable disable
8 | public Label Title { get; private set; }
9 | public VBoxContainer Content { get; private set; }
10 | #nullable restore
11 |
12 | public override void _Ready()
13 | {
14 | Title = GetNode("%Title");
15 | Content = GetNode("%Content");
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/preferences/components/preferences_section/PreferencesSection.cs.uid:
--------------------------------------------------------------------------------
1 | uid://2s6qhsxpy0x1
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/preferences/components/preferences_section/PreferencesSection.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://o78tqt867i13"]
2 |
3 | [ext_resource type="Theme" uid="uid://bkuhm7arbteea" path="res://addons/yat/src/scenes/preferences/components/preferences_section/yat_preferences_section_theme.tres" id="1_yjkcx"]
4 | [ext_resource type="Script" uid="uid://2s6qhsxpy0x1" path="res://addons/yat/src/scenes/preferences/components/preferences_section/PreferencesSection.cs" id="2_nom1n"]
5 |
6 | [node name="PreferencesSection" type="PanelContainer"]
7 | anchors_preset = 15
8 | anchor_right = 1.0
9 | anchor_bottom = 1.0
10 | grow_horizontal = 2
11 | grow_vertical = 2
12 | size_flags_horizontal = 3
13 | theme = ExtResource("1_yjkcx")
14 | script = ExtResource("2_nom1n")
15 |
16 | [node name="VBoxContainer" type="VBoxContainer" parent="."]
17 | layout_mode = 2
18 |
19 | [node name="Title" type="Label" parent="VBoxContainer"]
20 | unique_name_in_owner = true
21 | layout_mode = 2
22 | text = "Lorem ipsum dolor sit amet"
23 |
24 | [node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
25 | layout_mode = 2
26 |
27 | [node name="Content" type="VBoxContainer" parent="VBoxContainer"]
28 | unique_name_in_owner = true
29 | layout_mode = 2
30 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/preferences/components/preferences_section/yat_preferences_section_theme.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Theme" load_steps=2 format=3 uid="uid://bkuhm7arbteea"]
2 |
3 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_r7d2f"]
4 |
5 | [resource]
6 | PanelContainer/styles/panel = SubResource("StyleBoxEmpty_r7d2f")
7 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/preferences/components/preferences_tab/PreferencesTab.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 |
3 | namespace YAT.Scenes;
4 |
5 | public partial class PreferencesTab : PanelContainer
6 | {
7 | #nullable disable
8 | public VBoxContainer Container { get; private set; }
9 | #nullable restore
10 |
11 | public override void _Ready()
12 | {
13 | Container = GetNode("%VBoxContainer");
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/preferences/components/preferences_tab/PreferencesTab.cs.uid:
--------------------------------------------------------------------------------
1 | uid://co7xf23g1jafx
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/preferences/components/preferences_tab/PreferencesTab.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=2 format=3 uid="uid://bxdeasqh565nr"]
2 |
3 | [ext_resource type="Script" uid="uid://co7xf23g1jafx" path="res://addons/yat/src/scenes/preferences/components/preferences_tab/PreferencesTab.cs" id="1_d73le"]
4 |
5 | [node name="PreferencesTab" type="PanelContainer"]
6 | anchors_preset = 15
7 | anchor_right = 1.0
8 | anchor_bottom = 1.0
9 | grow_horizontal = 2
10 | grow_vertical = 2
11 | size_flags_horizontal = 3
12 | size_flags_vertical = 3
13 | script = ExtResource("1_d73le")
14 |
15 | [node name="ScrollContainer" type="ScrollContainer" parent="."]
16 | layout_mode = 2
17 |
18 | [node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
19 | unique_name_in_owner = true
20 | layout_mode = 2
21 | size_flags_horizontal = 3
22 | size_flags_vertical = 3
23 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/preferences/yat_preferences_theme.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Theme" load_steps=4 format=3 uid="uid://ugpwajpfdu4"]
2 |
3 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vikv"]
4 |
5 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_l6xp6"]
6 |
7 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_bgvqd"]
8 |
9 | [resource]
10 | Button/styles/focus = SubResource("StyleBoxEmpty_5vikv")
11 | TabContainer/styles/panel = SubResource("StyleBoxEmpty_l6xp6")
12 | TabContainer/styles/tab_focus = SubResource("StyleBoxEmpty_bgvqd")
13 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/registered_commands/RegisteredCommands.cs.uid:
--------------------------------------------------------------------------------
1 | uid://dpc4up55rv0bi
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/registered_commands/RegisteredCommands.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=2 format=3 uid="uid://r45e18qb3ekv"]
2 |
3 | [ext_resource type="Script" uid="uid://dpc4up55rv0bi" path="res://addons/yat/src/scenes/registered_commands/RegisteredCommands.cs" id="1_c1klr"]
4 |
5 | [node name="RegisteredCommands" type="Node"]
6 | script = ExtResource("1_c1klr")
7 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/terminal_manager/TerminalManager.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 | using YAT.Helpers;
3 |
4 | namespace YAT.Scenes;
5 |
6 | public partial class TerminalManager : Node
7 | {
8 | [Signal] public delegate void TerminalOpenedEventHandler();
9 | [Signal] public delegate void TerminalClosedEventHandler();
10 |
11 | #nullable disable
12 | public GameTerminal GameTerminal;
13 | public BaseTerminal CurrentTerminal { get; private set; }
14 |
15 | private YAT _yat;
16 | #nullable restore
17 |
18 | public override void _Ready()
19 | {
20 | _yat = GetNode("/root/YAT");
21 |
22 | GameTerminal = GetNode("%GameTerminal");
23 | GameTerminal.Visible = false;
24 | GameTerminal.CloseRequested += CloseTerminal;
25 | GameTerminal.TerminalSwitcher.CurrentTerminalChanged += (terminal) =>
26 | {
27 | CurrentTerminal = terminal;
28 | };
29 |
30 | CurrentTerminal = GameTerminal.TerminalSwitcher.CurrentTerminal;
31 | }
32 |
33 | public override void _UnhandledInput(InputEvent @event)
34 | {
35 | if (@event.IsActionPressed(Keybindings.TerminalToggle))
36 | {
37 | ToggleTerminal();
38 | }
39 | }
40 |
41 | public void ToggleTerminal()
42 | {
43 | if (!_yat.YatEnable.YatEnabled)
44 | {
45 | return;
46 | }
47 |
48 | if (GameTerminal.Visible)
49 | {
50 | CloseTerminal();
51 | }
52 | else
53 | {
54 | OpenTerminal();
55 | }
56 | }
57 |
58 | public void OpenTerminal()
59 | {
60 | GameTerminal.Visible = true;
61 | // 'Prevents' writing to the input when the terminal is toggled
62 | CurrentTerminal.Input.Clear();
63 |
64 | _ = EmitSignal(SignalName.TerminalOpened);
65 | }
66 |
67 | public void CloseTerminal()
68 | {
69 | GameTerminal.Visible = false;
70 |
71 | _ = EmitSignal(SignalName.TerminalClosed);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/terminal_manager/TerminalManager.cs.uid:
--------------------------------------------------------------------------------
1 | uid://c6c3g0nq4kah1
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/terminal_manager/TerminalManager.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://c4oxru3g4p038"]
2 |
3 | [ext_resource type="Script" uid="uid://c6c3g0nq4kah1" path="res://addons/yat/src/scenes/terminal_manager/TerminalManager.cs" id="1_rojed"]
4 | [ext_resource type="PackedScene" uid="uid://dsyqv187j7w76" path="res://addons/yat/src/scenes/game_terminal/GameTerminal.tscn" id="2_cthvu"]
5 |
6 | [node name="TerminalManager" type="Node"]
7 | script = ExtResource("1_rojed")
8 |
9 | [node name="GameTerminal" parent="." instance=ExtResource("2_cthvu")]
10 | unique_name_in_owner = true
11 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/yat_enable/YatEnable.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using Godot;
3 |
4 | namespace YAT.Scenes;
5 |
6 | public partial class YatEnable : Node
7 | {
8 | [Export(PropertyHint.Flags, "UserData,CurrentDirectory,CmdArgument")]
9 | public short YatEnableAction { get; set; } = 0;
10 |
11 | [Export] public string FileName { get; set; } = ".yatenable";
12 | [Export] public string ArgumentName { get; set; } = "--yat";
13 |
14 | public bool YatEnabled { get; set; } = true;
15 |
16 | public override void _Ready()
17 | {
18 | if (YatEnableAction == 0)
19 | {
20 | return;
21 | }
22 |
23 | if ((YatEnableAction & 0b0001) == 1)
24 | {
25 | YatEnabled = FileAccess.FileExists("user://" + FileName);
26 |
27 | if (YatEnabled)
28 | {
29 | return;
30 | }
31 | }
32 |
33 | if ((YatEnableAction & 0b0010) == 2)
34 | {
35 | YatEnabled = FileAccess.FileExists("res://" + FileName);
36 |
37 | if (YatEnabled)
38 | {
39 | return;
40 | }
41 | }
42 |
43 | if ((YatEnableAction & 0b0100) == 4)
44 | {
45 | YatEnabled = OS.GetCmdlineUserArgs().Contains(ArgumentName);
46 |
47 | if (YatEnabled)
48 | {
49 | return;
50 | }
51 | }
52 |
53 | YatEnabled = false;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/yat_enable/YatEnable.cs.uid:
--------------------------------------------------------------------------------
1 | uid://r0mdowhs7k75
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/yat_enable/YatEnable.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=2 format=3 uid="uid://bkrycicg7xrko"]
2 |
3 | [ext_resource type="Script" uid="uid://r0mdowhs7k75" path="res://addons/yat/src/scenes/yat_enable/YatEnable.cs" id="1_uoety"]
4 |
5 | [node name="YatEnable" type="Node"]
6 | script = ExtResource("1_uoety")
7 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/yat_window/YatWindow.cs.uid:
--------------------------------------------------------------------------------
1 | uid://bjmmo3pbela21
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/yat_window/YatWindow.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=5 format=3 uid="uid://o1hlj04h0rri"]
2 |
3 | [ext_resource type="Theme" uid="uid://b0caaqjmiluf7" path="res://addons/yat/src/scenes/yat_window/theme/yat_yatwindow_theme.tres" id="1_cty0e"]
4 | [ext_resource type="Script" uid="uid://bjmmo3pbela21" path="res://addons/yat/src/scenes/yat_window/YatWindow.cs" id="2_1mdws"]
5 | [ext_resource type="PackedScene" uid="uid://cqk7b35vstfc8" path="res://addons/yat/src/scenes/yat_window/context_menu/ContextMenu.tscn" id="3_u6so0"]
6 |
7 | [sub_resource type="Theme" id="Theme_tk4rv"]
8 | default_font_size = 18
9 |
10 | [node name="YatWindow" type="Window"]
11 | disable_3d = true
12 | canvas_item_default_texture_filter = 2
13 | title = "Window"
14 | position = Vector2i(0, 36)
15 | size = Vector2i(512, 256)
16 | transient = true
17 | min_size = Vector2i(256, 144)
18 | content_scale_mode = 1
19 | theme = ExtResource("1_cty0e")
20 | script = ExtResource("2_1mdws")
21 |
22 | [node name="Content" type="PanelContainer" parent="."]
23 | anchors_preset = 15
24 | anchor_right = 1.0
25 | anchor_bottom = 1.0
26 | grow_horizontal = 2
27 | grow_vertical = 2
28 | size_flags_horizontal = 3
29 | size_flags_vertical = 3
30 | theme = SubResource("Theme_tk4rv")
31 |
32 | [node name="ContextMenu" parent="." instance=ExtResource("3_u6so0")]
33 | visible = false
34 | unfocusable = true
35 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/yat_window/context_menu/ContextMenu.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 |
3 | namespace YAT.Scenes;
4 |
5 | public partial class ContextMenu : PopupMenu
6 | {
7 | [Export] public ushort WallMargin { get; set; } = 16;
8 | [Export] public bool ShrinkToFit { get; set; } = true;
9 |
10 | private Viewport? _viewport = null;
11 | private Rect2 _viewportRect;
12 |
13 | public override void _Ready()
14 | {
15 | _viewport = GetTree().Root.GetViewport();
16 | _viewportRect = _viewport.GetVisibleRect();
17 |
18 | Hide();
19 |
20 | if (ShrinkToFit)
21 | {
22 | MenuChanged += Shrink;
23 | }
24 | }
25 |
26 | private void Shrink()
27 | {
28 | Vector2 itemsSize = GetItemsSize();
29 |
30 | Size = new()
31 | {
32 | X = 1,
33 | Y = 1
34 | };
35 | Size = (Vector2I)itemsSize;
36 | }
37 |
38 | private Vector2 GetItemsSize()
39 | {
40 | var items = GetChildren();
41 | var size = new Vector2();
42 |
43 | foreach (Node? item in items)
44 | {
45 | if (item is Control control)
46 | {
47 | size += control.Size;
48 | }
49 |
50 | if (item is PopupMenu popupMenu)
51 | {
52 | size += popupMenu.Size;
53 | }
54 | }
55 |
56 | return size;
57 | }
58 |
59 | public void ShowNextToMouse()
60 | {
61 | if (_viewport is null)
62 | {
63 | return;
64 | }
65 |
66 | Vector2 mousePos = _viewport.GetMousePosition();
67 | var (limitX, limitY) = CalculateLimits(_viewportRect);
68 |
69 | Show();
70 |
71 | Position = new()
72 | {
73 | X = (int)Mathf.Clamp(mousePos.X, WallMargin, limitX),
74 | Y = (int)Mathf.Clamp(mousePos.Y, WallMargin, limitY)
75 | };
76 | }
77 |
78 | public (float, float) CalculateLimits(Rect2 rect)
79 | {
80 | float limitX = rect.Size.X - Size.X - WallMargin;
81 | float limitY = rect.Size.Y - Size.Y - WallMargin;
82 |
83 | return (limitX, limitY);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/yat_window/context_menu/ContextMenu.cs.uid:
--------------------------------------------------------------------------------
1 | uid://cqd0cnsafblm1
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/yat_window/context_menu/ContextMenu.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://cqk7b35vstfc8"]
2 |
3 | [ext_resource type="Theme" uid="uid://ds2kv5hxa6wpg" path="res://addons/yat/src/scenes/yat_window/context_menu/yat_context_menu_theme.tres" id="1_yydo2"]
4 | [ext_resource type="Script" uid="uid://cqd0cnsafblm1" path="res://addons/yat/src/scenes/yat_window/context_menu/ContextMenu.cs" id="2_ura0f"]
5 |
6 | [node name="ContextMenu" type="PopupMenu"]
7 | disable_3d = true
8 | size = Vector2i(44, 24)
9 | visible = true
10 | theme = ExtResource("1_yydo2")
11 | script = ExtResource("2_ura0f")
12 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/yat_window/context_menu/context_submenu/ContextSubmenu.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 |
3 | namespace YAT.Scenes;
4 |
5 | public partial class ContextSubmenu : PopupMenu
6 | {
7 | public override void _Ready()
8 | {
9 | Hide();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/yat_window/context_menu/context_submenu/ContextSubmenu.cs.uid:
--------------------------------------------------------------------------------
1 | uid://eotgy3gej5kk
2 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/yat_window/context_menu/context_submenu/ContextSubmenu.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://jdyvooorqjp2"]
2 |
3 | [ext_resource type="PackedScene" uid="uid://cqk7b35vstfc8" path="res://addons/yat/src/scenes/yat_window/context_menu/ContextMenu.tscn" id="1_dg3mc"]
4 | [ext_resource type="Script" uid="uid://eotgy3gej5kk" path="res://addons/yat/src/scenes/yat_window/context_menu/context_submenu/ContextSubmenu.cs" id="2_6k21l"]
5 |
6 | [node name="ContextSubmenu" instance=ExtResource("1_dg3mc")]
7 | title = ""
8 | item_count = 0
9 | script = ExtResource("2_6k21l")
10 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/yat_window/context_menu/yat_context_menu_theme.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Theme" load_steps=6 format=3 uid="uid://ds2kv5hxa6wpg"]
2 |
3 | [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_y3leb"]
4 | bg_color = Color(0.215686, 0.309804, 0.403922, 1)
5 | corner_radius_top_left = 6
6 | corner_radius_top_right = 6
7 | corner_radius_bottom_right = 6
8 | corner_radius_bottom_left = 6
9 |
10 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_j10hw"]
11 |
12 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_gempe"]
13 |
14 | [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cdm46"]
15 | content_margin_left = 12.0
16 | content_margin_top = 12.0
17 | content_margin_right = 12.0
18 | content_margin_bottom = 12.0
19 | bg_color = Color(0.113725, 0.133333, 0.160784, 1)
20 | border_width_left = 1
21 | border_width_top = 1
22 | border_width_right = 1
23 | border_width_bottom = 1
24 | border_color = Color(0, 0, 0, 1)
25 |
26 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_gy6jr"]
27 |
28 | [resource]
29 | PopupMenu/font_sizes/font_separator_size = 16
30 | PopupMenu/font_sizes/font_size = 14
31 | PopupMenu/styles/hover = SubResource("StyleBoxFlat_y3leb")
32 | PopupMenu/styles/labeled_separator_left = SubResource("StyleBoxEmpty_j10hw")
33 | PopupMenu/styles/labeled_separator_right = SubResource("StyleBoxEmpty_gempe")
34 | PopupMenu/styles/panel = SubResource("StyleBoxFlat_cdm46")
35 | PopupMenu/styles/separator = SubResource("StyleBoxEmpty_gy6jr")
36 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/yat_window/theme/yat_window_theme.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StyleBoxFlat" format=3 uid="uid://cg7clw201sub3"]
2 |
3 | [resource]
4 | bg_color = Color(0.113725, 0.133333, 0.160784, 1)
5 | border_width_left = 1
6 | border_width_top = 1
7 | border_width_right = 1
8 | border_width_bottom = 1
9 | border_color = Color(0, 0, 0, 1)
10 | corner_radius_top_left = 6
11 | corner_radius_top_right = 6
12 | corner_radius_bottom_right = 6
13 | corner_radius_bottom_left = 6
14 | expand_margin_left = 6.0
15 | expand_margin_top = 32.0
16 | expand_margin_right = 6.0
17 | expand_margin_bottom = 6.0
18 | shadow_color = Color(0, 0, 0, 0.25098)
19 | shadow_size = 1
20 | shadow_offset = Vector2(-3, 3)
21 |
--------------------------------------------------------------------------------
/addons/yat/src/scenes/yat_window/theme/yat_yatwindow_theme.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Theme" load_steps=3 format=3 uid="uid://b0caaqjmiluf7"]
2 |
3 | [ext_resource type="StyleBox" uid="uid://cg7clw201sub3" path="res://addons/yat/src/scenes/yat_window/theme/yat_window_theme.tres" id="1_5da5f"]
4 |
5 | [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_eeww4"]
6 | bg_color = Color(0.113725, 0.133333, 0.160784, 1)
7 |
8 | [resource]
9 | PanelContainer/styles/panel = SubResource("StyleBoxFlat_eeww4")
10 | Window/styles/embedded_border = ExtResource("1_5da5f")
11 | Window/styles/embedded_unfocused_border = ExtResource("1_5da5f")
12 |
--------------------------------------------------------------------------------
/addons/yat/src/types/CommandData.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading;
3 | using Godot;
4 | using YAT.Interfaces;
5 | using YAT.Scenes;
6 |
7 | namespace YAT.Types;
8 |
9 | public sealed record CommandData(
10 | YAT Yat,
11 | BaseTerminal Terminal,
12 | ICommand? Command,
13 | string[] RawData,
14 | Dictionary Arguments,
15 | Dictionary Options,
16 | CancellationToken CancellationToken
17 | );
18 |
--------------------------------------------------------------------------------
/addons/yat/src/types/CommandData.cs.uid:
--------------------------------------------------------------------------------
1 | uid://xpfyeawt6aiq
2 |
--------------------------------------------------------------------------------
/addons/yat/src/types/CommandInputType.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 |
3 | namespace YAT.Types;
4 |
5 | public record CommandInputType(StringName Type, float Min, float Max, bool IsArray)
6 | {
7 | public CommandInputType() : this(string.Empty, 0.0f, 0.0f, false) { }
8 | }
9 |
--------------------------------------------------------------------------------
/addons/yat/src/types/CommandInputType.cs.uid:
--------------------------------------------------------------------------------
1 | uid://c2v6xck60crag
2 |
--------------------------------------------------------------------------------
/addons/yat/src/types/CommandResult.cs:
--------------------------------------------------------------------------------
1 | using YAT.Enums;
2 |
3 | namespace YAT.Types;
4 |
5 | public record CommandResult(
6 | ECommandResult Result,
7 | string[]? OutData = null, // TODO: Allow OutData to be an any object.
8 | string Message = ""
9 | );
10 |
--------------------------------------------------------------------------------
/addons/yat/src/types/CommandResult.cs.uid:
--------------------------------------------------------------------------------
1 | uid://d2t8s5o7d0uo3
2 |
--------------------------------------------------------------------------------
/addons/yat/src/types/NodeMethodInfo.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 | using Godot.Collections;
3 |
4 | namespace YAT.Types;
5 |
6 | public readonly struct NodeMethodInfo
7 | {
8 | public StringName Name { get; }
9 | public Array> Args { get; }
10 | public Array DefaultArgs { get; }
11 | public MethodFlags Flags { get; }
12 | public int Id { get; }
13 | ///
14 | /// Contains the following entries:
15 | ///
16 | ///
17 | /// - name
18 | /// - class_name
19 | /// - type
20 | /// - hint
21 | /// - hint_string
22 | /// - usage
23 | ///
24 | ///
25 | /// See https://docs.godotengine.org/en/stable/classes/class_object.html#class-object-method-get-property-list.
26 | ///
27 | public Dictionary Return { get; }
28 |
29 | public NodeMethodInfo(StringName name, Array> args, Array defaultArgs, MethodFlags flags, int id, Dictionary @return)
30 | {
31 | Name = name;
32 | Args = args;
33 | DefaultArgs = defaultArgs;
34 | Flags = flags;
35 | Id = id;
36 | Return = @return;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/addons/yat/src/types/NodeMethodInfo.cs.uid:
--------------------------------------------------------------------------------
1 | uid://dpf4akjuxnf5t
2 |
--------------------------------------------------------------------------------
/example/SetCube.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 | using YAT.Attributes;
3 | using YAT.Interfaces;
4 | using YAT.Types;
5 |
6 | [Extension("cubecolor", "Sets the cube's color.", "[b]Usage[/b]: setcube [i]color[/i]")]
7 | public sealed class SetCube : IExtension
8 | {
9 | #nullable disable
10 | public static MeshInstance3D Cube { get; set; }
11 | #nullable restore
12 |
13 | public CommandResult Execute(CommandData data)
14 | {
15 | if (data.RawData.Length < 2) return ICommand.InvalidArguments("Invalid arguments.");
16 |
17 | try
18 | {
19 | Color color = new(data.RawData[1]);
20 | Cube.MaterialOverride = new StandardMaterial3D
21 | {
22 | AlbedoColor = color
23 | };
24 | }
25 | catch (System.Exception)
26 | {
27 | return ICommand.Failure("Invalid color.");
28 | }
29 |
30 | return ICommand.Success();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/example/SetCube.cs.uid:
--------------------------------------------------------------------------------
1 | uid://7usk5jfjqlw6
2 |
--------------------------------------------------------------------------------
/example/assets/ATTRIBUTION.txt:
--------------------------------------------------------------------------------
1 | "Into the Maelstrom" by glaciære is licensed under CC-BY.
2 | "Dashed Grid (The Best Darn Grid Shader (Yet))" by Retrox is licensed under CC0.
3 |
--------------------------------------------------------------------------------
/example/assets/audio/glaciære - two months of moments - 01 Into the Maelstrom.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MASSHUU12/godot-yat/a27fc24f34e6cef64fcba0b628c3ef02f136ccfc/example/assets/audio/glaciære - two months of moments - 01 Into the Maelstrom.mp3
--------------------------------------------------------------------------------
/example/assets/audio/glaciære - two months of moments - 01 Into the Maelstrom.mp3.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="mp3"
4 | type="AudioStreamMP3"
5 | uid="uid://c6jdu6yveeusj"
6 | path="res://.godot/imported/glaciære - two months of moments - 01 Into the Maelstrom.mp3-c1cbec357c644096ead5d2f88e801877.mp3str"
7 |
8 | [deps]
9 |
10 | source_file="res://example/assets/audio/glaciære - two months of moments - 01 Into the Maelstrom.mp3"
11 | dest_files=["res://.godot/imported/glaciære - two months of moments - 01 Into the Maelstrom.mp3-c1cbec357c644096ead5d2f88e801877.mp3str"]
12 |
13 | [params]
14 |
15 | loop=true
16 | loop_offset=0.0
17 | bpm=0.0
18 | beat_count=0
19 | bar_beats=4
20 |
--------------------------------------------------------------------------------
/example/assets/shaders/grid.gdshader.uid:
--------------------------------------------------------------------------------
1 | uid://bcvnikc3hjac
2 |
--------------------------------------------------------------------------------
/example/props/static_cube/StaticCube.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=5 format=3 uid="uid://bgdcyhxl4a4bj"]
2 |
3 | [ext_resource type="Shader" uid="uid://bcvnikc3hjac" path="res://example/assets/shaders/grid.gdshader" id="1_hgiqo"]
4 |
5 | [sub_resource type="ShaderMaterial" id="ShaderMaterial_5h86q"]
6 | render_priority = 0
7 | shader = ExtResource("1_hgiqo")
8 | shader_parameter/subdivisions = 12.0
9 | shader_parameter/grid_width = 0.02
10 | shader_parameter/background_color = Color(0.172549, 0.247059, 0.301961, 1)
11 | shader_parameter/background_color_two = Color(0.152941, 0.423529, 0.494118, 1)
12 | shader_parameter/grid_color = Color(0.5, 0.5, 0.5, 1)
13 | shader_parameter/dashed_scale_x = 0.02
14 | shader_parameter/dashed_scale_y = 0.02
15 | shader_parameter/dashed_count_x = 1.0
16 | shader_parameter/dashed_count_y = 1.0
17 | shader_parameter/point_width = 0.021
18 | shader_parameter/point_color = Color(0, 0, 0, 1)
19 | shader_parameter/point_scale_x = 0.05
20 | shader_parameter/point_scale_y = 0.05
21 | shader_parameter/inside_width = 0.01
22 | shader_parameter/inside_subdivisions = 6.0
23 | shader_parameter/inside_color = Color(0.4, 0.4, 0.4, 1)
24 | shader_parameter/in_dashed_scale_x = 0.3
25 | shader_parameter/in_dashed_scale_y = 0.3
26 | shader_parameter/in_dashed_count_x = 6.0
27 | shader_parameter/in_dashed_count_y = 6.0
28 |
29 | [sub_resource type="BoxMesh" id="BoxMesh_slfqr"]
30 | material = SubResource("ShaderMaterial_5h86q")
31 | size = Vector3(2, 2, 2)
32 |
33 | [sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_moub7"]
34 | data = PackedVector3Array(-1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1)
35 |
36 | [node name="StaticCube" type="StaticBody3D"]
37 |
38 | [node name="MeshInstance3D" type="MeshInstance3D" parent="."]
39 | mesh = SubResource("BoxMesh_slfqr")
40 |
41 | [node name="CollisionShape3D" type="CollisionShape3D" parent="."]
42 | shape = SubResource("ConcavePolygonShape3D_moub7")
43 |
--------------------------------------------------------------------------------
/example/scenes/game/Game.cs:
--------------------------------------------------------------------------------
1 | using Godot;
2 | using YAT.Classes;
3 | using YAT.Helpers;
4 |
5 | namespace Example;
6 |
7 | public partial class Game : Node3D
8 | {
9 | #nullable disable
10 | private Label3D _hint;
11 | #nullable restore
12 |
13 | public override void _Ready()
14 | {
15 | _hint = GetNode("%Hint");
16 |
17 | RegisterCommand();
18 | SetHint();
19 | }
20 |
21 | private void SetHint()
22 | {
23 | var inputMap = InputMap.GetActions();
24 |
25 | foreach (var action in inputMap)
26 | {
27 | if (action == Keybindings.TerminalToggle)
28 | {
29 | var inputEvent = InputMap.ActionGetEvents(action);
30 |
31 | _hint.Text = inputEvent.Count > 0
32 | ? $"Press {inputEvent[0].AsText()} to open the YAT overlay."
33 | : "Please set a key to open the YAT overlay.";
34 | return;
35 | }
36 | }
37 |
38 | _hint.Text = "Please create yat_toggle input map.";
39 | }
40 |
41 | private void RegisterCommand()
42 | {
43 | var cube = GetNode("Scene/Cube");
44 |
45 | SetCube.Cube = cube;
46 | Extensible.RegisterExtension("set", typeof(SetCube));
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/example/scenes/game/Game.cs.uid:
--------------------------------------------------------------------------------
1 | uid://ci0w1p2qs2ska
2 |
--------------------------------------------------------------------------------
/example/scenes/main_menu/MainMenu.gd:
--------------------------------------------------------------------------------
1 | extends Control
2 |
3 |
4 | func _ready() -> void:
5 | get_node("%Start").connect("pressed", _on_start_pressed)
6 | get_node("%Quit").connect("pressed", _on_quit_pressed)
7 |
8 |
9 | func _on_start_pressed() -> void:
10 | get_tree().change_scene_to_file("res://example/scenes/game/Game.tscn")
11 |
12 |
13 | func _on_quit_pressed() -> void:
14 | get_tree().quit()
15 |
--------------------------------------------------------------------------------
/example/scenes/main_menu/MainMenu.gd.uid:
--------------------------------------------------------------------------------
1 | uid://dg4inr87xm65e
2 |
--------------------------------------------------------------------------------
/example/scenes/main_menu/MainMenu.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=5 format=3 uid="uid://d4fqgp0bjijcv"]
2 |
3 | [ext_resource type="Script" uid="uid://dg4inr87xm65e" path="res://example/scenes/main_menu/MainMenu.gd" id="1_qgsi7"]
4 |
5 | [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_jxdgx"]
6 | content_margin_bottom = 24.0
7 |
8 | [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_q3cit"]
9 | bg_color = Color(0.129412, 0.14902, 0.180392, 1)
10 |
11 | [sub_resource type="Theme" id="Theme_efckn"]
12 | Button/font_sizes/font_size = 18
13 | Label/font_sizes/font_size = 32
14 | Label/styles/normal = SubResource("StyleBoxEmpty_jxdgx")
15 | PanelContainer/styles/panel = SubResource("StyleBoxFlat_q3cit")
16 |
17 | [node name="MainMenu" type="Control"]
18 | layout_mode = 3
19 | anchors_preset = 15
20 | anchor_right = 1.0
21 | anchor_bottom = 1.0
22 | grow_horizontal = 2
23 | grow_vertical = 2
24 | theme = SubResource("Theme_efckn")
25 | script = ExtResource("1_qgsi7")
26 |
27 | [node name="PanelContainer" type="PanelContainer" parent="."]
28 | layout_mode = 1
29 | anchors_preset = 15
30 | anchor_right = 1.0
31 | anchor_bottom = 1.0
32 | grow_horizontal = 2
33 | grow_vertical = 2
34 |
35 | [node name="CenterContainer" type="CenterContainer" parent="PanelContainer"]
36 | layout_mode = 2
37 |
38 | [node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/CenterContainer"]
39 | layout_mode = 2
40 |
41 | [node name="Title" type="Label" parent="PanelContainer/CenterContainer/VBoxContainer"]
42 | layout_mode = 2
43 | text = "YAT Example"
44 | horizontal_alignment = 1
45 | vertical_alignment = 1
46 |
47 | [node name="Start" type="Button" parent="PanelContainer/CenterContainer/VBoxContainer"]
48 | unique_name_in_owner = true
49 | layout_mode = 2
50 | text = "Start"
51 |
52 | [node name="Quit" type="Button" parent="PanelContainer/CenterContainer/VBoxContainer"]
53 | unique_name_in_owner = true
54 | layout_mode = 2
55 | text = "Quit"
56 |
--------------------------------------------------------------------------------
/example/scenes/player/Player.cs.uid:
--------------------------------------------------------------------------------
1 | uid://mj6oyu23mbcy
2 |
--------------------------------------------------------------------------------
/example/scenes/player/Player.tscn:
--------------------------------------------------------------------------------
1 | [gd_scene load_steps=3 format=3 uid="uid://dvnxjokqnumnn"]
2 |
3 | [ext_resource type="Script" uid="uid://mj6oyu23mbcy" path="res://example/scenes/player/Player.cs" id="1_xujnc"]
4 |
5 | [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_rune4"]
6 |
7 | [node name="Player" type="CharacterBody3D"]
8 | script = ExtResource("1_xujnc")
9 | MovementSpeed = 5.0
10 |
11 | [node name="Head" type="Node3D" parent="."]
12 | transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.75, 0)
13 |
14 | [node name="Camera3D" type="Camera3D" parent="Head"]
15 |
16 | [node name="CollisionShape3D" type="CollisionShape3D" parent="."]
17 | shape = SubResource("CapsuleShape3D_rune4")
18 |
--------------------------------------------------------------------------------
/script_templates/Node/Command.cs:
--------------------------------------------------------------------------------
1 | // meta-description: Base template for YAT commands.
2 |
3 | using _BINDINGS_NAMESPACE_;
4 | using YAT.Attributes;
5 | using YAT.Interfaces;
6 | using YAT.Types;
7 |
8 | namespace YAT.Commands;
9 |
10 | [Command("_CLASS_")]
11 | [Description("Lorem ipsum dolor sit amet.")]
12 | public sealed class _CLASS_ : ICommand
13 | {
14 | public CommandResult Execute(CommandData data)
15 | {
16 | return CommandResult.NotImplemented("_CLASS_ is not yet implemented!");
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/script_templates/Node/Command.cs.uid:
--------------------------------------------------------------------------------
1 | uid://cswwefucfbuqg
2 |
--------------------------------------------------------------------------------
/script_templates/Node/ExtensibleCommand.cs:
--------------------------------------------------------------------------------
1 | // meta-description: Base template for extensible YAT commands.
2 |
3 | using _BINDINGS_NAMESPACE_;
4 | using System;
5 | using YAT.Attributes;
6 | using YAT.Classes;
7 | using YAT.Interfaces;
8 | using YAT.Types;
9 |
10 | namespace YAT.Commands;
11 |
12 | [Command("_CLASS_")]
13 | [Description("Lorem ipsum dolor sit amet.")]
14 | [Argument("action", "string", "The name of the action to run.")]
15 | public partial class _CLASS_ : Extensible, ICommand
16 | {
17 | public CommandResult Execute(CommandData data)
18 | {
19 | var extensions = GetCommandExtensions("_CLASS_");
20 |
21 | if (extensions is null) return ICommand.Failure("No extensions found.");
22 |
23 | if (extensions.TryGetValue((string)data.Arguments["action"], out Type extension))
24 | return ExecuteExtension(extension, data with { RawData = data.RawData[1..] });
25 |
26 | return ICommand.Failure("Variable not found.");
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/script_templates/Node/ExtensibleCommand.cs.uid:
--------------------------------------------------------------------------------
1 | uid://5cwc22ne8w58
2 |
--------------------------------------------------------------------------------
/script_templates/Node/Extension.cs:
--------------------------------------------------------------------------------
1 | // meta-description: Base template for YAT commands extension.
2 |
3 | using _BINDINGS_NAMESPACE_;
4 | using YAT.Attributes;
5 | using YAT.Interfaces;
6 | using YAT.Types;
7 |
8 | [Extension("_CLASS_")]
9 | [Description("Lorem ipsum dolor sit amet.")]
10 | public sealed class _CLASS_ : IExtension
11 | {
12 | public CommandResult Execute(CommandData data)
13 | {
14 | return CommandResult.NotImplemented("_CLASS_ is not yet implemented!");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/script_templates/Node/Extension.cs.uid:
--------------------------------------------------------------------------------
1 | uid://5j2wjqmoxxnf
2 |
--------------------------------------------------------------------------------