From f77e1510cf348979df7314979318ecfba7fd8730 Mon Sep 17 00:00:00 2001 From: JHDev2006 Date: Sun, 19 Oct 2025 21:31:09 +0100 Subject: [PATCH] fixed bumpers crashing, and FINALLY HAVE SORTED RESOURCE PACK EXTRACTION, ONLY TOOK BEING ABLE TO DOWNLOAD SOME OF THE FILES FROM THE FUCKING GITHUB TO WORK YEAAAAAAAAAAAAAA I LOVE GODOT --- Scenes/Prefabs/UI/SettingsMenu.tscn | 2 +- Scripts/Classes/Entities/Objects/Bumper.gd | 4 +- Scripts/Parts/ResourcePackTemplateCreator.gd | 47 ++++++++++++++++---- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/Scenes/Prefabs/UI/SettingsMenu.tscn b/Scenes/Prefabs/UI/SettingsMenu.tscn index 414cae3..b4c1205 100644 --- a/Scenes/Prefabs/UI/SettingsMenu.tscn +++ b/Scenes/Prefabs/UI/SettingsMenu.tscn @@ -447,7 +447,7 @@ size_flags_vertical = 3 theme_override_constants/separation = -4 script = ExtResource("4_avtty") category_name = "SETTINGS_VISUALS" -options = [NodePath("ParallaxStyle"), NodePath("BGParticles"), NodePath("HUDStyle"), NodePath("RainbowEffect"), NodePath("TransformationEffect"), NodePath("TextShadows"), NodePath("BridgeDestructionAnimation"), NodePath("VisibleTimers"), NodePath("TransitionAnimation"), NodePath(""), NodePath("ColourfulPipes"), NodePath("FirebarStyle"), NodePath("ExtraParticles")] +options = [NodePath("ParallaxStyle"), NodePath("BGParticles"), NodePath("HUDStyle"), NodePath("RainbowEffect"), NodePath("TransformationEffect"), NodePath("TextShadows"), NodePath("BridgeDestructionAnimation"), NodePath("VisibleTimers"), NodePath("TransitionAnimation"), null, NodePath("ColourfulPipes"), NodePath("FirebarStyle"), NodePath("ExtraParticles")] [node name="Control" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer/Visuals"] custom_minimum_size = Vector2(0, 4) diff --git a/Scripts/Classes/Entities/Objects/Bumper.gd b/Scripts/Classes/Entities/Objects/Bumper.gd index 5cf6296..a94c91e 100644 --- a/Scripts/Classes/Entities/Objects/Bumper.gd +++ b/Scripts/Classes/Entities/Objects/Bumper.gd @@ -32,7 +32,7 @@ func bounce_player(player: Player) -> void: $Sprite.play("Idle") func refresh_hitbox() -> void: - $Hitbox/CollisionShape2D.set_deferred("disabled", true) + $PlayerDetection/CollisionShape2D.set_deferred("disabled", true) await get_tree().physics_frame - $Hitbox/CollisionShape2D.set_deferred("disabled", false) + $PlayerDetection/CollisionShape2D.set_deferred("disabled", false) diff --git a/Scripts/Parts/ResourcePackTemplateCreator.gd b/Scripts/Parts/ResourcePackTemplateCreator.gd index e568e42..c6fe693 100644 --- a/Scripts/Parts/ResourcePackTemplateCreator.gd +++ b/Scripts/Parts/ResourcePackTemplateCreator.gd @@ -3,6 +3,10 @@ extends Node var files := [] var directories := [] +signal fnt_file_downloaded(text: String) + +var downloaded_fnt_text := [] + const base_info_json := { "name": "New Pack", "description": "Template, give me a description!", @@ -19,14 +23,26 @@ func create_template() -> void: destination = i.replace("res://Assets", Global.config_path.path_join("resource_packs/new_pack")) else: destination = i.replace(Global.config_path.path_join("resource_packs/BaseAssets"), Global.config_path.path_join("resource_packs/new_pack")) - print("Copying '" + i + "' to: '" + destination) - var old_file = FileAccess.open(i, FileAccess.READ) - if old_file != null: - var new_file = FileAccess.open(destination, FileAccess.WRITE) - new_file.store_buffer(old_file.get_buffer(old_file.get_length())) + var data = [] + if i.contains(".fnt"): + data = await download_fnt_text(i) + ## Imagine being one of the best open source game engines, yet not able to get the FUCKING CONTENTS + ## OF AN FNT FILE SO INSTEAD YOU HAVE TO WRITE THE MOST BULLSHIT CODE TO DOWNLOAD THE FUCKING FILE + ## FROM THE FUCKING GITHUB REPO. WHY? BECAUSE GODOT IS SHIT. FUCK GODOT. + elif i.contains(".bgm") == false and i.contains(".ctex") == false and i.contains(".json") == false and i.contains("res://") and i.contains(".fnt") == false: + var resource = load(i) + if resource is Texture: + data = resource.get_image().save_png_to_buffer() + elif resource is AudioStream: + data = resource.get_data() + else: + var old_file = FileAccess.open(i, FileAccess.READ) + data = old_file.get_buffer(old_file.get_length()) old_file.close() - new_file.close() - + + var new_file = FileAccess.open(destination, FileAccess.WRITE) + new_file.store_buffer(data) + new_file.close() var pack_info_path = Global.config_path.path_join("resource_packs/new_pack/pack_info.json") DirAccess.make_dir_recursive_absolute(pack_info_path.get_base_dir()) @@ -35,9 +51,24 @@ func create_template() -> void: file.close() print("Done") +func download_fnt_text(file_path := "") -> PackedByteArray: + var http = HTTPRequest.new() + const GITHUB_URL = "https://raw.githubusercontent.com/JHDev2006/Super-Mario-Bros.-Remastered-Public/refs/heads/main/" + var url = GITHUB_URL + file_path.replace("res://", "") + add_child(http) + http.request_completed.connect(file_downloaded) + http.request(url, [], HTTPClient.METHOD_GET) + await fnt_file_downloaded + http.queue_free() + return downloaded_fnt_text + +func file_downloaded(result: int, response_code: int, headers: PackedStringArray, body: PackedByteArray) -> void: + downloaded_fnt_text = body + fnt_file_downloaded.emit(downloaded_fnt_text) + func get_directories(base_dir := "", files := [], directories := []) -> void: for i in DirAccess.get_directories_at(base_dir): - if base_dir.contains("LevelGuides") == false: + if base_dir.contains("LevelGuides") == false and base_dir.contains(".godot") == false: directories.append(base_dir + "/" + i) get_directories(base_dir + "/" + i, files, directories) get_files(base_dir + "/" + i, files)