├── .gitignore ├── .import ├── console1.PNG-e7e8cd4987cb591a558e4f25e568f40e.md5 ├── console1.PNG-e7e8cd4987cb591a558e4f25e568f40e.stex ├── console10.PNG-0ad8aab84abd045649ac69803f044fc2.md5 ├── console10.PNG-0ad8aab84abd045649ac69803f044fc2.stex ├── console2.PNG-344fbe5c1a5722c6af4cec6908abd0d9.md5 ├── console2.PNG-344fbe5c1a5722c6af4cec6908abd0d9.stex ├── console3.PNG-a38974fc05cc89cba31c29e1f5bc824e.md5 ├── console3.PNG-a38974fc05cc89cba31c29e1f5bc824e.stex ├── console4.PNG-957c7e94debc61afaa469f6a86668667.md5 ├── console4.PNG-957c7e94debc61afaa469f6a86668667.stex ├── console5.PNG-9db6909488434f088b55aa9becdd61b2.md5 ├── console5.PNG-9db6909488434f088b55aa9becdd61b2.stex ├── console6.PNG-4d47c1c49903b78cdcc9471674258d5f.md5 ├── console6.PNG-4d47c1c49903b78cdcc9471674258d5f.stex ├── console7.PNG-d639c38362085a7d5e9bc90121584031.md5 ├── console7.PNG-d639c38362085a7d5e9bc90121584031.stex ├── console8.PNG-1eb3ad0080bd713744ad7a6f7104b202.md5 ├── console8.PNG-1eb3ad0080bd713744ad7a6f7104b202.stex ├── console9.PNG-feea482cf6ce1ca77144f7e713a81220.md5 ├── console9.PNG-feea482cf6ce1ca77144f7e713a81220.stex ├── consoleFront.PNG-1538835cc3523dce36786caef6f4dcbb.md5 ├── consoleFront.PNG-1538835cc3523dce36786caef6f4dcbb.stex └── icon.png-487276ed1e3a0c39cad0279d744ee560.md5 ├── Console ├── Console.gd ├── Console.tscn ├── ConsoleChannel.gd ├── ConsoleColors.gd ├── ConsoleCommand.gd ├── ConsoleCommandRef.gd ├── ConsoleDockings.gd ├── ConsoleFlags.gd ├── ConsoleThemes.gd ├── ConsoleUserRight.gd ├── DebugConsole.gd ├── DebugConsole.tscn ├── DefaultCommands.gd └── noto_sans_ui │ ├── LICENSE.txt │ ├── NotoSansUI-Bold.ttf │ ├── NotoSansUI-BoldItalic.ttf │ ├── NotoSansUI-Italic.ttf │ └── NotoSansUI-Regular.ttf ├── LICENSE ├── README.md └── showcase ├── console1.PNG ├── console1.PNG.import ├── console10.PNG ├── console10.PNG.import ├── console2.PNG ├── console2.PNG.import ├── console3.PNG ├── console3.PNG.import ├── console4.PNG ├── console4.PNG.import ├── console5.PNG ├── console5.PNG.import ├── console6.PNG ├── console6.PNG.import ├── console7.PNG ├── console7.PNG.import ├── console8.PNG ├── console8.PNG.import ├── console9.PNG ├── console9.PNG.import ├── consoleFront.PNG └── consoleFront.PNG.import /.gitignore: -------------------------------------------------------------------------------- 1 | *.png.import 2 | test.gd 3 | test.tscn 4 | project.godot 5 | logs/ 6 | default_env.tres -------------------------------------------------------------------------------- /.import/console1.PNG-e7e8cd4987cb591a558e4f25e568f40e.md5: -------------------------------------------------------------------------------- 1 | source_md5="d69fd6bed190e48789075bc735a9378d" 2 | dest_md5="e6b9559d8daed3cd173632214d67fe88" 3 | 4 | -------------------------------------------------------------------------------- /.import/console1.PNG-e7e8cd4987cb591a558e4f25e568f40e.stex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/.import/console1.PNG-e7e8cd4987cb591a558e4f25e568f40e.stex -------------------------------------------------------------------------------- /.import/console10.PNG-0ad8aab84abd045649ac69803f044fc2.md5: -------------------------------------------------------------------------------- 1 | source_md5="51e08365328b1136120d409d37d3ade7" 2 | dest_md5="c75496b6c9e9d7dcc234bf05ee9b0105" 3 | 4 | -------------------------------------------------------------------------------- /.import/console10.PNG-0ad8aab84abd045649ac69803f044fc2.stex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/.import/console10.PNG-0ad8aab84abd045649ac69803f044fc2.stex -------------------------------------------------------------------------------- /.import/console2.PNG-344fbe5c1a5722c6af4cec6908abd0d9.md5: -------------------------------------------------------------------------------- 1 | source_md5="4c0134200bac878896a8f97f0577e1cf" 2 | dest_md5="fcc3f90c2caab554a0184ca4af0ebdc1" 3 | 4 | -------------------------------------------------------------------------------- /.import/console2.PNG-344fbe5c1a5722c6af4cec6908abd0d9.stex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/.import/console2.PNG-344fbe5c1a5722c6af4cec6908abd0d9.stex -------------------------------------------------------------------------------- /.import/console3.PNG-a38974fc05cc89cba31c29e1f5bc824e.md5: -------------------------------------------------------------------------------- 1 | source_md5="a00e7a8f2e42e52e7de7533225eeb6f6" 2 | dest_md5="59ddec0686e543570bcbad53e425f71d" 3 | 4 | -------------------------------------------------------------------------------- /.import/console3.PNG-a38974fc05cc89cba31c29e1f5bc824e.stex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/.import/console3.PNG-a38974fc05cc89cba31c29e1f5bc824e.stex -------------------------------------------------------------------------------- /.import/console4.PNG-957c7e94debc61afaa469f6a86668667.md5: -------------------------------------------------------------------------------- 1 | source_md5="4c150c131a080733556a1a3e5e7a3ce8" 2 | dest_md5="baa73a6ee41d81491ec116b9558259c4" 3 | 4 | -------------------------------------------------------------------------------- /.import/console4.PNG-957c7e94debc61afaa469f6a86668667.stex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/.import/console4.PNG-957c7e94debc61afaa469f6a86668667.stex -------------------------------------------------------------------------------- /.import/console5.PNG-9db6909488434f088b55aa9becdd61b2.md5: -------------------------------------------------------------------------------- 1 | source_md5="c70385ec2b295ef6740c62381609ecc2" 2 | dest_md5="32644e7fad66459dff839db5365061c8" 3 | 4 | -------------------------------------------------------------------------------- /.import/console5.PNG-9db6909488434f088b55aa9becdd61b2.stex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/.import/console5.PNG-9db6909488434f088b55aa9becdd61b2.stex -------------------------------------------------------------------------------- /.import/console6.PNG-4d47c1c49903b78cdcc9471674258d5f.md5: -------------------------------------------------------------------------------- 1 | source_md5="7eb363274c32bb7f11a995d2248554cd" 2 | dest_md5="a2b6937d21f5d9366641af9ee9273f9b" 3 | 4 | -------------------------------------------------------------------------------- /.import/console6.PNG-4d47c1c49903b78cdcc9471674258d5f.stex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/.import/console6.PNG-4d47c1c49903b78cdcc9471674258d5f.stex -------------------------------------------------------------------------------- /.import/console7.PNG-d639c38362085a7d5e9bc90121584031.md5: -------------------------------------------------------------------------------- 1 | source_md5="642c693ebedd313d1ae63f337caf55b7" 2 | dest_md5="3ef48671f126e59b5fd3a29218cea67b" 3 | 4 | -------------------------------------------------------------------------------- /.import/console7.PNG-d639c38362085a7d5e9bc90121584031.stex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/.import/console7.PNG-d639c38362085a7d5e9bc90121584031.stex -------------------------------------------------------------------------------- /.import/console8.PNG-1eb3ad0080bd713744ad7a6f7104b202.md5: -------------------------------------------------------------------------------- 1 | source_md5="8a6c3a51c679de4a5f6558ebbfe5dce7" 2 | dest_md5="735c4d3881e326a261af915758264169" 3 | 4 | -------------------------------------------------------------------------------- /.import/console8.PNG-1eb3ad0080bd713744ad7a6f7104b202.stex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/.import/console8.PNG-1eb3ad0080bd713744ad7a6f7104b202.stex -------------------------------------------------------------------------------- /.import/console9.PNG-feea482cf6ce1ca77144f7e713a81220.md5: -------------------------------------------------------------------------------- 1 | source_md5="2b3ed2b987a8238885f44208cb097cfb" 2 | dest_md5="f35e6b25ac980659cbc062d1a52cde80" 3 | 4 | -------------------------------------------------------------------------------- /.import/console9.PNG-feea482cf6ce1ca77144f7e713a81220.stex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/.import/console9.PNG-feea482cf6ce1ca77144f7e713a81220.stex -------------------------------------------------------------------------------- /.import/consoleFront.PNG-1538835cc3523dce36786caef6f4dcbb.md5: -------------------------------------------------------------------------------- 1 | source_md5="987a04defaa1bebf88e56cc3ff091509" 2 | dest_md5="bc6e6cb4cf9414dea30e6535c10fc7ae" 3 | 4 | -------------------------------------------------------------------------------- /.import/consoleFront.PNG-1538835cc3523dce36786caef6f4dcbb.stex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/.import/consoleFront.PNG-1538835cc3523dce36786caef6f4dcbb.stex -------------------------------------------------------------------------------- /.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5: -------------------------------------------------------------------------------- 1 | source_md5="8dd9ff1eebf38898a54579d8c01b0a88" 2 | dest_md5="da70afec3c66d4e872db67f808e12edb" 3 | 4 | -------------------------------------------------------------------------------- /Console/Console.gd: -------------------------------------------------------------------------------- 1 | extends Control 2 | class_name Console 3 | tool 4 | 5 | # SIGNALS 6 | 7 | signal on_message_sent(msg) 8 | signal on_command_sent(msg) 9 | 10 | 11 | # CONSTS 12 | 13 | # only shown in editor 14 | const previewLineMessage := "%senter text here..." 15 | const previewConsoleText := "%s%sman help" 16 | 17 | # Keys 18 | const nextMessageKey := "ui_down" 19 | const previousMessageKey := "ui_up" 20 | const autoCompleteKey := "ui_focus_next" 21 | const toggleConsoleKey := KEY_QUOTELEFT 22 | 23 | # makrso for predefined messages 24 | const COMMAND_NOT_FOUND_MSG := "[color=red]Command not found![/color]" 25 | const WARN_MSG := "[color=yellow]%s[/color]" 26 | const WARN_MSG_PREFIX := " [WARNING] " 27 | const ERROR_MSG := "[color=red]%s[/color]" 28 | const ERROR_MSG_PREFIX := " [ERROR] " 29 | const SUCCESSFUL_MSG := "[color=green]%s[/color]" 30 | const SUCCESSFUL_MSG_PREFIX := " [SUCCESS] " 31 | 32 | 33 | # EXPORT VARS 34 | 35 | export(String) var userName = "" setget update_user_name 36 | export(ConsoleUserRight.Type) var userRight = ConsoleUserRight.Type.DEV 37 | export(ConsoleColor.Type) var consoleUserNameColor setget update_console_user_name_color 38 | 39 | export(ConsoleTheme.Type) var design setget update_design 40 | export(Dockings.Type) var dockingStation = Dockings.Type.TOP setget update_docking_station 41 | export(ConsoleColor.Type) var textColor = ConsoleColor.Type.WHITE setget update_text_color 42 | 43 | # CHANNELS 44 | export(Array, String) var channelNames = ["All"] 45 | 46 | # OTHER VISIUALS 47 | export(bool) var hideScrollBar = false setget update_show_scroll_bar 48 | export(bool) var roundedTitleBarEdges = true setget update_rounded_title_bar 49 | 50 | # SHOW/HIDE 51 | export(bool) var showTitleBar = true setget update_show_title_bar 52 | export(bool) var showTextBackground = true setget update_show_text_background 53 | export(bool) var showConsoleBackground = true setget update_show_console_background 54 | export(bool) var showLineBackground = false setget update_show_line_background 55 | export(bool) var showSendButton = true setget update_show_send_button 56 | export(bool) var showChannelButton = true setget update_show_channel_button 57 | 58 | # COLORS 59 | export(Color) var titleBarBackgroundColor setget update_title_bar_color 60 | export(Color) var backgroundColor setget update_background_color 61 | export(Color) var textBackgroundColor setget update_text_background_color 62 | export(Color) var lineBackgroundColor setget update_line_background_color 63 | export(Color) var sendButtonColor setget update_send_button_color 64 | export(Color) var sendButtonTextColor setget update_send_button_text_color 65 | 66 | # MISC 67 | export(bool) var allowWindowDrag = true 68 | export(String, "default") var slideInAnimation = "default" 69 | 70 | # SIGNS and other text related things 71 | export(bool) var showTimeStamp = false setget update_show_time_stamp 72 | export(String) var userMsgSign = ">" setget update_user_message_sign 73 | export(String) var commandSign = "/" setget update_user_command_sign 74 | export(bool) var sendUserName = false setget update_send_user_name 75 | 76 | # LOG 77 | export(bool) var logEnabled = false 78 | export(float) var logInterval = 300.0 setget update_log_time_interval 79 | 80 | 81 | 82 | # ONREADY VARS 83 | 84 | onready var consoleLine := $Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/Input/Line 85 | onready var consoleText := $Control/VBoxContainer/ConsoleContainer/ConsoleText/RichTextLabel 86 | 87 | # for background colors 88 | #onready var background := $Control/VBoxContainer/ConsoleContainer/ConsoleBackground 89 | #onready var TitleBarBackground := $Control/VBoxContainer/TitleBar/TitleBarBackground 90 | #onready var textBackground := $Control/VBoxContainer/ConsoleContainer/ConsoleText/TextBackground 91 | #onready var lineBackground := $Control/VBoxContainer/ConsoleContainer/InputLine/LineBackground 92 | #onready var buttonBackground := $Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField/ButtonBackground 93 | 94 | #onready var sendButton := $Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField/SendText 95 | #onready var hideConsoleButton := $Control/VBoxContainer/TitleBar/VBoxContainer/HideConsole 96 | onready var channelsButton := $Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ChannelSelector/Channels 97 | 98 | onready var logTimer = $LogTimer 99 | 100 | 101 | # VARS 102 | 103 | var completeText := "" 104 | 105 | var channelTexts := [] 106 | 107 | var allChannel : ConsoleChannel 108 | var selectedChannel : ConsoleChannel 109 | 110 | var channelChanged := false 111 | 112 | var messageIndex := 0 113 | var enteredMessages := [] 114 | var consoleTextColor : Color 115 | var prefix := "" 116 | var postfix := "" 117 | 118 | var commands := [] 119 | var basicCommandsAmount := 0 120 | 121 | var userNameColor : Color 122 | 123 | var startWindowDragPos : Vector2 124 | var dragging : bool 125 | var defaultConsoleSize := Vector2(550.0, 275.0) 126 | 127 | var logFile := File.new() 128 | var logFileCreated := false 129 | var logFileName := "log.txt" 130 | var logFilePath := "" 131 | var logType := "" # e.g. [ERROR]/[WARNING]/[SUCCESS] 132 | 133 | var showPreview = true 134 | 135 | 136 | 137 | func _ready(): 138 | showPreview = false 139 | 140 | consoleText.bbcode_text = "" 141 | 142 | consoleLine.placeholder_text = userMsgSign 143 | consoleLine.text = "" 144 | 145 | add_basic_commands() 146 | basicCommandsAmount = commands.size() 147 | 148 | for i in channelsButton.get_item_count(): 149 | remove_channel(channelsButton.get_item_text(0)) 150 | 151 | allChannel = add_channel("All") 152 | selectedChannel = allChannel 153 | 154 | for channelName in channelNames: 155 | if channelName != "All": 156 | var _c = add_channel(channelName) 157 | 158 | if logEnabled: 159 | update_log_time_interval(logInterval) 160 | create_log_file() 161 | logTimer.start() 162 | 163 | 164 | func add_channel(channelName : String) -> ConsoleChannel: 165 | channelsButton.add_item(channelName) 166 | var newChannel = ConsoleChannel.new(channelName) 167 | channelTexts.append(newChannel) 168 | return newChannel 169 | 170 | 171 | func remove_channel(channelName : String): 172 | channelTexts.erase(channelName) 173 | for _idx in range(channelsButton.get_item_count()): 174 | if channelsButton.get_item_text(0) == channelName: 175 | channelsButton.remove_item(0) 176 | 177 | 178 | func get_channels() -> Array: 179 | return channelTexts 180 | 181 | 182 | func _notification(what): 183 | if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST: 184 | if logEnabled: 185 | _on_LogTimer_timeout() 186 | 187 | 188 | func add_basic_commands(): 189 | var defArgs = ConsoleDefaultCommands.new() 190 | defArgs.set_default_commands(self) 191 | add_child(defArgs) 192 | 193 | 194 | func toggle_visibility(): 195 | visible = ! visible 196 | 197 | 198 | func toggle_console(): 199 | if slideInAnimation == "default": 200 | slideInAnimation = "" 201 | if visible: 202 | $Animation.play("slide_out%s" % slideInAnimation) 203 | else: 204 | $Animation.play("slide_in%s" % slideInAnimation) 205 | 206 | 207 | func apply_flags(flags): 208 | postfix = "" 209 | prefix = "" 210 | 211 | if (flags & ConsoleFlags.Type.BOLD) == ConsoleFlags.Type.BOLD: 212 | prefix += "[b]" 213 | postfix = postfix.insert(0, "[/b]") 214 | if (flags & ConsoleFlags.Type.ITALICS) == ConsoleFlags.Type.ITALICS: 215 | prefix += "[i]" 216 | postfix = postfix.insert(0, "[/i]") 217 | if (flags & ConsoleFlags.Type.UNDERLINE) == ConsoleFlags.Type.UNDERLINE: 218 | prefix += "[u]" 219 | postfix = postfix.insert(0, "[/u]") 220 | if (flags & ConsoleFlags.Type.CODE) == ConsoleFlags.Type.CODE: 221 | prefix += "[code]" 222 | postfix = postfix.insert(0, "[/code]") 223 | if (flags & ConsoleFlags.Type.CENTER) == ConsoleFlags.Type.CENTER: 224 | prefix += "[center]" 225 | postfix = postfix.insert(0, "[/center]") 226 | if (flags & ConsoleFlags.Type.RIGHT) == ConsoleFlags.Type.RIGHT: 227 | prefix += "[right]" 228 | postfix = postfix.insert(0, "[/right]") 229 | if (flags & ConsoleFlags.Type.FILL) == ConsoleFlags.Type.FILL: 230 | prefix += "[fill]" 231 | postfix = postfix.insert(0, "[/fill]") 232 | if (flags & ConsoleFlags.Type.INDENT) == ConsoleFlags.Type.INDENT: 233 | prefix += "[indent]" 234 | postfix = postfix.insert(0, "[/indent]") 235 | if (flags & ConsoleFlags.Type.URL) == ConsoleFlags.Type.URL: 236 | prefix += "[url]" 237 | postfix = postfix.insert(0, "[/url]") 238 | 239 | 240 | func success(msg, flags = 0, channel = selectedChannel): 241 | write_line(SUCCESSFUL_MSG % msg, flags, channel) 242 | 243 | 244 | func warn(msg, flags = 0, channel = selectedChannel): 245 | write_line(WARN_MSG % msg, flags, channel) 246 | 247 | 248 | func error(msg, flags = 0, channel = selectedChannel): 249 | write_line(ERROR_MSG % msg, flags, channel) 250 | 251 | 252 | func write_line(msg, flags = 0, channel = selectedChannel): 253 | if !msg.empty(): 254 | write(msg, flags, channel) 255 | 256 | write("\n", 0, channel) 257 | 258 | 259 | func clear_selected_channel_text(): 260 | selectedChannel.text = "" 261 | consoleText.bbcode_text = "" 262 | 263 | 264 | func _clear_channel_cache(channel : ConsoleChannel): 265 | channel.lastMessage = "" 266 | 267 | 268 | func write(msg, flags = 0, channel = selectedChannel): 269 | if msg.empty(): 270 | return 271 | apply_flags(flags) 272 | 273 | if !flags & ConsoleFlags.Type.NO_DRAW: 274 | if !channel.lastMessage.empty(): 275 | channel.lastMessage = "" 276 | allChannel.lastMessage = "" 277 | 278 | if flags & ConsoleFlags.Type.SHOW_TIME: 279 | _write_to_selected_channel(channel, get_time_stamp(false)) 280 | 281 | if flags & ConsoleFlags.Type.USER_PREFIX: 282 | _write_to_selected_channel(channel, \ 283 | str(userMsgSign, " ", color_to_bb_code(userName, userNameColor), ": ")) 284 | 285 | if prefix.length() > 0: 286 | _write_to_selected_channel(channel, prefix) 287 | 288 | if flags & ConsoleFlags.Type.TRACK_MESSAGE: 289 | enteredMessages.append(msg) 290 | messageIndex = -1 291 | 292 | _write_to_selected_channel(channel, msg) 293 | 294 | if postfix.length() > 0: 295 | _write_to_selected_channel(channel, postfix) 296 | 297 | # if the channel changed, then change all text 298 | _apply_channel_text(channel) 299 | 300 | if flags & ConsoleFlags.Type.CLICKABLE: 301 | consoleText.push_meta(msg) 302 | 303 | if msg[0] == commandSign and !flags & ConsoleFlags.Type.NO_COMMANDS: # check if the input is a command 304 | execute_command(msg) 305 | 306 | if logEnabled: 307 | if flags & ConsoleFlags.Type.USER_PREFIX and sendUserName: 308 | msg = str(userMsgSign, " ", color_to_bb_code(userName, userNameColor), ": ") + msg 309 | add_to_log(msg) 310 | 311 | 312 | emit_signal("on_message_sent", msg) 313 | 314 | 315 | func _write_to_selected_channel(channel : ConsoleChannel, text : String): 316 | if channel != allChannel: 317 | channel.lastMessage += text 318 | allChannel.lastMessage += text 319 | 320 | 321 | func _apply_channel_text(channel : ConsoleChannel): 322 | if channelChanged: 323 | channelChanged = false 324 | consoleText.bbcode_text = channel.text 325 | else: 326 | if channel != allChannel: 327 | channel.text += channel.lastMessage 328 | allChannel.text += channel.lastMessage 329 | 330 | if selectedChannel == channel or selectedChannel == allChannel: 331 | consoleText.bbcode_text += channel.lastMessage 332 | channel.lastMessage = "" 333 | 334 | 335 | func _apply_selected_channel_text(): 336 | _apply_channel_text(selectedChannel) 337 | 338 | 339 | func get_last_message() -> String: 340 | return enteredMessages.back() 341 | 342 | 343 | func get_command(command : String) -> ConsoleCommand: 344 | var cmdName = command.split(" ", false)[0] 345 | 346 | for com in commands: 347 | if com.get_invoke_name() == cmdName: 348 | return com 349 | return null # if not found 350 | 351 | 352 | func extract_arguments(msg : String) -> Array: 353 | var args = msg.split(" ", false) 354 | args.remove(0) 355 | return args 356 | 357 | 358 | func print_args(commandIndex : int): 359 | var selectedCommand : ConsoleCommand = commands[commandIndex] 360 | 361 | if selectedCommand.get_expected_args().size() == 0: 362 | write("0") 363 | 364 | elif CommandRef.VARIANT in selectedCommand.get_expected_args(): 365 | write("unspecified amount") 366 | elif CommandRef.ALIAS in selectedCommand.get_expected_args(): 367 | write("aliased amount") 368 | 369 | elif selectedCommand.get_expected_args().size() > 0: 370 | for argNum in selectedCommand.get_expected_args(): 371 | write(str(argNum)) 372 | if selectedCommand.get_expected_args().size() > 2 and \ 373 | argNum == selectedCommand.get_expected_args()[selectedCommand.get_expected_args().size() - 2]: 374 | write(" or %s" % selectedCommand.get_expected_args().back()) 375 | break 376 | else: 377 | if selectedCommand.get_expected_args().size() > 1: 378 | write(", ") 379 | 380 | 381 | func copy_command(command : ConsoleCommand) -> ConsoleCommand: 382 | var newCommand = ConsoleCommand.new(\ 383 | command.get_invoke_name(), command.get_ref(),\ 384 | command.get_description(), command.get_default_args(), command.get_call_rights()) 385 | return newCommand 386 | 387 | 388 | func get_channel(channelName : String) -> ConsoleChannel: 389 | for channel in channelTexts: 390 | if channel.channelName == channelName: 391 | return channel 392 | return null 393 | 394 | 395 | func write_line_channel(channelName : String, text : String, flags = 0): 396 | write_channel(channelName, text + "\n", flags) 397 | 398 | 399 | func write_channel(channelName : String, text : String, flags = 0): 400 | var channel = get_channel(channelName) 401 | if !channel: 402 | var _c = add_channel(channelName) 403 | write(text, flags, channel) 404 | 405 | 406 | func _write_to_channel(channel : ConsoleChannel, text : String): 407 | channel.lastMessage += text 408 | 409 | 410 | func get_channel_text(channelName : String): 411 | for channel in channelTexts: 412 | if channel.channelName == channelName: 413 | return channel.text 414 | return "" 415 | 416 | 417 | func execute_command(message : String): 418 | var currentCommand = message 419 | currentCommand = currentCommand.trim_prefix(commandSign) # remove command sign 420 | # return the command and the whole message 421 | var cmd : ConsoleCommand = get_command(currentCommand) 422 | if cmd == null: 423 | write_line("") 424 | write(COMMAND_NOT_FOUND_MSG) 425 | return 426 | 427 | var found = false 428 | for i in range(commands.size()): 429 | if commands[i].get_invoke_name() == cmd.get_invoke_name(): # found command 430 | found = true 431 | if not cmd.are_rights_sufficient(userRight): 432 | write("Not sufficient rights as %s." % ConsoleUserRight.TypeDict[userRight]) 433 | break 434 | 435 | var args = extract_arguments(currentCommand) 436 | 437 | if not args.size() in cmd.get_ref().get_expected_arguments() and \ 438 | not CommandRef.VARIANT in cmd.get_ref().get_expected_arguments() and \ 439 | not CommandRef.ALIAS in cmd.get_ref().get_expected_arguments(): 440 | write_line("") 441 | write("expected: ") 442 | print_args(i) 443 | write(" arguments!") 444 | break 445 | 446 | found = true 447 | cmd.apply(args) 448 | emit_signal("on_command_sent", cmd, currentCommand) 449 | break 450 | 451 | if not found: 452 | write_line("") 453 | write(COMMAND_NOT_FOUND_MSG) 454 | 455 | 456 | func send_line_input(): 457 | var flags = ConsoleFlags.Type.USER_PREFIX * int(sendUserName) | \ 458 | ConsoleFlags.Type.TRACK_MESSAGE 459 | 460 | if showTimeStamp: 461 | flags |= ConsoleFlags.Type.SHOW_TIME 462 | 463 | write_line(consoleLine.text, flags) 464 | consoleLine.text = "" 465 | 466 | 467 | func _input(event): 468 | if event is InputEventKey: 469 | if event.is_pressed() and not event.is_echo(): 470 | if event.scancode == toggleConsoleKey: 471 | toggle_console() 472 | if event.scancode == KEY_ENTER: 473 | if not consoleLine.text.empty(): 474 | _on_Line_text_entered($Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/Input/Line.text) 475 | elif event.scancode == KEY_ESCAPE: 476 | consoleLine.text = "" 477 | elif event.scancode == KEY_LEFT and Input.is_key_pressed(KEY_CONTROL) and \ 478 | consoleLine.get_cursor_position() == 0: 479 | consoleLine.set_cursor_position(consoleLine.text.length()) 480 | if event.is_action_pressed(previousMessageKey): 481 | if enteredMessages.empty(): 482 | return 483 | messageIndex -= 1 484 | if messageIndex < 0: 485 | messageIndex = enteredMessages.size() - 1 486 | elif messageIndex > enteredMessages.size() - 1: 487 | messageIndex = 0 488 | consoleLine.text = enteredMessages[messageIndex] 489 | consoleLine.grab_focus() 490 | consoleLine.set_cursor_position(consoleLine.text.length()) 491 | 492 | elif event.is_action_pressed(nextMessageKey): 493 | if enteredMessages.empty(): 494 | return 495 | messageIndex += 1 496 | if messageIndex < 0: 497 | messageIndex = 0 498 | elif messageIndex > enteredMessages.size() - 1: 499 | messageIndex = 0 500 | consoleLine.text = enteredMessages[messageIndex] 501 | 502 | if event.is_action_pressed(autoCompleteKey): 503 | if consoleLine.text.length() > 1: 504 | var closests = get_closest_commands(consoleLine.text) 505 | if closests != null: 506 | if closests.size() == 1: 507 | consoleLine.text = commandSign + closests[0] 508 | consoleLine.set_cursor_position(consoleLine.text.length()) 509 | elif closests.size() > 1: 510 | var tempLine = consoleLine.text 511 | write_line("possible commands:") 512 | consoleText.newline() 513 | 514 | for c in closests: 515 | consoleText.newline() 516 | write_line(commandSign + c, ConsoleFlags.Type.CLICKABLE | ConsoleFlags.Type.NO_COMMANDS) 517 | 518 | #send_message_without_event("Press [Up] or [Down] to cycle through available commands.", false) 519 | consoleLine.text = tempLine 520 | consoleLine.set_cursor_position(consoleLine.text.length()) 521 | 522 | 523 | func add_command(command : ConsoleCommand): 524 | commands.append(command) 525 | 526 | 527 | func get_closest_commands(command : String) -> Array: 528 | if command.empty() or command[0] != commandSign: 529 | return [] 530 | 531 | var results = [] 532 | var cmdName : String = command.split(" ", false)[0] 533 | cmdName = cmdName.trim_prefix(commandSign) 534 | 535 | for com in commands: 536 | if com.get_invoke_name().length() < cmdName.length(): 537 | continue 538 | var addToResults = true 539 | for i in range(cmdName.length()): 540 | if not cmdName[i].to_lower() == com.get_invoke_name()[i].to_lower(): 541 | addToResults = false 542 | break 543 | 544 | if addToResults: 545 | results.append(com.get_invoke_name()) 546 | 547 | return results 548 | 549 | 550 | 551 | ### LOGGING 552 | 553 | 554 | func add_to_log(msg : String): 555 | if not logFileCreated: 556 | return 557 | completeText += get_time_stamp() + logType + msg + "\n" 558 | logType = "" 559 | 560 | 561 | func create_log_file(): 562 | var dir := Directory.new() 563 | var resPath = str(get_script().resource_path) 564 | logFilePath = resPath.substr(0, resPath.find_last("/") + 1) + "logs" 565 | if dir.make_dir(logFilePath) != OK: 566 | printerr("Couldn't create folder for console logs!") 567 | 568 | logFilePath += "/" 569 | 570 | logFile = File.new() 571 | if logFile.open(logFilePath + logFileName, logFile.WRITE_READ) != OK: 572 | write_line("[color=red]Couldn't create File![/color]") 573 | logFileCreated = true 574 | logFile.close() 575 | 576 | 577 | func append_log_to_file(fileName : String = ""): 578 | if not logEnabled: 579 | return 580 | 581 | if not fileName == "": 582 | logFileName = fileName 583 | 584 | if logFile.open(logFilePath + logFileName, logFile.READ_WRITE) != OK: 585 | write_line("[color=red]Couldn't open log file![/color]") 586 | logFile.seek_end() 587 | logFile.store_string(completeText) 588 | logFile.close() 589 | completeText = "" 590 | 591 | 592 | func enable_log(): 593 | logEnabled = true 594 | 595 | 596 | func disable_log(): 597 | logEnabled = false 598 | 599 | 600 | 601 | ### EXPORT METHODS 602 | 603 | func update_console_text_preview(): 604 | if !showPreview: 605 | return 606 | if _check_for_tool("Control/VBoxContainer/ConsoleContainer/ConsoleText/RichTextLabel"): 607 | 608 | var nameText := "" 609 | if showTimeStamp: 610 | nameText += get_time_stamp(false) 611 | if sendUserName: 612 | nameText = str(userMsgSign, " ", color_to_bb_code(userName, userNameColor), ":") 613 | else: 614 | nameText = "" 615 | $Control/VBoxContainer/ConsoleContainer/ConsoleText/RichTextLabel.bbcode_text = \ 616 | color_to_bb_code(previewConsoleText % [ \ 617 | nameText, \ 618 | str(" ", commandSign)], consoleTextColor) 619 | 620 | 621 | func update_console_line_preview(): 622 | if !showPreview: 623 | return 624 | if _check_for_tool("Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/Input/Line"): 625 | $Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/Input/Line.text = \ 626 | previewLineMessage % str(userMsgSign, " ") 627 | 628 | 629 | func update_user_name(newName : String): 630 | userName = newName 631 | update_console_text_preview() 632 | 633 | 634 | func update_user_message_sign(newSign : String): 635 | userMsgSign = newSign 636 | update_console_line_preview() 637 | 638 | 639 | func update_design(type): 640 | design = type 641 | var designDict = ConsoleTheme.TypeDict[type] 642 | 643 | if designDict.dockingStation != Dockings.Type.CUSTOM: 644 | update_docking_station(designDict.dockingStation) 645 | 646 | update_rounded_title_bar(designDict.roundedTitleBar) 647 | 648 | update_show_send_button(designDict.showSendButton) 649 | update_show_line_background(designDict.showLineBackground) 650 | update_show_text_background(designDict.showTextBackground) 651 | update_show_title_bar(designDict.showTitleBar) 652 | 653 | update_send_button_text_color(designDict.sendButtonTextColor) 654 | update_background_color(designDict.backgroundColor) 655 | update_send_button_color(designDict.sendButtonColor) 656 | update_title_bar_color(designDict.titleBarColor) 657 | update_line_background_color(designDict.lineEditColor) 658 | update_text_color(designDict.textColor) 659 | 660 | slideInAnimation = designDict.animation 661 | hideScrollBar = designDict.hideScrollBar 662 | 663 | property_list_changed_notify() 664 | 665 | 666 | func update_text_color(colorType): 667 | if typeof(colorType) == TYPE_COLOR: 668 | consoleTextColor = colorType 669 | else: 670 | textColor = colorType 671 | consoleTextColor = ConsoleColor.TypeDict[colorType] 672 | update_console_line_preview() 673 | update_console_text_preview() 674 | 675 | 676 | func update_show_scroll_bar(showScroll : bool): 677 | hideScrollBar = showScroll 678 | if _check_for_tool("Control/VBoxContainer/ConsoleContainer/ConsoleText/RichTextLabel"): 679 | $Control/VBoxContainer/ConsoleContainer/ConsoleText/RichTextLabel.scroll_active = !hideScrollBar 680 | 681 | 682 | func update_user_command_sign(newSign : String): 683 | commandSign = newSign 684 | update_console_text_preview() 685 | 686 | 687 | func update_send_user_name(send : bool): 688 | sendUserName = send 689 | update_console_text_preview() 690 | 691 | 692 | func update_console_user_name_color(colorType): 693 | if typeof(colorType) == TYPE_COLOR: 694 | userNameColor = colorType 695 | else: 696 | consoleUserNameColor = colorType 697 | userNameColor = ConsoleColor.TypeDict[colorType] 698 | update_console_text_preview() 699 | 700 | 701 | func update_show_console_background(showBg : bool): 702 | showConsoleBackground = showBg 703 | if _check_for_tool("Control/VBoxContainer/ConsoleContainer/ConsoleBackground"): 704 | $Control/VBoxContainer/ConsoleContainer/ConsoleBackground.visible = showBg 705 | 706 | 707 | func update_show_title_bar(showBar : bool): 708 | showTitleBar = showBar 709 | if _check_for_tool("Control/VBoxContainer/TitleBar"): 710 | $Control/VBoxContainer/TitleBar.visible = showBar 711 | 712 | 713 | func update_show_send_button(showButton : bool): 714 | showSendButton = showButton 715 | if _check_for_tool("Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField/SendText") and \ 716 | _check_for_tool("Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField"): 717 | $Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField.visible = showSendButton 718 | $Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField/SendText.visible = showSendButton 719 | 720 | 721 | func update_show_channel_button(show : bool): 722 | showChannelButton = show 723 | if _check_for_tool("Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ChannelSelector"): 724 | $Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ChannelSelector.visible = show 725 | 726 | 727 | func update_send_button_color(color : Color): 728 | sendButtonColor = color 729 | if _check_for_tool("Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField/SendText"): 730 | var btn = $Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField/SendText 731 | btn.get("custom_styles/normal").bg_color = color 732 | 733 | 734 | func update_send_button_text_color(color : Color): 735 | sendButtonTextColor = color 736 | if _check_for_tool("Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField/SendText"): 737 | var btn = $Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField/SendText 738 | btn.set("custom_colors/font_color", color) 739 | 740 | 741 | func update_rounded_title_bar(rounded : bool): 742 | roundedTitleBarEdges = rounded 743 | if _check_for_tool("Control/VBoxContainer/TitleBar/TitleBarBackground"): 744 | var tileBackground = $Control/VBoxContainer/TitleBar/TitleBarBackground 745 | 746 | if tileBackground.get("custom_styles/panel") == null: 747 | return 748 | 749 | var panel = tileBackground.get("custom_styles/panel") 750 | 751 | if rounded: 752 | panel.set("corner_radius_top_left", 7) 753 | panel.set("corner_radius_top_right", 7) 754 | # newStyle.set("corner_radius_top_left", 7) 755 | # newStyle.set("corner_radius_top_right", 7) 756 | if not rounded: 757 | panel.set("corner_radius_top_left", 0) 758 | panel.set("corner_radius_top_right", 0) 759 | 760 | 761 | func update_title_bar_color(color : Color): 762 | titleBarBackgroundColor = color 763 | if _check_for_tool("Control/VBoxContainer/TitleBar/TitleBarBackground"): 764 | var tileBackground = $Control/VBoxContainer/TitleBar/TitleBarBackground 765 | 766 | if tileBackground.get("custom_styles/panel") == null: 767 | return 768 | 769 | tileBackground.get("custom_styles/panel").bg_color = titleBarBackgroundColor 770 | 771 | 772 | func update_show_text_background(showBg : bool): 773 | showTextBackground = showBg 774 | if _check_for_tool("Control/VBoxContainer/ConsoleContainer/ConsoleText/TextBackground"): 775 | $Control/VBoxContainer/ConsoleContainer/ConsoleText/TextBackground.visible = showBg 776 | 777 | 778 | func set_console_size(width : float, height : float): 779 | rect_size = Vector2(width, height) 780 | 781 | 782 | func update_text_background_color(color : Color): 783 | textBackgroundColor = color 784 | if _check_for_tool("Control/VBoxContainer/ConsoleContainer/ConsoleText/TextBackground") and \ 785 | _check_for_tool("Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField/ButtonBackground") and \ 786 | _check_for_tool("Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ChannelSelector/Channels"): 787 | $Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField/ButtonBackground.color = color 788 | $Control/VBoxContainer/ConsoleContainer/ConsoleText/TextBackground.color = color 789 | $Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ChannelSelector/Channels.get("custom_styles/normal").bg_color = color 790 | 791 | 792 | func update_background_color(color : Color): 793 | backgroundColor = color 794 | if _check_for_tool("Control/VBoxContainer/ConsoleContainer/ConsoleBackground"): 795 | $Control/VBoxContainer/ConsoleContainer/ConsoleBackground.color = color 796 | 797 | 798 | func update_show_line_background(showBackground : bool): 799 | showLineBackground = showBackground 800 | if _check_for_tool("Control/VBoxContainer/ConsoleContainer/InputLine/LineBackground"): 801 | $Control/VBoxContainer/ConsoleContainer/InputLine/LineBackground.visible = showLineBackground 802 | 803 | 804 | func update_line_background_color(color : Color): 805 | lineBackgroundColor = color 806 | if _check_for_tool("Control/VBoxContainer/ConsoleContainer/InputLine/LineBackground"): 807 | $Control/VBoxContainer/ConsoleContainer/InputLine/LineBackground.color = color 808 | 809 | 810 | func update_docking_station(newDocking): 811 | dockingStation = newDocking 812 | if !_check_for_tool("."): 813 | return 814 | if !is_inside_tree(): 815 | return 816 | 817 | var rectSize : Vector2 = get_viewport_rect().size 818 | 819 | match dockingStation: 820 | Dockings.Type.TOP: 821 | rect_position = Vector2(0.0, 0.0) 822 | rect_size.x = rectSize.x 823 | rect_size.y = defaultConsoleSize.y 824 | update_show_title_bar(false) 825 | Dockings.Type.BOTTOM: 826 | rect_position = Vector2(0.0, rectSize.y - defaultConsoleSize.y) 827 | rect_size.y = defaultConsoleSize.y 828 | rect_size.x = rectSize.x 829 | update_show_title_bar(false) 830 | Dockings.Type.LEFT: 831 | rect_position = Vector2(0.0, 0.0) 832 | rect_size.x = rectSize.x * 0.5 833 | rect_size.y = rectSize.y 834 | update_show_title_bar(false) 835 | Dockings.Type.RIGHT: 836 | rect_position = Vector2(rectSize.x * 0.5, 0.0) 837 | rect_size.x = rectSize.x * 0.5 838 | rect_size.y = rectSize.y 839 | update_show_title_bar(false) 840 | Dockings.Type.FULL_SCREEN: 841 | rect_position = Vector2(0.0, 0.0) 842 | rect_size = rectSize 843 | update_show_title_bar(false) 844 | Dockings.Type.CUSTOM: 845 | rect_size = defaultConsoleSize 846 | _: 847 | printerr("Docking station not found: ", dockingStation) 848 | 849 | property_list_changed_notify() # in order to update the "Script Variables" (Properties) 850 | 851 | 852 | func update_show_time_stamp(showStamp : bool): 853 | showTimeStamp = showStamp 854 | update_console_text_preview() 855 | 856 | 857 | func update_log_time_interval(newInterval : float): 858 | logInterval = newInterval 859 | if _check_for_tool("LogTimer"): 860 | $LogTimer.wait_time = newInterval 861 | 862 | 863 | 864 | ### HELPER METHODS 865 | 866 | func color_to_bb_code(between : String, color : Color) -> String: 867 | var result := "" 868 | result = "[color=#%s]" % color.to_html() 869 | result = str(result, between, "[/color]") 870 | return result 871 | 872 | 873 | func _check_for_tool(node) -> bool: 874 | if has_node(node) and get_node(node) != null: 875 | return true 876 | return false 877 | 878 | 879 | func get_time_stamp(includeDate : bool = true, \ 880 | dateDelim : String = "[/]", timeDelim : String = "[:]") -> String: 881 | var stamp := "" 882 | 883 | if includeDate: 884 | var dateDict = OS.get_datetime() 885 | var day = dateDict.day 886 | var month = dateDict.month 887 | var year = dateDict.year 888 | var dateTime = dateDelim[0] + str(day) + dateDelim[1] + str(month) + dateDelim[1] + str(year) + dateDelim[2] 889 | 890 | stamp = str(stamp, dateTime, " ") 891 | 892 | var timeDict = OS.get_time() 893 | var hour = timeDict.hour 894 | var minute = timeDict.minute 895 | var seconds = timeDict.second 896 | var time = timeDelim[0] + str(hour) + timeDelim[1] + str(minute) + timeDelim[1] + str(seconds) + timeDelim[2] 897 | 898 | stamp = str(stamp, time, " ") 899 | 900 | return stamp 901 | 902 | 903 | 904 | ### Signals 905 | 906 | 907 | func _on_Line_text_entered(text): 908 | if !text.empty() and not (text.length() == 1 and text[0] == commandSign): 909 | send_line_input() 910 | 911 | 912 | func _on_Console_resized(): 913 | match dockingStation: 914 | Dockings.Type.CUSTOM: 915 | defaultConsoleSize = rect_size 916 | Dockings.Type.TOP: 917 | defaultConsoleSize.y = rect_size.y 918 | Dockings.Type.BOTTOM: 919 | defaultConsoleSize.y = rect_size.y 920 | _: 921 | pass 922 | 923 | if _check_for_tool("Control/VBoxContainer/ConsoleContainer/InputLine") and \ 924 | _check_for_tool("Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/Input/Line"): 925 | var lineContainer = $Control/VBoxContainer/ConsoleContainer/InputLine 926 | var line = $Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/Input/Line 927 | var cText = $Control/VBoxContainer/ConsoleContainer/ConsoleText 928 | 929 | cText.rect_size.y = cText.get_parent().rect_size.y - line.rect_size.y 930 | 931 | lineContainer.rect_position.y = \ 932 | lineContainer.get_parent().rect_size.y - line.rect_size.y 933 | lineContainer.rect_size.y = line.rect_size.y 934 | 935 | 936 | func _on_Line_text_changed(new_text : String): 937 | if new_text.length() > 0 and new_text[0] == commandSign: 938 | consoleLine.focus_next = consoleLine.get_path() 939 | else: 940 | consoleLine.focus_next = NodePath("") 941 | 942 | new_text = new_text.replace("%c" % toggleConsoleKey, "") 943 | var caretPos = consoleLine.caret_position 944 | consoleLine.set_text(new_text) 945 | consoleLine.caret_position = caretPos 946 | 947 | 948 | func _on_RichTextLabel_meta_clicked(meta): 949 | consoleLine.text = meta.substr(0, meta.length()) 950 | consoleLine.set_cursor_position(consoleLine.get_text().length()) 951 | consoleLine.grab_focus() 952 | 953 | 954 | func _on_TitleBar_gui_input(event): 955 | if allowWindowDrag: 956 | if event is InputEventMouseMotion: 957 | if dragging: 958 | rect_global_position = get_global_mouse_position() - startWindowDragPos 959 | if event is InputEventMouseButton and event.button_index == BUTTON_LEFT: 960 | if event.pressed and not event.is_echo(): 961 | startWindowDragPos = get_global_mouse_position() - rect_global_position 962 | dragging = true 963 | elif not event.pressed and not event.is_echo(): 964 | dragging = false 965 | rect_global_position = get_global_mouse_position() - startWindowDragPos 966 | 967 | 968 | func _on_LogTimer_timeout(): 969 | if not logEnabled: 970 | return 971 | if logFile.open(logFilePath + logFileName, logFile.WRITE_READ) != OK: 972 | return 973 | # logFile.seek_end() 974 | logFile.store_string(completeText) 975 | logFile.close() 976 | 977 | 978 | func _on_SendText_pressed(): 979 | _on_Line_text_entered(consoleLine.text) 980 | consoleLine.grab_focus() 981 | 982 | 983 | func _on_Channels_item_selected(id): 984 | for channel in channelTexts: 985 | if channel.channelName == channelsButton.get_item_text(id): 986 | if channel != selectedChannel: 987 | channelChanged = true 988 | selectedChannel = channel 989 | _apply_selected_channel_text() 990 | return 991 | 992 | 993 | func _on_HideConsole_pressed(): 994 | toggle_console() 995 | 996 | -------------------------------------------------------------------------------- /Console/Console.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=15 format=2] 2 | 3 | [ext_resource path="res://Console/Console.gd" type="Script" id=1] 4 | [ext_resource path="res://Console/noto_sans_ui/NotoSansUI-Regular.ttf" type="DynamicFontData" id=2] 5 | 6 | [sub_resource type="StyleBoxFlat" id=1] 7 | bg_color = Color( 0.3, 0.27, 0.27, 1 ) 8 | corner_radius_top_left = 7 9 | corner_radius_top_right = 7 10 | 11 | [sub_resource type="StyleBoxFlat" id=2] 12 | bg_color = Color( 0.6, 0.6, 0.6, 0.121569 ) 13 | border_color = Color( 1, 1, 1, 0.145098 ) 14 | 15 | [sub_resource type="StyleBoxFlat" id=3] 16 | bg_color = Color( 0.6, 0.6, 0.6, 0 ) 17 | 18 | [sub_resource type="StyleBoxFlat" id=4] 19 | bg_color = Color( 0.843137, 0.843137, 0.843137, 0.109804 ) 20 | 21 | [sub_resource type="StyleBoxFlat" id=5] 22 | bg_color = Color( 0, 0, 0, 0 ) 23 | 24 | [sub_resource type="StyleBoxFlat" id=6] 25 | bg_color = Color( 0, 0, 0, 0 ) 26 | 27 | [sub_resource type="StyleBoxFlat" id=7] 28 | bg_color = Color( 0.588235, 0.588235, 0.588235, 0.121569 ) 29 | border_color = Color( 0.8, 0.8, 0.8, 0 ) 30 | 31 | [sub_resource type="StyleBoxFlat" id=8] 32 | bg_color = Color( 0.196078, 0.196078, 0.196078, 0.243137 ) 33 | border_color = Color( 0.8, 0.8, 0.8, 0 ) 34 | 35 | [sub_resource type="StyleBoxFlat" id=9] 36 | bg_color = Color( 0.3, 0.3, 0.32, 0.34 ) 37 | border_color = Color( 0.8, 0.8, 0.8, 0 ) 38 | 39 | [sub_resource type="DynamicFont" id=10] 40 | size = 10 41 | use_filter = true 42 | font_data = ExtResource( 2 ) 43 | 44 | [sub_resource type="Animation" id=11] 45 | length = 0.2 46 | tracks/0/type = "bezier" 47 | tracks/0/path = NodePath("Control:rect_position:x") 48 | tracks/0/interp = 1 49 | tracks/0/loop_wrap = true 50 | tracks/0/imported = false 51 | tracks/0/enabled = true 52 | tracks/0/keys = { 53 | "points": PoolRealArray( ), 54 | "times": PoolRealArray( ) 55 | } 56 | tracks/1/type = "bezier" 57 | tracks/1/path = NodePath("Control:rect_position:y") 58 | tracks/1/interp = 1 59 | tracks/1/loop_wrap = true 60 | tracks/1/imported = false 61 | tracks/1/enabled = true 62 | tracks/1/keys = { 63 | "points": PoolRealArray( -1988.11, -0.0918868, 22.29, 0.0492825, -383.376, 0, -0.25, 0, 0.0870815, -130.586 ), 64 | "times": PoolRealArray( 0, 0.1 ) 65 | } 66 | tracks/2/type = "method" 67 | tracks/2/path = NodePath(".") 68 | tracks/2/interp = 1 69 | tracks/2/loop_wrap = true 70 | tracks/2/imported = false 71 | tracks/2/enabled = true 72 | tracks/2/keys = { 73 | "times": PoolRealArray( 0 ), 74 | "transitions": PoolRealArray( 1 ), 75 | "values": [ { 76 | "args": [ ], 77 | "method": "toggle_visibility" 78 | } ] 79 | } 80 | 81 | [sub_resource type="Animation" id=12] 82 | length = 0.2 83 | tracks/0/type = "bezier" 84 | tracks/0/path = NodePath("Control:rect_position:x") 85 | tracks/0/interp = 1 86 | tracks/0/loop_wrap = true 87 | tracks/0/imported = false 88 | tracks/0/enabled = true 89 | tracks/0/keys = { 90 | "points": PoolRealArray( ), 91 | "times": PoolRealArray( ) 92 | } 93 | tracks/1/type = "bezier" 94 | tracks/1/path = NodePath("Control:rect_position:y") 95 | tracks/1/interp = 1 96 | tracks/1/loop_wrap = true 97 | tracks/1/imported = false 98 | tracks/1/enabled = true 99 | tracks/1/keys = { 100 | "points": PoolRealArray( 0, -0.25, 0, 0.0870815, -130.586, -1988.11, -0.0918868, 22.29, 0.0492825, -383.376 ), 101 | "times": PoolRealArray( 0, 0.1 ) 102 | } 103 | tracks/2/type = "method" 104 | tracks/2/path = NodePath(".") 105 | tracks/2/interp = 1 106 | tracks/2/loop_wrap = true 107 | tracks/2/imported = false 108 | tracks/2/enabled = true 109 | tracks/2/keys = { 110 | "times": PoolRealArray( 0.1 ), 111 | "transitions": PoolRealArray( 1 ), 112 | "values": [ { 113 | "args": [ ], 114 | "method": "toggle_visibility" 115 | } ] 116 | } 117 | 118 | [node name="Console" type="Control"] 119 | anchor_right = 1.0 120 | anchor_bottom = 1.0 121 | margin_bottom = -325.0 122 | script = ExtResource( 1 ) 123 | __meta__ = { 124 | "_edit_use_anchors_": false 125 | } 126 | consoleUserNameColor = 6 127 | design = 6 128 | textColor = 5 129 | showTextBackground = false 130 | showSendButton = false 131 | titleBarBackgroundColor = Color( 0.3, 0.27, 0.27, 1 ) 132 | backgroundColor = Color( 0, 0, 0, 0.98 ) 133 | textBackgroundColor = Color( 0, 0, 0, 0 ) 134 | lineBackgroundColor = Color( 0.24, 0.24, 0.24, 0.98 ) 135 | sendButtonColor = Color( 0.3, 0.3, 0.32, 0.34 ) 136 | sendButtonTextColor = Color( 1, 1, 1, 1 ) 137 | slideInAnimation = "" 138 | sendUserName = true 139 | 140 | [node name="LogTimer" type="Timer" parent="."] 141 | wait_time = 300.0 142 | 143 | [node name="Control" type="Control" parent="."] 144 | anchor_right = 1.0 145 | anchor_bottom = 1.0 146 | __meta__ = { 147 | "_edit_use_anchors_": false 148 | } 149 | 150 | [node name="VBoxContainer" type="VBoxContainer" parent="Control"] 151 | anchor_right = 1.0 152 | anchor_bottom = 1.0 153 | custom_constants/separation = 0 154 | __meta__ = { 155 | "_edit_use_anchors_": false 156 | } 157 | 158 | [node name="TitleBar" type="Control" parent="Control/VBoxContainer"] 159 | margin_right = 1024.0 160 | margin_bottom = 15.0 161 | size_flags_horizontal = 3 162 | size_flags_vertical = 3 163 | size_flags_stretch_ratio = 1.5 164 | __meta__ = { 165 | "_edit_use_anchors_": false 166 | } 167 | 168 | [node name="TitleBarBackground" type="Panel" parent="Control/VBoxContainer/TitleBar"] 169 | anchor_right = 1.0 170 | anchor_bottom = 1.0 171 | margin_top = -0.27739 172 | margin_bottom = -0.277405 173 | mouse_filter = 1 174 | custom_styles/panel = SubResource( 1 ) 175 | __meta__ = { 176 | "_edit_use_anchors_": false 177 | } 178 | 179 | [node name="VBoxContainer" type="Control" parent="Control/VBoxContainer/TitleBar"] 180 | anchor_left = 0.946 181 | anchor_top = 0.267 182 | anchor_right = 0.992 183 | anchor_bottom = 0.933 184 | margin_left = 0.295959 185 | margin_top = -0.00500011 186 | margin_right = 0.191956 187 | margin_bottom = 0.00499916 188 | __meta__ = { 189 | "_edit_use_anchors_": false 190 | } 191 | 192 | [node name="HideConsole" type="Button" parent="Control/VBoxContainer/TitleBar/VBoxContainer"] 193 | anchor_left = -0.02 194 | anchor_top = -0.2 195 | anchor_right = 1.066 196 | anchor_bottom = 1.06 197 | margin_left = 0.0233741 198 | margin_right = -34.0186 199 | margin_bottom = 5.4 200 | rect_scale = Vector2( 3, 0.7 ) 201 | focus_mode = 0 202 | custom_styles/hover = SubResource( 2 ) 203 | custom_styles/pressed = SubResource( 3 ) 204 | custom_styles/focus = SubResource( 3 ) 205 | custom_styles/normal = SubResource( 3 ) 206 | custom_colors/font_color = Color( 1, 1, 1, 1 ) 207 | text = "-" 208 | __meta__ = { 209 | "_edit_use_anchors_": false 210 | } 211 | 212 | [node name="ConsoleContainer" type="Control" parent="Control/VBoxContainer"] 213 | margin_top = 15.0 214 | margin_right = 1024.0 215 | margin_bottom = 275.0 216 | size_flags_horizontal = 3 217 | size_flags_vertical = 3 218 | size_flags_stretch_ratio = 25.0 219 | 220 | [node name="ConsoleBackground" type="ColorRect" parent="Control/VBoxContainer/ConsoleContainer"] 221 | anchor_right = 1.0 222 | anchor_bottom = 1.0 223 | color = Color( 0, 0, 0, 0.98 ) 224 | __meta__ = { 225 | "_edit_use_anchors_": false 226 | } 227 | 228 | [node name="ConsoleText" type="Control" parent="Control/VBoxContainer/ConsoleContainer"] 229 | anchor_right = 1.0 230 | anchor_bottom = 1.0 231 | margin_bottom = -20.0 232 | size_flags_horizontal = 3 233 | size_flags_vertical = 3 234 | size_flags_stretch_ratio = 10.0 235 | __meta__ = { 236 | "_edit_use_anchors_": false 237 | } 238 | 239 | [node name="TextBackground" type="ColorRect" parent="Control/VBoxContainer/ConsoleContainer/ConsoleText"] 240 | visible = false 241 | anchor_right = 1.0 242 | anchor_bottom = 1.0 243 | color = Color( 0, 0, 0, 0 ) 244 | __meta__ = { 245 | "_edit_use_anchors_": false 246 | } 247 | 248 | [node name="RichTextLabel" type="RichTextLabel" parent="Control/VBoxContainer/ConsoleContainer/ConsoleText"] 249 | anchor_right = 1.0 250 | anchor_bottom = 1.0 251 | margin_left = 4.0 252 | margin_top = 8.0 253 | margin_right = -4.0 254 | margin_bottom = -4.0 255 | bbcode_enabled = true 256 | scroll_following = true 257 | __meta__ = { 258 | "_edit_use_anchors_": false 259 | } 260 | 261 | [node name="InputLine" type="Control" parent="Control/VBoxContainer/ConsoleContainer"] 262 | anchor_top = 1.0 263 | anchor_right = 1.0 264 | anchor_bottom = 1.0 265 | margin_top = -20.0 266 | rect_min_size = Vector2( 0, 20 ) 267 | size_flags_horizontal = 3 268 | size_flags_vertical = 3 269 | __meta__ = { 270 | "_edit_use_anchors_": false 271 | } 272 | 273 | [node name="LineBackground" type="ColorRect" parent="Control/VBoxContainer/ConsoleContainer/InputLine"] 274 | visible = false 275 | anchor_right = 1.0 276 | anchor_bottom = 1.0 277 | color = Color( 0.24, 0.24, 0.24, 0.98 ) 278 | __meta__ = { 279 | "_edit_use_anchors_": false 280 | } 281 | 282 | [node name="HBoxContainer" type="HBoxContainer" parent="Control/VBoxContainer/ConsoleContainer/InputLine"] 283 | anchor_right = 1.0 284 | anchor_bottom = 1.0 285 | size_flags_horizontal = 3 286 | size_flags_vertical = 3 287 | custom_constants/separation = 2 288 | __meta__ = { 289 | "_edit_use_anchors_": false 290 | } 291 | 292 | [node name="ChannelSelector" type="Control" parent="Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer"] 293 | margin_right = 78.0 294 | margin_bottom = 20.0 295 | size_flags_horizontal = 3 296 | size_flags_vertical = 3 297 | 298 | [node name="ColorRect" type="ColorRect" parent="Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ChannelSelector"] 299 | visible = false 300 | anchor_right = 1.0 301 | anchor_bottom = 1.0 302 | __meta__ = { 303 | "_edit_use_anchors_": false 304 | } 305 | 306 | [node name="Channels" type="OptionButton" parent="Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ChannelSelector"] 307 | anchor_right = 1.0 308 | anchor_bottom = 1.0 309 | custom_styles/hover = SubResource( 4 ) 310 | custom_styles/pressed = SubResource( 5 ) 311 | custom_styles/focus = SubResource( 5 ) 312 | custom_styles/normal = SubResource( 5 ) 313 | text = "All" 314 | items = [ "All", null, false, 0, null ] 315 | selected = 0 316 | __meta__ = { 317 | "_edit_use_anchors_": false 318 | } 319 | 320 | [node name="Input" type="Control" parent="Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer"] 321 | margin_left = 80.0 322 | margin_right = 1024.0 323 | margin_bottom = 20.0 324 | size_flags_horizontal = 3 325 | size_flags_vertical = 3 326 | size_flags_stretch_ratio = 12.0 327 | 328 | [node name="Line" type="LineEdit" parent="Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/Input"] 329 | anchor_right = 1.0 330 | anchor_bottom = 1.0 331 | margin_left = 5.0 332 | custom_styles/normal = SubResource( 6 ) 333 | placeholder_text = ">" 334 | __meta__ = { 335 | "_edit_use_anchors_": false 336 | } 337 | 338 | [node name="ButtonField" type="Control" parent="Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer"] 339 | visible = false 340 | margin_left = 950.0 341 | margin_right = 1024.0 342 | margin_bottom = 20.0 343 | size_flags_horizontal = 3 344 | size_flags_vertical = 3 345 | 346 | [node name="ButtonBackground" type="ColorRect" parent="Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField"] 347 | anchor_right = 1.0 348 | anchor_bottom = 1.0 349 | margin_top = -0.35849 350 | margin_bottom = -0.35849 351 | color = Color( 0, 0, 0, 0 ) 352 | __meta__ = { 353 | "_edit_use_anchors_": false 354 | } 355 | 356 | [node name="SendText" type="Button" parent="Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField"] 357 | visible = false 358 | anchor_right = 1.0 359 | anchor_bottom = 1.0 360 | custom_styles/hover = SubResource( 7 ) 361 | custom_styles/pressed = SubResource( 8 ) 362 | custom_styles/focus = SubResource( 9 ) 363 | custom_styles/disabled = SubResource( 9 ) 364 | custom_styles/normal = SubResource( 9 ) 365 | custom_fonts/font = SubResource( 10 ) 366 | custom_colors/font_color = Color( 1, 1, 1, 1 ) 367 | text = "send" 368 | __meta__ = { 369 | "_edit_use_anchors_": false 370 | } 371 | 372 | [node name="Animation" type="AnimationPlayer" parent="."] 373 | anims/slide_in = SubResource( 11 ) 374 | anims/slide_out = SubResource( 12 ) 375 | [connection signal="resized" from="." to="." method="_on_Console_resized"] 376 | [connection signal="timeout" from="LogTimer" to="." method="_on_LogTimer_timeout"] 377 | [connection signal="gui_input" from="Control/VBoxContainer/TitleBar" to="." method="_on_TitleBar_gui_input"] 378 | [connection signal="pressed" from="Control/VBoxContainer/TitleBar/VBoxContainer/HideConsole" to="." method="_on_HideConsole_pressed"] 379 | [connection signal="meta_clicked" from="Control/VBoxContainer/ConsoleContainer/ConsoleText/RichTextLabel" to="." method="_on_RichTextLabel_meta_clicked"] 380 | [connection signal="item_selected" from="Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ChannelSelector/Channels" to="." method="_on_Channels_item_selected"] 381 | [connection signal="text_changed" from="Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/Input/Line" to="." method="_on_Line_text_changed"] 382 | [connection signal="text_entered" from="Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/Input/Line" to="." method="_on_Line_text_entered"] 383 | [connection signal="pressed" from="Control/VBoxContainer/ConsoleContainer/InputLine/HBoxContainer/ButtonField/SendText" to="." method="_on_SendText_pressed"] 384 | -------------------------------------------------------------------------------- /Console/ConsoleChannel.gd: -------------------------------------------------------------------------------- 1 | class_name ConsoleChannel 2 | 3 | 4 | var channelName := "" 5 | var text := "" 6 | var lastMessage := "" 7 | 8 | 9 | func _init(_channelName : String): 10 | channelName = _channelName 11 | text = "" 12 | lastMessage = "" 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Console/ConsoleColors.gd: -------------------------------------------------------------------------------- 1 | class_name ConsoleColor 2 | 3 | enum Type { 4 | AQUA, 5 | BLACK, 6 | BLUE, 7 | FUCHSIA, 8 | GRAY, 9 | GREEN, 10 | MAROON, 11 | PURPLE, 12 | RED, 13 | SILVER, 14 | TEAL, 15 | WHITE, 16 | YELLOW, 17 | } 18 | 19 | const TypeDict = { 20 | Type.AQUA : Color.aqua, 21 | Type.BLACK : Color.black, 22 | Type.BLUE : Color.blue, 23 | Type.FUCHSIA : Color.fuchsia, 24 | Type.GRAY : Color.gray, 25 | Type.GREEN : Color.green, 26 | Type.MAROON : Color.maroon, 27 | Type.PURPLE : Color.purple, 28 | Type.RED : Color.red, 29 | Type.SILVER : Color.silver, 30 | Type.TEAL : Color.teal, 31 | Type.WHITE : Color.white, 32 | Type.YELLOW : Color.yellow, 33 | } 34 | 35 | -------------------------------------------------------------------------------- /Console/ConsoleCommand.gd: -------------------------------------------------------------------------------- 1 | class_name ConsoleCommand 2 | 3 | var invokeName : String 4 | var commandRef 5 | var defaultArgs : Array 6 | var description : String = "" 7 | var necessaryCallRight 8 | 9 | 10 | func _init(invName : String, cRef, \ 11 | cdescription : String = "", \ 12 | cdefaultArgs : Array = [], \ 13 | cnecessaryCallRight = ConsoleUserRight.Type.USER): 14 | 15 | self.invokeName = invName 16 | self.commandRef = cRef 17 | self.defaultArgs = cdefaultArgs 18 | self.description = cdescription 19 | self.necessaryCallRight = cnecessaryCallRight 20 | 21 | 22 | func apply(args : Array): 23 | if args.empty(): 24 | commandRef.apply(defaultArgs) 25 | else: 26 | commandRef.apply(args) 27 | 28 | 29 | func set_invoke_name(name : String): 30 | invokeName = name 31 | 32 | 33 | func set_command(cmdRef): 34 | commandRef = cmdRef 35 | 36 | 37 | func set_default_args(args : Array): 38 | defaultArgs = args 39 | 40 | 41 | func set_description(cdescription : String): 42 | description = cdescription 43 | 44 | 45 | # set_call_rights( ConsoleRights.CallRights.DEV ) 46 | func set_call_rights(rights): 47 | necessaryCallRight = rights 48 | 49 | 50 | func get_call_rights() -> int: 51 | return necessaryCallRight 52 | 53 | 54 | func are_rights_sufficient(rights) -> bool: 55 | return rights >= necessaryCallRight 56 | 57 | 58 | func get_expected_args() -> Array: 59 | return commandRef.get_expected_arguments() 60 | 61 | 62 | func get_ref(): 63 | return commandRef 64 | 65 | 66 | func get_invoke_name() -> String: 67 | return invokeName 68 | 69 | 70 | func get_default_args() -> Array: 71 | return defaultArgs 72 | 73 | 74 | func get_description() -> String: 75 | return description 76 | -------------------------------------------------------------------------------- /Console/ConsoleCommandRef.gd: -------------------------------------------------------------------------------- 1 | class_name CommandRef 2 | 3 | 4 | const VARIANT = -1 5 | const ALIAS = -2 6 | 7 | var funcRef := FuncRef.new() 8 | var argsExpected # arguments for the function 9 | 10 | 11 | func _init(_obj, _ref : String, _argsExpected = 0): 12 | funcRef.set_function(_ref) 13 | funcRef.set_instance(_obj) 14 | 15 | if typeof(_argsExpected) == TYPE_ARRAY: 16 | argsExpected = _argsExpected 17 | else: 18 | argsExpected = [_argsExpected] 19 | 20 | 21 | func get_expected_arguments() -> Array: 22 | return self.argsExpected 23 | 24 | 25 | func set_expected_arguments(args : Array): 26 | self.argsExpected = args 27 | 28 | 29 | func get_max_args_expected() -> int: 30 | var maxNum = 0 31 | for num in argsExpected: 32 | if num > maxNum: 33 | maxNum = num 34 | return maxNum 35 | 36 | 37 | func apply(args : Array): 38 | if VARIANT in argsExpected: 39 | funcRef.call_func(args) 40 | return 41 | elif ALIAS in argsExpected: 42 | if args.size() in get_expected_arguments(): 43 | funcRef.call_funcv(args) 44 | return 45 | elif not args.size() in argsExpected: 46 | print("Arguments not matching") 47 | return 48 | 49 | if argsExpected.size() > 1: 50 | funcRef.call_func(args) 51 | return 52 | 53 | 54 | match args.size(): 55 | 0: 56 | funcRef.call_func() 57 | 1: 58 | funcRef.call_func(args[0]) 59 | 2: 60 | funcRef.call_func(args[0], args[1]) 61 | 3: 62 | funcRef.call_func(args[0], args[1], args[2]) 63 | 4: 64 | funcRef.call_func(args[0], args[1], args[2], args[3]) 65 | 5: 66 | funcRef.call_func(args[0], args[1], args[2], args[3], args[4]) 67 | 6: 68 | funcRef.call_func(args[0], args[1], args[2], args[3], args[4], args[5]) 69 | 7: 70 | funcRef.call_func(args[0], args[1], args[2], args[3], args[4], args[5], args[6]) 71 | 8: 72 | funcRef.call_func(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]) 73 | 9: 74 | funcRef.call_func(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]) 75 | 10: 76 | funcRef.call_func(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10]) 77 | _: 78 | printerr("If you want more than 10 args then pls just put more lines here, sorry! (here refers to ConsoleCommandRef.gd)") 79 | 80 | -------------------------------------------------------------------------------- /Console/ConsoleDockings.gd: -------------------------------------------------------------------------------- 1 | class_name Dockings 2 | 3 | enum Type { 4 | CUSTOM, 5 | TOP, 6 | BOTTOM, 7 | LEFT, 8 | RIGHT, 9 | FULL_SCREEN, 10 | } 11 | 12 | const TypeDict = { 13 | "custom" : Type.CUSTOM, 14 | "top" : Type.TOP, 15 | "bottom" : Type.BOTTOM, 16 | "left" : Type.LEFT, 17 | "right" : Type.RIGHT, 18 | "full_screen" : Type.FULL_SCREEN, 19 | } 20 | -------------------------------------------------------------------------------- /Console/ConsoleFlags.gd: -------------------------------------------------------------------------------- 1 | class_name ConsoleFlags 2 | 3 | enum Type { 4 | NONE = 0, 5 | USER_PREFIX = 1, 6 | CLICKABLE = 2048, 7 | NO_DRAW = 4, # won't be drawn on console text 8 | BOLD = 8, 9 | ITALICS = 16, 10 | UNDERLINE = 32, 11 | CODE = 64, 12 | CENTER = 128, 13 | RIGHT = 256, 14 | FILL = 512, 15 | INDENT = 1024, 16 | URL = 2048, 17 | NO_COMMANDS = 4096, 18 | TRACK_MESSAGE = 8192, # append to the message stack that can be scrolled through with ui_up/ui_down 19 | SHOW_TIME = 16384, 20 | } 21 | -------------------------------------------------------------------------------- /Console/ConsoleThemes.gd: -------------------------------------------------------------------------------- 1 | class_name ConsoleTheme 2 | 3 | enum Type { 4 | BLUE, 5 | LIGHT, 6 | DARK, 7 | GRAY, 8 | UBUNTU, 9 | ARCH_AQUA, 10 | ARCH_GREEN, 11 | WINDOWS, 12 | TEXT_ONLY, 13 | } 14 | 15 | const TypeDict = { 16 | Type.BLUE : { 17 | "dockingStation" : Dockings.Type.CUSTOM, 18 | 19 | "showSendButton" : false, 20 | "showLineBackground" : false, 21 | "showTitleBar" : true, 22 | "showTextBackground" : false, 23 | 24 | "titleBarColor" : Color(0, 0.18, 0.62, 0.95), 25 | "backgroundColor" : Color(0.09, 0.09, 0.16, 0.87), 26 | "lineEditColor" : Color(0.21, 0.21, 0.21, 0.82), 27 | "sendButtonColor" : Color(0.14, 0.14, 0.18, 0.34), 28 | "textBackgroundColor" : Color(0.0, 0.0, 0.0, 1.0), 29 | "textColor" : ConsoleColor.Type.WHITE, 30 | "sendButtonTextColor" : Color.white, 31 | 32 | "roundedTitleBar" : true, 33 | "animation" : "", 34 | "hideScrollBar" : false 35 | }, 36 | Type.DARK : { 37 | "dockingStation" : Dockings.Type.CUSTOM, 38 | "showSendButton" : false, 39 | "showLineBackground" : false, 40 | "showTitleBar" : true, 41 | "showTextBackground" : false, 42 | "titleBarColor" : Color(0, 0, 0, 0.95), 43 | "roundedTitleBar" : true, 44 | "backgroundColor" : Color(0.06, 0.06, 0.08, 0.88), 45 | "lineEditColor" : Color(0.21, 0.21, 0.21, 0.82), 46 | "sendButtonColor" : Color(0.14, 0.14, 0.18, 0.34), 47 | "textBackgroundColor" : Color(0.0, 0.0, 0.0, 1.0), 48 | "textColor" : ConsoleColor.Type.WHITE, 49 | "sendButtonTextColor" : Color.white, 50 | 51 | "animation" : "", 52 | "hideScrollBar" : false 53 | }, 54 | Type.LIGHT : { 55 | "dockingStation" : Dockings.Type.CUSTOM, 56 | "showSendButton" : false, 57 | "showLineBackground" : false, 58 | "showTitleBar" : true, 59 | "showTextBackground" : false, 60 | "titleBarColor" : Color(1.0, 1.0, 1.0, 0.95), 61 | "roundedTitleBar" : true, 62 | "backgroundColor" : Color(1.0, 1.0, 1.0, 0.5), 63 | "lineEditColor" : Color(0.87, 0.87, 0.87, 0.71), 64 | "sendButtonColor" : Color(0.14, 0.14, 0.18, 0.34), 65 | "textBackgroundColor" : Color(0.0, 0.0, 0.0, 1.0), 66 | "textColor" : ConsoleColor.Type.BLACK, 67 | "sendButtonTextColor" : Color.white, 68 | 69 | "animation" : "", 70 | "hideScrollBar" : false 71 | }, 72 | Type.GRAY : { 73 | "dockingStation" : Dockings.Type.CUSTOM, 74 | "showSendButton" : false, 75 | "showLineBackground" : false, 76 | "showTitleBar" : true, 77 | "showTextBackground" : false, 78 | "titleBarColor" : Color(0.24, 0.24, 0.24, 0.95), 79 | "roundedTitleBar" : true, 80 | "backgroundColor" : Color(0.03, 0.03, 0.03, 0.5), 81 | "lineEditColor" : Color(0.21, 0.21, 0.21, 0.82), 82 | "sendButtonColor" : Color(0.14, 0.14, 0.18, 0.34), 83 | "textBackgroundColor" : Color(0.0, 0.0, 0.0, 1.0), 84 | "textColor" : ConsoleColor.Type.WHITE, 85 | "sendButtonTextColor" : Color.white, 86 | 87 | "animation" : "", 88 | "hideScrollBar" : false 89 | }, 90 | Type.UBUNTU : { 91 | "dockingStation" : Dockings.Type.CUSTOM, 92 | "showSendButton" : false, 93 | "showLineBackground" : false, 94 | "showTitleBar" : true, 95 | "showTextBackground" : false, 96 | "titleBarColor" : Color(0.3, 0.3, 0.3, 0.95), 97 | "backgroundColor" : Color(0.26, 0.0, 0.27, 0.9), 98 | "lineEditColor" : Color(0.13, 0.0, 0.18, 0.77), 99 | "sendButtonColor" : Color(0.01, 0.01, 0.01, 0.34), 100 | "textBackgroundColor" : Color(0.0, 0.0, 0.0, 1.0), 101 | "textColor" : ConsoleColor.Type.WHITE, 102 | "sendButtonTextColor" : Color.white, 103 | 104 | "roundedTitleBar" : true, 105 | "animation" : "", 106 | "hideScrollBar" : false 107 | }, 108 | Type.ARCH_AQUA : { 109 | "dockingStation" : Dockings.Type.CUSTOM, 110 | "showSendButton" : false, 111 | "showLineBackground" : false, 112 | "showTitleBar" : true, 113 | "showTextBackground" : false, 114 | "titleBarColor" : Color(0.35, 0.34, 0.34, 0.98), 115 | "roundedTitleBar" : true, 116 | "backgroundColor" : Color(0.0, 0.25, 0.38, 0.87), 117 | "lineEditColor" : Color(0.21, 0.35, 0.66, 0.82), 118 | "sendButtonColor" : Color(0.26, 0.27, 0.63, 0.34), 119 | "textBackgroundColor" : Color(0.0, 0.0, 0.0, 1.0), 120 | "textColor" : ConsoleColor.Type.AQUA, 121 | "sendButtonTextColor" : Color.white, 122 | 123 | "animation" : "", 124 | "hideScrollBar" : false 125 | }, 126 | Type.ARCH_GREEN : { 127 | "dockingStation" : Dockings.Type.CUSTOM, 128 | "showSendButton" : false, 129 | "showLineBackground" : false, 130 | "showTitleBar" : true, 131 | "showTextBackground" : false, 132 | "titleBarColor" : Color(0.30, 0.27, 0.27, 1.0), 133 | "roundedTitleBar" : true, 134 | "backgroundColor" : Color(0.0, 0.0, 0.0, 0.98), 135 | "lineEditColor" : Color(0.24, 0.24, 0.24, 0.98), 136 | "sendButtonColor" : Color(0.3, 0.3, 0.32, 0.34), 137 | "textBackgroundColor" : Color(0.0, 0.0, 0.0, 1.0), 138 | "textColor" : ConsoleColor.Type.GREEN, 139 | "sendButtonTextColor" : Color.white, 140 | 141 | "animation" : "", 142 | "hideScrollBar" : false 143 | }, 144 | Type.WINDOWS : { 145 | "dockingStation" : Dockings.Type.CUSTOM, 146 | "showSendButton" : false, 147 | "showLineBackground" : false, 148 | "showTitleBar" : true, 149 | "showTextBackground" : false, 150 | "titleBarColor" : Color(1.0, 1.0, 1.0, 1.0), 151 | "roundedTitleBar" : false, 152 | "backgroundColor" : Color(0.0, 0.0, 0.0, 1.0), 153 | "lineEditColor" : Color(0.11, 0.11,0.11, 0.82), 154 | "sendButtonColor" : Color(0.22, 0.22, 0.22, 0.34), 155 | "textBackgroundColor" : Color(0.0, 0.0, 0.0, 1.0), 156 | "textColor" : ConsoleColor.Type.WHITE, 157 | "sendButtonTextColor" : Color.white, 158 | 159 | "animation" : "", 160 | "hideScrollBar" : false 161 | }, 162 | Type.TEXT_ONLY : { 163 | "dockingStation" : Dockings.Type.CUSTOM, 164 | "showSendButton" : false, 165 | "showLineBackground" : false, 166 | "showTitleBar" : false, 167 | "showTextBackground" : false, 168 | "titleBarColor" : Color(1.0, 1.0, 1.0, 0.0), 169 | "roundedTitleBar" : false, 170 | "backgroundColor" : Color(0.0, 0.0, 0.0, 0.0), 171 | "lineEditColor" : Color(0.11, 0.11,0.11, 0.0), 172 | "sendButtonColor" : Color(0.22, 0.22, 0.22, 0.0), 173 | "textBackgroundColor" : Color(0.0, 0.0, 0.0, 1.0), 174 | "textColor" : ConsoleColor.Type.WHITE, 175 | "sendButtonTextColor" : Color.white, 176 | 177 | "animation" : "", 178 | "hideScrollBar" : false 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /Console/ConsoleUserRight.gd: -------------------------------------------------------------------------------- 1 | class_name ConsoleUserRight 2 | 3 | enum Type { 4 | NONE = 0, 5 | USER = 1, 6 | TESTER = 2, 7 | MODERATOR = 4, 8 | ADMIN = 8, 9 | DEV = 16, 10 | } 11 | 12 | 13 | const TypeDict = { 14 | Type.NONE : "none", 15 | Type.USER : "user", 16 | Type.TESTER : "tester", 17 | Type.MODERATOR : "moderator", 18 | Type.ADMIN : "admin", 19 | Type.DEV : "dev", 20 | } 21 | -------------------------------------------------------------------------------- /Console/DebugConsole.gd: -------------------------------------------------------------------------------- 1 | extends CanvasLayer 2 | 3 | onready var console = $Consoles/Console 4 | 5 | 6 | func _ready(): 7 | pass 8 | 9 | 10 | func write_channel(channelName, text, flags = 0): 11 | console.write_channel(channelName, text, flags) 12 | 13 | 14 | func write_line_channel(channelName, text, flags = 0): 15 | console.write_line_channel(channelName, text + "\n", flags) 16 | 17 | 18 | func write(msg, flags = 0): 19 | console.write_channel("All", msg, flags) 20 | 21 | 22 | func write_line(msg, flags = 0): 23 | console.write_line_channel("All", msg, flags) 24 | 25 | 26 | func error(msg, channelName = "All"): 27 | if channelName.empty(): 28 | console.error(msg, 0) 29 | else: 30 | console.error(msg, 0, console.get_channel(channelName)) 31 | 32 | 33 | func warn(msg, channelName = "All"): 34 | if channelName.empty(): 35 | console.warn(msg, 0) 36 | else: 37 | console.warn(msg, 0, console.get_channel(channelName)) 38 | 39 | 40 | func success(msg, channelName = "All"): 41 | if channelName.empty(): 42 | console.success(msg, 0) 43 | else: 44 | console.success(msg, 0, console.get_channel(channelName)) 45 | 46 | 47 | func add_command(command : ConsoleCommand): 48 | console.add_command(command) 49 | 50 | 51 | func get_channels() -> Array: 52 | return console.get_channels() 53 | 54 | 55 | func get_channel(channelName : String) -> ConsoleChannel: 56 | return console.get_channel(channelName) 57 | 58 | 59 | func add_channel(channelName : String): 60 | console.add_channel(channelName) 61 | 62 | 63 | func remove_channel(channelName : String): 64 | console.remove_channel(channelName) 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /Console/DebugConsole.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=2] 2 | 3 | [ext_resource path="res://Console/DebugConsole.gd" type="Script" id=1] 4 | [ext_resource path="res://Console/Console.tscn" type="PackedScene" id=2] 5 | 6 | [node name="DebugConsole" type="CanvasLayer"] 7 | script = ExtResource( 1 ) 8 | 9 | [node name="Consoles" type="GridContainer" parent="."] 10 | anchor_right = 1.0 11 | anchor_bottom = 1.0 12 | mouse_filter = 2 13 | custom_constants/vseparation = 0 14 | custom_constants/hseparation = 0 15 | __meta__ = { 16 | "_edit_use_anchors_": false 17 | } 18 | 19 | [node name="Console" parent="Consoles" instance=ExtResource( 2 )] 20 | anchor_right = 0.0 21 | anchor_bottom = 0.0 22 | margin_right = 1024.0 23 | margin_bottom = 600.0 24 | size_flags_horizontal = 3 25 | size_flags_vertical = 3 26 | userName = "TestName" 27 | userRight = 1 28 | channelNames = [ "Debug" ] 29 | showTimeStamp = true 30 | -------------------------------------------------------------------------------- /Console/DefaultCommands.gd: -------------------------------------------------------------------------------- 1 | extends Node 2 | class_name ConsoleDefaultCommands 3 | 4 | var _firstHelp := true 5 | var consoleRef #: Console 6 | 7 | onready var cdNode : Node = get_node("/root") 8 | 9 | 10 | 11 | func set_default_commands(console): 12 | consoleRef = console 13 | 14 | var exitRef = CommandRef.new(self, "exit", 0) 15 | var exitCommand = ConsoleCommand.new('exit', exitRef, 'Closes the console.') 16 | console.add_command(exitCommand) 17 | 18 | var clearRef = CommandRef.new(self, "clear", 0) 19 | var clearCommand = ConsoleCommand.new('clear', clearRef, 'Clears the console.') 20 | console.add_command(clearCommand) 21 | 22 | var manRef = CommandRef.new(self, "man", 1) 23 | var manCommand = ConsoleCommand.new('man', manRef, 'shows command description.') 24 | console.add_command(manCommand) 25 | 26 | var helpRef = CommandRef.new(self, "help", 0) 27 | var helpCommand = ConsoleCommand.new('help', helpRef, 'shows all user defined commands.') 28 | console.add_command(helpCommand) 29 | 30 | var helpAllRef = CommandRef.new(self, "help_all", 0) 31 | var helpAllCommand = ConsoleCommand.new('helpAll', helpAllRef, 'shows all commands.') 32 | console.add_command(helpAllCommand) 33 | 34 | var setCommandSignRef = CommandRef.new(self, "set_command_sign", 1) 35 | var setCommandSignCommand = ConsoleCommand.new('setCommandSign', setCommandSignRef, 'Sets new command sign. (default: \'/\')') 36 | console.add_command(setCommandSignCommand) 37 | 38 | var toggleButtonRef = CommandRef.new(self, "toggle_button", 0) 39 | var toggleButtonCommand = ConsoleCommand.new('toggleButton', toggleButtonRef, 'Toggles visibility of \'send\' button.') 40 | console.add_command(toggleButtonCommand) 41 | 42 | var toggleEditLineRef = CommandRef.new(self, "toggle_edit_line", 0) 43 | var toggleEditLineCommand = ConsoleCommand.new('toggleShowEditLine', toggleEditLineRef, 'Toggles visibility of edit line.') 44 | console.add_command(toggleEditLineCommand) 45 | 46 | var setUserMessageSignRef = CommandRef.new(self, "set_user_msg_sign", 1) 47 | var setUserMessageSignCommand = ConsoleCommand.new('setUserMessageSign', setUserMessageSignRef, 'Sets new sign for user messages. (default: \'>\')') 48 | console.add_command(setUserMessageSignCommand) 49 | 50 | var toggleWindowDragRef = CommandRef.new(self, "toggle_window_drag", 0) 51 | var toggleWindowDragCommand = ConsoleCommand.new('toggleWindowDrag', toggleWindowDragRef, 'Toggles whether the console is draggable or not.') 52 | console.add_command(toggleWindowDragCommand) 53 | 54 | var setThemeRef = CommandRef.new(self, "set_theme", 1) 55 | var setThemeCommand = ConsoleCommand.new('setTheme', setThemeRef, 'Sets the theme (number).') 56 | console.add_command(setThemeCommand) 57 | 58 | var setDockRef = CommandRef.new(self, "set_dock", 1) 59 | var setDockCommand = ConsoleCommand.new('setDock', setDockRef, 'Sets the docking station.') 60 | console.add_command(setDockCommand) 61 | 62 | var setTextColorRef = CommandRef.new(self, "set_default_text_color", 1) 63 | var setTextColorCommand = ConsoleCommand.new('setDefaultTextColor', setTextColorRef, 'Sets the default text color (format: #rrggbb).') 64 | console.add_command(setTextColorCommand) 65 | 66 | var aliasRef = CommandRef.new(self, "alias", CommandRef.VARIANT) 67 | var aliasCommand = ConsoleCommand.new('alias', aliasRef, 'Sets an alias for a command\narg 1: newname\narg 2: command.', [], ConsoleUserRight.Type.DEV) 68 | console.add_command(aliasCommand) 69 | 70 | var toggleTitlebarRef = CommandRef.new(self, "toggle_titlebar", 0) 71 | var toggleTitlebarCommand = ConsoleCommand.new('toggleTitlebar', toggleTitlebarRef, 'Toggles the titlebar.') 72 | console.add_command(toggleTitlebarCommand) 73 | 74 | var setConsoleSizeRef = CommandRef.new(self, "set_console_size", 2) 75 | var setConsoleSizeCommand = ConsoleCommand.new('setConsoleSize', setConsoleSizeRef, 'Sets the console size.') 76 | console.add_command(setConsoleSizeCommand) 77 | 78 | var toggleTextBackgroundRef = CommandRef.new(self, "toggle_text_background", 0) 79 | var toggleTextBackgroundCommand = ConsoleCommand.new('toggleTextBackground', toggleTextBackgroundRef, 'Toggles the text background.') 80 | console.add_command(toggleTextBackgroundCommand) 81 | 82 | var toggleConsoleBackgroundRef = CommandRef.new(self, "toggle_console_background", 0) 83 | var toggleConsoleBackgroundCommand = ConsoleCommand.new('toggleConsoleBackground', toggleConsoleBackgroundRef, 'Toggles the console background.') 84 | console.add_command(toggleConsoleBackgroundCommand) 85 | 86 | var toggleTimeStampRef = CommandRef.new(self, "toggle_time_stamp", 0) 87 | var toggleTimeStampCommand = ConsoleCommand.new('toggleTimeStamp', toggleTimeStampRef, 'Toggles the console background.') 88 | console.add_command(toggleTimeStampCommand) 89 | 90 | var setUserColorRef = CommandRef.new(self, "set_user_color", 1) 91 | var setUserColorCommand = ConsoleCommand.new('setUserColor', setUserColorRef, 'Sets the color of the users name. (format: #rrggbb)') 92 | console.add_command(setUserColorCommand) 93 | 94 | var showDefaultCommandsRef = CommandRef.new(self, "show_default_commands", 0) 95 | var helpDefaultCommand = ConsoleCommand.new('helpDefault', showDefaultCommandsRef, 'Shows only the default commands.') 96 | var showDefaultCommandsCommand = ConsoleCommand.new('showDefaultCommands', showDefaultCommandsRef, 'Shows only the default commands.') 97 | console.add_command(helpDefaultCommand) 98 | console.add_command(showDefaultCommandsCommand) 99 | 100 | var showTreeCR = CommandRef.new(self, "show_tree", [0,1]) 101 | var showTreeC = ConsoleCommand.new('ls', showTreeCR, 'Shows child nodes of given param or root node when no param given.', [], ConsoleUserRight.Type.DEV) 102 | console.add_command(showTreeC) 103 | 104 | var cdCR = CommandRef.new(self, "change_dir", 1) 105 | var cdC = ConsoleCommand.new('cd', cdCR, 'Changes directory to the one specified.', [], ConsoleUserRight.Type.DEV) 106 | console.add_command(cdC) 107 | 108 | var pwdCR = CommandRef.new(self, "print_working_dir", 0) 109 | var pwdC = ConsoleCommand.new('pwd', pwdCR, 'Shows current directory.', [], ConsoleUserRight.Type.DEV) 110 | console.add_command(pwdC) 111 | 112 | var addChildCR = CommandRef.new(self, "_add_child", [1,2]) 113 | var addChildC = ConsoleCommand.new("addChild", addChildCR, \ 114 | str('Adds a a scene (@param1) as child to the node (@param2)', \ 115 | '\nIf no second param given, it\'ll be added to the current node.'), [], ConsoleUserRight.Type.DEV) 116 | consoleRef.add_command(addChildC) 117 | 118 | var setCR = CommandRef.new(self, "_set_attribute", [2,3]) 119 | var setC = ConsoleCommand.new("set", setCR, "Sets variable/attribute (@param1) of node with value (@param2) (@param3) or current Node if no second param given. (see Node.set)", [], ConsoleUserRight.Type.DEV) 120 | consoleRef.add_command(setC) 121 | 122 | var getCR = CommandRef.new(self, "_get_attribute", [1,2]) 123 | var getC = ConsoleCommand.new("get", getCR, "Gets variable/attribute (@param1) of node (@param2) or current Node if no second param given. (Node.get)", [], ConsoleUserRight.Type.DEV) 124 | consoleRef.add_command(getC) 125 | 126 | var hasCR = CommandRef.new(self, "_has_attribute", [1,2]) 127 | var hasC = ConsoleCommand.new("has", hasCR, "Looks for variable/attribute (@param1) of node (@param2) or current Node if no second param given. (Node.get)", [], ConsoleUserRight.Type.DEV) 128 | consoleRef.add_command(hasC) 129 | 130 | var treeCR = CommandRef.new(self, "_show_tree", 0) 131 | var treeC = ConsoleCommand.new("tree", treeCR, "Shows whole tree of nodes (starting from current node/dir).", [], ConsoleUserRight.Type.DEV) 132 | consoleRef.add_command(treeC) 133 | 134 | 135 | 136 | 137 | 138 | func _show_tree(): 139 | var node = cdNode 140 | consoleRef.write_line("") 141 | consoleRef.write_line("[color=red].[/color]") 142 | var output = [] 143 | _show_children(output, node) 144 | for i in range(output.size()): 145 | consoleRef.write_line(output[output.size() - 1 - i]) 146 | 147 | 148 | func _show_children(output : Array, node, level = 0): 149 | var i = 0 150 | for child in node.get_children(): 151 | var col 152 | if i == 0 and child.get_child_count() == 0: 153 | col = "| ".repeat(level) + "`- - " + "[color=%s]%s[/color]" 154 | else: 155 | col = "| ".repeat(level) + "|- - " + "[color=%s]%s[/color]" 156 | i += 1 157 | 158 | _show_children(output, child, level + 1) 159 | if child is Control: 160 | output.append(col % ["lime", child.name]) 161 | elif child is Node2D: 162 | output.append(col % ["#4169E1", child.name]) 163 | elif child is Spatial: 164 | output.append(col % ["#FE4D4D", child.name]) 165 | else: 166 | output.append(col % ["silver", child.name]) 167 | 168 | 169 | func _has_attribute(params : Array): 170 | consoleRef.write_line("") 171 | if params.size() == 1: 172 | var val = cdNode.get(params[0]) != null 173 | if val: 174 | consoleRef.write_line("%s has %s." % [cdNode.name, params[0]]) 175 | else: 176 | consoleRef.write_line("%s not found!" % params[0]) 177 | 178 | elif params.size() == 2: 179 | if cdNode.has_node(params[0]): 180 | var val = cdNode.get_node(params[0]).has_meta(params[1]) 181 | if val: 182 | consoleRef.write_line("%s has %s." % [cdNode.get_node(params[0]).name, val]) 183 | else: 184 | consoleRef.write_line("%s not found!" % val) 185 | else: 186 | consoleRef.write_line("No child node named: %s" % params[0]) 187 | 188 | 189 | func _get_attribute(params : Array): 190 | consoleRef.write_line("") 191 | if params.size() == 1: 192 | var val = cdNode.get(params[0]) 193 | consoleRef.write_line("%s" % val) 194 | elif params.size() == 2: 195 | if cdNode.has_node(params[0]): 196 | var val = cdNode.get_node(params[0]).get(params[1]) 197 | consoleRef.write_line("%s" % val) 198 | else: 199 | consoleRef.write_line("No child node named: %s" % params[0]) 200 | 201 | 202 | func _set_attribute(params : Array): 203 | if params.size() == 2: 204 | cdNode.set(params[0], _determine_type(params[1])) 205 | consoleRef.write_line("Set %s to %s" % [params[0], params[1]]) 206 | elif params.size() == 3: 207 | if cdNode.has_node(params[2]): 208 | cdNode.get_node(params[2]).set(params[0], _determine_type(params[1])) 209 | consoleRef.write_line("Set %s to %s" % [params[0], params[1]]) 210 | else: 211 | consoleRef.write_line("No child node named: %s" % params[2]) 212 | 213 | 214 | func _determine_type(val : String): 215 | if val.is_valid_float(): 216 | return val.to_float() 217 | elif val.is_valid_integer() or val.is_valid_hex_number(): 218 | return val.to_int() 219 | else: 220 | return val 221 | 222 | 223 | func _add_child(params : Array): 224 | if params.size() == 1: 225 | var child = load(params[0]).instance() 226 | if child != null: 227 | cdNode.add_child(load(params[0]).instance()) 228 | else: 229 | consoleRef.write_line("Couldn't find %s" % params[1]) 230 | 231 | elif params.size() == 2: 232 | var child = load(params[1]).instance() 233 | if child != null: 234 | if cdNode.has_node(params[0]): 235 | 236 | cdNode.get_node(params[0]).add_child(child) 237 | else: 238 | consoleRef.write_line("No child node named: %s" % params[0]) 239 | else: 240 | consoleRef.write_line("Couldn't find %s" % params[1]) 241 | 242 | 243 | func print_working_dir(): 244 | consoleRef.write_line("") 245 | consoleRef.write_line(str(cdNode.get_path()), ConsoleFlags.Type.NO_COMMANDS) 246 | 247 | 248 | func change_dir(path : String): 249 | if path == "..": 250 | consoleRef.write_line("") 251 | if str(cdNode.get_path()).find_last("/") != 0: 252 | cdNode = get_node(str(cdNode.get_path()).substr(0, str(cdNode.get_path()).find_last("/"))) 253 | consoleRef.write_line("Child nodes:") 254 | consoleRef.write_line("/ls", ConsoleFlags.Type.NO_DRAW) 255 | else: 256 | consoleRef.write_line("You are already at /root") 257 | consoleRef.write_line("Child nodes:") 258 | consoleRef.write_line("/ls", ConsoleFlags.Type.NO_DRAW) 259 | else: 260 | var node = get_node(cdNode.get_path()) 261 | if node.has_node(path): 262 | consoleRef.write_line("") 263 | cdNode = node.get_node(str(str(cdNode.get_path()), "/", path)) 264 | consoleRef.write_line("Child nodes:") 265 | consoleRef.write_line("/ls", ConsoleFlags.Type.NO_DRAW) 266 | else: 267 | consoleRef.write_line("") 268 | consoleRef.write_line("[color=red]No child node named %s[/color]" % [path]) 269 | consoleRef.write_line("Child nodes:") 270 | consoleRef.write_line("/ls", ConsoleFlags.Type.NO_DRAW) 271 | 272 | 273 | func show_tree(input : Array): 274 | if input.size() == 0: 275 | consoleRef.write_line("") 276 | for child in get_node(cdNode.get_path()).get_children(): 277 | consoleRef.write_line("%s" % child.name, ConsoleFlags.Type.NO_COMMANDS | ConsoleFlags.Type.INDENT) 278 | elif input.size() == 1: 279 | if get_node(cdNode.get_path()).has_node(input[0]): 280 | consoleRef.write_line("") 281 | for child in get_node(cdNode.get_path()).get_node(input[0]).get_children(): 282 | consoleRef.write_line("%s" % child.name, ConsoleFlags.Type.NO_COMMANDS | ConsoleFlags.Type.INDENT) 283 | else: 284 | consoleRef.write_line("") 285 | consoleRef.write_line("Couldn't find node %s" % input[0]) 286 | else: 287 | return 288 | 289 | 290 | func set_user_color(color : String): 291 | if color.is_valid_html_color(): 292 | consoleRef.update_console_user_name_color(Color(color)) 293 | 294 | 295 | func show_default_commands(): 296 | consoleRef.write_line("") 297 | for i in range(consoleRef.basicCommandsAmount): 298 | consoleRef.write("%s%s" % [consoleRef.commandSign, consoleRef.commands[i].get_invoke_name()], \ 299 | ConsoleFlags.Type.NO_COMMANDS | ConsoleFlags.Type.CLICKABLE) 300 | consoleRef.write(": %s" % consoleRef.commands[i].get_description()) 301 | consoleRef.write(" (args: ") 302 | consoleRef.print_args(i) 303 | consoleRef.write(")") 304 | consoleRef.write_line("") 305 | 306 | 307 | func toggle_text_background(): 308 | consoleRef.update_show_text_background(!consoleRef.showTextBackground) 309 | 310 | 311 | func toggle_console_background(): 312 | consoleRef.update_show_console_background(!consoleRef.showConsoleBackground) 313 | 314 | 315 | func toggle_time_stamp(): 316 | consoleRef.update_show_time_stamp(!consoleRef.showTimeStamp) 317 | 318 | 319 | func set_console_size(width, height): 320 | consoleRef.rect_size = Vector2(width, height) 321 | 322 | 323 | func toggle_titlebar(): 324 | consoleRef.update_show_title_bar(!consoleRef.showTitleBar) 325 | 326 | 327 | func alias(input : Array): 328 | if input.size() < 2: 329 | consoleRef.write_line("") 330 | consoleRef.write("not enough arguments! (received: %s)" % str(input.size())) 331 | return 332 | 333 | var cmd = consoleRef.get_command(input[1]) 334 | if cmd == null: 335 | consoleRef.write_line("%s" % input[1]) 336 | consoleRef.write(consoleRef.COMMAND_NOT_FOUND_MSG) 337 | return 338 | 339 | var command = consoleRef.copy_command(cmd) 340 | command.set_invoke_name(input[0]) 341 | if input.size() > 2: 342 | var _args : Array 343 | for ti in range(input.size() - 2): 344 | var i = ti + 2 345 | _args.append(input[i]) 346 | command.set_default_args(_args) 347 | command.get_ref().get_expected_arguments().append(CommandRef.ALIAS) 348 | 349 | consoleRef.add_command(command) 350 | 351 | 352 | func set_default_text_color(color : String): 353 | if color.is_valid_html_color(): 354 | consoleRef.update_text_color(Color(color)) 355 | 356 | 357 | func set_dock(docking): 358 | if Dockings.TypeDict.has(docking): 359 | consoleRef.update_docking_station(Dockings.TypeDict[docking]) 360 | 361 | 362 | func set_theme(snum): 363 | var num = int(snum) 364 | if ConsoleTheme.Type.SIZE > num and num >= 0: 365 | consoleRef.update_design(num) 366 | else: 367 | consoleRef.write_line("No theme with that number.") 368 | 369 | 370 | func help_all(): 371 | consoleRef.write_line("") 372 | for i in range(consoleRef.commands.size()): 373 | consoleRef.write("%s%s" % [consoleRef.commandSign, consoleRef.commands[i].get_invoke_name()], \ 374 | ConsoleFlags.Type.NO_COMMANDS | ConsoleFlags.Type.CLICKABLE) 375 | consoleRef.write(": %s" % consoleRef.commands[i].get_description()) 376 | consoleRef.write(" (args: ") 377 | consoleRef.print_args(i) 378 | consoleRef.write(")") 379 | consoleRef.write_line("") 380 | 381 | 382 | func set_command_sign(newSign : String): 383 | consoleRef.commandSign = newSign 384 | 385 | 386 | func toggle_button(): 387 | consoleRef.update_show_send_button(!consoleRef.showSendButton) 388 | 389 | 390 | func toggle_edit_line(): 391 | consoleRef.update_show_line_background(!consoleRef.showLineBackground) 392 | 393 | 394 | func set_user_msg_sign(userSign : String): 395 | consoleRef.update_user_message_sign(userSign) 396 | 397 | 398 | func toggle_window_drag(): 399 | consoleRef.allowWindowDrag = !consoleRef.allowWindowDrag 400 | 401 | 402 | func clear(): 403 | consoleRef.clear_selected_channel_text() 404 | 405 | 406 | func exit(): 407 | consoleRef.toggle_console() 408 | 409 | 410 | func man(command : String): 411 | consoleRef.write_line("") 412 | for i in range(consoleRef.commands.size()): 413 | if consoleRef.commands[i].get_invoke_name() == command: 414 | consoleRef.write("%s%s" % [consoleRef.commandSign, consoleRef.commands[i].get_invoke_name()], \ 415 | ConsoleFlags.Type.NO_COMMANDS | ConsoleFlags.Type.CLICKABLE) 416 | consoleRef.write(": %s" % consoleRef.commands[i].get_description()) 417 | consoleRef.write(" (args: ") 418 | consoleRef.print_args(i) 419 | consoleRef.write(")") 420 | consoleRef.write_line("") 421 | return 422 | 423 | consoleRef.write_line("[color=red]Couldn't find command '%s'[/color]" % command) 424 | 425 | 426 | func help(): 427 | consoleRef.write_line("") 428 | if _firstHelp: 429 | _firstHelp = false 430 | consoleRef.write("'help' shows user added commands. Use 'helpAll' to show all commands") 431 | 432 | for ti in range(consoleRef.commands.size() - consoleRef.basicCommandsAmount): 433 | var i = ti + consoleRef.basicCommandsAmount 434 | consoleRef.write_line("") 435 | consoleRef.write("%s%s" % [consoleRef.commandSign, consoleRef.commands[i].get_invoke_name()], \ 436 | ConsoleFlags.Type.NO_COMMANDS | ConsoleFlags.Type.CLICKABLE) 437 | consoleRef.write(": %s" % consoleRef.commands[i].get_description()) 438 | consoleRef.write(" (args: ") 439 | consoleRef.print_args(i) 440 | consoleRef.write(")") 441 | 442 | -------------------------------------------------------------------------------- /Console/noto_sans_ui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /Console/noto_sans_ui/NotoSansUI-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/Console/noto_sans_ui/NotoSansUI-Bold.ttf -------------------------------------------------------------------------------- /Console/noto_sans_ui/NotoSansUI-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/Console/noto_sans_ui/NotoSansUI-BoldItalic.ttf -------------------------------------------------------------------------------- /Console/noto_sans_ui/NotoSansUI-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/Console/noto_sans_ui/NotoSansUI-Italic.ttf -------------------------------------------------------------------------------- /Console/noto_sans_ui/NotoSansUI-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/Console/noto_sans_ui/NotoSansUI-Regular.ttf -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 cobrapitz 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LinuxLikeConsole ([v3.0](https://github.com/cobrapitz/LinuxLikeConsole/tree/v3.0)) 2 | ### Linux Like Console written in gdscript for Godot (Game Engine) 3 | ###### For additional features or problems just write an issue or Discord cobrapitz#2872 4 | 5 | 6 | ![Console](https://github.com/cobrapitz/LinuxLikeConsole/blob/master/showcase/consoleFront.PNG) 7 | 8 | ###### toggle with: key above tab 9 | 10 | *** 11 | 12 | ## [Showcase](https://github.com/cobrapitz/LinuxLikeConsole/wiki/Showcase) 13 | 14 | ## [Wiki](https://github.com/cobrapitz/LinuxLikeConsole/wiki) 15 | 16 | ## [Changelog](https://github.com/cobrapitz/LinuxLikeConsole/wiki/Changelog) 17 | 18 | *** 19 | 20 | ## Features: 21 | * [x] Auto completion / suggestion 22 | * [x] Custom commands 23 | * [x] **(NEW)** Custom Channels (Default only 'All' Channel) 24 | * [x] Custom/built in themes (arch theme, ubuntu theme, windows, light, dark, text_only) 25 | * [x] Built in commands like 26 | * [x] man, tree, ls, cd, help, alias, setDock, clear, ... 27 | * [x] Predefined and runtime forwarded parameters (runtime forwarding is prioritized) 28 | * [x] Easy BBcode support (like: [b]this is bold[/b]) 29 | * [x] Logging 30 | * [x] Dragable console 31 | * [x] Slide in animation 32 | * [x] User rights (to restrict the usage of developer only commands) 33 | * [x] Additional Visual and Logging functions (warn, error, sucess ) 34 | *** 35 | 36 | 37 | ### How to create custom commands 38 | 39 | ##### [Full Version here](https://github.com/cobrapitz/LinuxLikeConsole/wiki/Examples#1-how-to-add-custom-command-1) 40 | ```gdscript 41 | #short version 42 | 43 | onready var console = $Console 44 | 45 | func _ready(): 46 | var printThreeRef = CommandRef.new(self, "my_three_print", 3) 47 | var printThreeCommand = ConsoleCommand.new('printThree', printThreeRef , 'Custom print.') 48 | console.add_command(printThreeCommand ) 49 | 50 | # Also possible style 51 | 52 | console.add_command(ConsoleCommand.new( \ 53 | 'printThree', \ # command (like /printThree arg1 arg2 arg3) 54 | CommandRef.new(self, "my_three_print", 3) , \ # object with function name and arguments 55 | 'Custom print.') ) \ # description 56 | 57 | # 3-arguments version (called with: /printVariant print this please) 58 | func my_three_print(arg1, arg2, arg3): 59 | print("your args: %s %s %s" % [arg1, arg2, arg3]) 60 | ``` 61 | 62 | ### Fully customizable 63 | 64 | ![functions](https://github.com/cobrapitz/LinuxLikeConsole/blob/master/showcase/console10.PNG) 65 | 66 | *** 67 | -------------------------------------------------------------------------------- /showcase/console1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/showcase/console1.PNG -------------------------------------------------------------------------------- /showcase/console1.PNG.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/console1.PNG-e7e8cd4987cb591a558e4f25e568f40e.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://showcase/console1.PNG" 13 | dest_files=[ "res://.import/console1.PNG-e7e8cd4987cb591a558e4f25e568f40e.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /showcase/console10.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/showcase/console10.PNG -------------------------------------------------------------------------------- /showcase/console10.PNG.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/console10.PNG-0ad8aab84abd045649ac69803f044fc2.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://showcase/console10.PNG" 13 | dest_files=[ "res://.import/console10.PNG-0ad8aab84abd045649ac69803f044fc2.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /showcase/console2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/showcase/console2.PNG -------------------------------------------------------------------------------- /showcase/console2.PNG.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/console2.PNG-344fbe5c1a5722c6af4cec6908abd0d9.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://showcase/console2.PNG" 13 | dest_files=[ "res://.import/console2.PNG-344fbe5c1a5722c6af4cec6908abd0d9.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /showcase/console3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/showcase/console3.PNG -------------------------------------------------------------------------------- /showcase/console3.PNG.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/console3.PNG-a38974fc05cc89cba31c29e1f5bc824e.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://showcase/console3.PNG" 13 | dest_files=[ "res://.import/console3.PNG-a38974fc05cc89cba31c29e1f5bc824e.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /showcase/console4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/showcase/console4.PNG -------------------------------------------------------------------------------- /showcase/console4.PNG.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/console4.PNG-957c7e94debc61afaa469f6a86668667.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://showcase/console4.PNG" 13 | dest_files=[ "res://.import/console4.PNG-957c7e94debc61afaa469f6a86668667.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /showcase/console5.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/showcase/console5.PNG -------------------------------------------------------------------------------- /showcase/console5.PNG.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/console5.PNG-9db6909488434f088b55aa9becdd61b2.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://showcase/console5.PNG" 13 | dest_files=[ "res://.import/console5.PNG-9db6909488434f088b55aa9becdd61b2.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /showcase/console6.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/showcase/console6.PNG -------------------------------------------------------------------------------- /showcase/console6.PNG.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/console6.PNG-4d47c1c49903b78cdcc9471674258d5f.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://showcase/console6.PNG" 13 | dest_files=[ "res://.import/console6.PNG-4d47c1c49903b78cdcc9471674258d5f.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /showcase/console7.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/showcase/console7.PNG -------------------------------------------------------------------------------- /showcase/console7.PNG.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/console7.PNG-d639c38362085a7d5e9bc90121584031.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://showcase/console7.PNG" 13 | dest_files=[ "res://.import/console7.PNG-d639c38362085a7d5e9bc90121584031.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /showcase/console8.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/showcase/console8.PNG -------------------------------------------------------------------------------- /showcase/console8.PNG.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/console8.PNG-1eb3ad0080bd713744ad7a6f7104b202.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://showcase/console8.PNG" 13 | dest_files=[ "res://.import/console8.PNG-1eb3ad0080bd713744ad7a6f7104b202.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /showcase/console9.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/showcase/console9.PNG -------------------------------------------------------------------------------- /showcase/console9.PNG.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/console9.PNG-feea482cf6ce1ca77144f7e713a81220.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://showcase/console9.PNG" 13 | dest_files=[ "res://.import/console9.PNG-feea482cf6ce1ca77144f7e713a81220.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /showcase/consoleFront.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobrapitz/LinuxLikeConsole/9cac2cfae5b1a63fc57a1675d559aabf0be1a8a3/showcase/consoleFront.PNG -------------------------------------------------------------------------------- /showcase/consoleFront.PNG.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/consoleFront.PNG-1538835cc3523dce36786caef6f4dcbb.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://showcase/consoleFront.PNG" 13 | dest_files=[ "res://.import/consoleFront.PNG-1538835cc3523dce36786caef6f4dcbb.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | --------------------------------------------------------------------------------