├── .gitattributes ├── .gitignore ├── LICENSE └── addons └── godottoolkit ├── LICENSE ├── icon.png ├── icon.png.import ├── plugin.cfg ├── plugin.gd └── toolkit.gd /.gitattributes: -------------------------------------------------------------------------------- 1 | # Normalize EOL for all files that Git considers text files. 2 | * text=auto eol=lf 3 | 4 | design/ export-ignore 5 | LICENSE.md export-ignore 6 | project.godot export-ignore 7 | README.md export-ignore 8 | dev.gd export-ignore 9 | dev.tscn export-ignore 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Godot 4+ specific ignores 2 | .godot/ 3 | 4 | # Godot-specific ignores 5 | .import/ 6 | export.cfg 7 | export_presets.cfg 8 | 9 | # Imported translations (automatically generated from CSV files) 10 | *.translation 11 | 12 | # Mono-specific ignores 13 | .mono/ 14 | data_*/ 15 | mono_crash.*.json 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Joe Highton 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /addons/godottoolkit/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Joe Highton 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /addons/godottoolkit/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sirjoehighton/GodotToolkit/9bb70ac8b693484e42414a202a1d6f31979861b3/addons/godottoolkit/icon.png -------------------------------------------------------------------------------- /addons/godottoolkit/icon.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://bkk7ev4h527eb" 6 | path="res://.godot/imported/icon.png-06b46d8bd715669aebf388fa923c34aa.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://addons/godottoolkit/icon.png" 14 | dest_files=["res://.godot/imported/icon.png-06b46d8bd715669aebf388fa923c34aa.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | -------------------------------------------------------------------------------- /addons/godottoolkit/plugin.cfg: -------------------------------------------------------------------------------- 1 | [plugin] 2 | 3 | name="GodotToolkit" 4 | description="" 5 | author="SirJoe" 6 | version="1.0.1" 7 | script="plugin.gd" 8 | -------------------------------------------------------------------------------- /addons/godottoolkit/plugin.gd: -------------------------------------------------------------------------------- 1 | @tool 2 | extends EditorPlugin 3 | 4 | func _enter_tree() -> void: 5 | add_autoload_singleton("Toolkit","res://addons/godottoolkit/toolkit.gd") 6 | 7 | func _exit_tree() -> void: 8 | remove_autoload_singleton("Toolkit") 9 | -------------------------------------------------------------------------------- /addons/godottoolkit/toolkit.gd: -------------------------------------------------------------------------------- 1 | extends Node 2 | 3 | var error_dictionary : Dictionary = { 4 | 0: {"name": "Ok", "description": "All systems go! No errors found here."}, 5 | 1: {"name": "Failed", "description": "Oops, something went wrong."}, 6 | 2: {"name": "Unavailable", "description": "The resource you're looking for isn't available."}, 7 | 3: {"name": "Unconfigured", "description": "Uh-oh, the setup isn't complete. Make sure you can configure this thing correctly."}, 8 | 4: {"name": "Unauthorized", "description": "You're not allowed to be in here!"}, 9 | 5: {"name": "Parameter Range Error", "description": "Whoa there! That parameter's out of range."}, 10 | 6: {"name": "Out of Memory", "description": "Running out of memory, time to do some cleanup!"}, 11 | 7: {"name": "File Not Found", "description": "Oh no! No file was found."}, 12 | 8: {"name": "File Bad Drive", "description": "Yikes! Bad drive error."}, 13 | 9: {"name": "File Bad Path", "description": "That path? Nope, doesn’t work."}, 14 | 10: {"name": "File No Permission", "description": "Access denied! You need permission to enter here."}, 15 | 11: {"name": "File Already in Use", "description": "No backseat driving! This file's already in use."}, 16 | 12: {"name": "File Can't Open", "description": "Can't seem to open that file."}, 17 | 13: {"name": "File Can't Write", "description": "Nope, can't write to that file."}, 18 | 14: {"name": "File Can't Read", "description": "It's all blurry! We can't read that file!"}, 19 | 15: {"name": "File Unrecognized", "description": "That file type? It's not recognized arround here."}, 20 | 16: {"name": "File Corrupt", "description": "Yikes, that file's corrupt!"}, 21 | 17: {"name": "File Missing Dependencies", "description": "Who misplaced these? We seem to be missing dependencies!"}, 22 | 18: {"name": "File EOF", "description": "End of file reached. That's all folks, that's a wrap!"}, 23 | 19: {"name": "Can't Open", "description": "Can't open this. What a bummer."}, 24 | 20: {"name": "Can't Create", "description": "Trying to create that? Nope can't do it."}, 25 | 21: {"name": "Query Failed", "description": "Query didn't go through. Try again!"}, 26 | 22: {"name": "Already in Use", "description": "It's busy! Seems to be already in use."}, 27 | 23: {"name": "Locked", "description": "Locked up tight, access denied."}, 28 | 24: {"name": "Timeout", "description": "Oops, timed out! Try again."}, 29 | 25: {"name": "Can't Connect", "description": "Can't connect to that connection."}, 30 | 26: {"name": "Can't Resolve", "description": "Can't resolve that. We should give it another shot!"}, 31 | 27: {"name": "Connection Error", "description": "Someone unplugged the network, connection error!"}, 32 | 28: {"name": "Can't Acquire Resource", "description": "Can't grab that resource right now."}, 33 | 29: {"name": "Can't Fork", "description": "Can't fork this process, what gives?"}, 34 | 30: {"name": "Invalid Data", "description": "Data looks invalid to me!"}, 35 | 31: {"name": "Invalid Parameter", "description": "Bad parameter! You should fix that up."}, 36 | 32: {"name": "Already Exists", "description": "That already exists. Try something else!"}, 37 | 33: {"name": "Does Not Exist", "description": "Sorry to say but that doesn't exist."}, 38 | 34: {"name": "Database Can't Read", "description": "Can't read from the database, Uh-oh!"}, 39 | 35: {"name": "Database Can't Write", "description": "Can't write to the database. Uh-oh!"}, 40 | 36: {"name": "Compilation Failed", "description": "Compilation failed."}, 41 | 37: {"name": "Method Not Found", "description": "Where'd that method go? Can't seem to find it anywhere."}, 42 | 38: {"name": "Link Failed", "description": "Linking failed. Let's try that again."}, 43 | 39: {"name": "Script Failed", "description": "Script didn't run. What happened?"}, 44 | 40: {"name": "Cyclic Link", "description": "Whoa! Cyclic link error."}, 45 | 41: {"name": "Invalid Declaration", "description": "That declaration? Sorry, it's invalid!"}, 46 | 42: {"name": "Duplicate Symbol", "description": "Duplicate symbol. You gotta make it unique!"}, 47 | 43: {"name": "Parse Error", "description": "Parse error. Something's off here."}, 48 | 44: {"name": "Busy", "description": "It's busy! Hold on."}, 49 | 45: {"name": "Skip", "description": "Seems we are skipping that action!"}, 50 | 46: {"name": "Help", "description": "I think it needs help, Send in the Medics!"}, 51 | 47: {"name": "Bug", "description": "Uh-oh, there's a bug; make sure to squash it!"}, 52 | 48: {"name": "Printer on Fire", "description": "Whoa! The Printer's on fire call the Fire Department. (Just kidding this one's an easter egg)"}, 53 | } 54 | 55 | var http_result_code_dictionary : Dictionary = { 56 | 0: {"name": "Success", "description": "Request successful."}, 57 | 1: {"name": "Chunked Body Size Mismatch", "description": "Chunked Body Size Mismatch."}, 58 | 2: {"name": "Can`t Connect", "description": "Request failed while connecting."}, 59 | 3: {"name": "Can`t Resolve", "description": "Request failed while resolving."}, 60 | 4: {"name": "Conection Error", "description": "Request failed due to connection (read/write) error."}, 61 | 5: {"name": "TLS Handshake Error", "description": "Request failed on TLS handshake."}, 62 | 6: {"name": "No Response", "description": "Request does not have a response (yet)."}, 63 | 7: {"name": "Body Size Limit Exceeded", "description": "Request exceeded its maximum size limit."}, 64 | 8: {"name": "Body Decompress Failed", "description": "Body Decompress Failed."}, 65 | 9: {"name": "Request Failed", "description": "Request failed."}, 66 | 10: {"name": "Download File Can't Open", "description": "HTTPRequest couldn't open the download file."}, 67 | 11: {"name": "Download File Write Error", "description": "HTTPRequest couldn't write to the download file."}, 68 | 12: {"name": "Redirect Limit Reached", "description": "Request reached its maximum redirect limit."}, 69 | 13: {"name": "Timeout", "description": "Request failed due to a timeout."}, 70 | } 71 | 72 | ## For Converting Strings to Booleans 73 | func string_to_bool(INPUT : String) -> bool: 74 | var str = INPUT.strip_edges().to_lower() 75 | if str in ["true", "1", "yes"]: 76 | return true 77 | elif str in ["false", "0", "no"]: 78 | return false 79 | else: 80 | push_error("Invalid String To Boolean: " + INPUT) 81 | return false 82 | 83 | ## For Easily Logging Input's & Outputs 84 | func input_and_output_log(INPUT,OUTPUT): 85 | print("INPUT : ",type_string(typeof(INPUT))," = ",str(INPUT)," | OUTPUT : ",type_string(typeof(OUTPUT))," = ",str(OUTPUT)) 86 | 87 | ## For Looking up Error Code Names & Descriptions 88 | func error_lookup(ERROR_CODE : int) -> Dictionary: 89 | if ERROR_CODE in error_dictionary: 90 | return error_dictionary[ERROR_CODE] 91 | else: 92 | return {"name": "ERR_UNKNOWN", "description": "No description available."} 93 | 94 | ## For Looking up HTTP Result Code Names & Descriptions 95 | func http_result_code_lookup(RESULT_CODE : int) -> Dictionary: 96 | if RESULT_CODE in http_result_code_dictionary: 97 | return http_result_code_dictionary[RESULT_CODE] 98 | else: 99 | return {"name": "RESULT_UNKNOWN", "description": "No description available."} 100 | 101 | ## For making awaitable GET requests in one line of code 102 | func http_get_request(url: String, custom_headers: PackedStringArray = PackedStringArray()) -> Dictionary: 103 | if not url: 104 | push_error("HTTPRequest URL Error: URL can't be empty") 105 | return {} 106 | var http = HTTPRequest.new() 107 | get_tree().root.call_deferred("add_child", http) 108 | await http.tree_entered 109 | var err = http.request(url, custom_headers) 110 | var response = await http.request_completed 111 | var parsed_dict = { 112 | "result": response[0], 113 | "response_code": response[1], 114 | "headers": response[2], 115 | "body": response[3], 116 | "json_body": JSON.parse_string(response[3].get_string_from_utf8()) 117 | } 118 | http.queue_free() 119 | if err != OK: 120 | var error = error_lookup(err) 121 | var error_msg = "HTTPRequest %s: %s" % [error.name, error.description] 122 | push_error(error_msg) 123 | if parsed_dict.result != OK: 124 | var result_lookup = http_result_code_lookup(parsed_dict.result) 125 | var result_msg = "HTTPRequest %s: %s" % [result_lookup.name, result_lookup.description] 126 | push_error(result_msg) 127 | return parsed_dict 128 | 129 | ## For making awaitable POST requests in one line of code 130 | func http_post_request(url: String, custom_headers: PackedStringArray = PackedStringArray(), payload: String = "") -> Dictionary: 131 | if not url: 132 | push_error("HTTPRequest URL Error: URL can't be empty") 133 | return {} 134 | var http = HTTPRequest.new() 135 | get_tree().root.call_deferred("add_child", http) 136 | await http.tree_entered 137 | var err = http.request(url, custom_headers, HTTPClient.METHOD_POST, payload) 138 | var response = await http.request_completed 139 | var parsed_dict = { 140 | "result": response[0], 141 | "response_code": response[1], 142 | "headers": response[2], 143 | "body": response[3], 144 | "json_body": JSON.parse_string(response[3].get_string_from_utf8()) 145 | } 146 | http.queue_free() 147 | if err != OK: 148 | var error = error_lookup(err) 149 | var error_msg = "HTTPRequest %s: %s" % [error.name, error.description] 150 | push_error(error_msg) 151 | if parsed_dict.result != OK: 152 | var result_lookup = http_result_code_lookup(parsed_dict.result) 153 | var result_msg = "HTTPRequest %s: %s" % [result_lookup.name, result_lookup.description] 154 | push_error(result_msg) 155 | return parsed_dict 156 | 157 | ## For setting the volume of the corrosponding audio bus name 158 | func set_audio_bus_volume(AUDIO_BUS_NAME : String, VOLUME_DB : float): 159 | AudioServer.set_bus_volume_db(AudioServer.get_bus_index(AUDIO_BUS_NAME), VOLUME_DB) 160 | 161 | ## For setting the current windowed window on the current screen is sat on to the center of that specific screen. 162 | func center_window_to_screen(): 163 | var DisplayScreenSize = DisplayServer.screen_get_size(DisplayServer.window_get_current_screen()) 164 | var DisplayWindowSize = DisplayServer.window_get_size() 165 | DisplayServer.window_set_position(Vector2i(DisplayScreenSize.x - DisplayWindowSize.x, DisplayScreenSize.y - DisplayWindowSize.y) / 2) 166 | --------------------------------------------------------------------------------