mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 23:48:11 +00:00
added the game
This commit is contained in:
63
addons/mod_tool/interface/hook_gen/hook_gen.gd
Normal file
63
addons/mod_tool/interface/hook_gen/hook_gen.gd
Normal file
@@ -0,0 +1,63 @@
|
||||
@tool
|
||||
class_name ModToolInterfaceHookGen
|
||||
extends Window
|
||||
|
||||
|
||||
signal hooks_exist_pressed
|
||||
|
||||
@onready var mod_tool_store: ModToolStore = get_node_or_null("/root/ModToolStore")
|
||||
@onready var info_output: RichTextLabel = %InfoOutput
|
||||
@onready var restart: Window = %Restart
|
||||
@onready var button_gen_start: Button = %ButtonGenStart
|
||||
|
||||
|
||||
func generate_hooks() -> void:
|
||||
# Get all script not in addons or mods-unpacked
|
||||
var all_script_file_paths := ModToolUtils.get_flat_view_dict("res://", "", [&"gd"], false, false, [&"addons", &"mods-unpacked"])
|
||||
|
||||
for script_file_path in all_script_file_paths:
|
||||
if mod_tool_store.hooked_scripts.has(script_file_path):
|
||||
info_output.add_text("Skipping - Hooks already exists for \"%s\" \n" % script_file_path)
|
||||
continue
|
||||
|
||||
var error := ModToolHookGen.transform_one(script_file_path, mod_tool_store)
|
||||
|
||||
if not error == OK:
|
||||
info_output.add_text("ERROR: Accessing file at path \"%s\" failed with error: %s \n" % [script_file_path, error_string(error)])
|
||||
else:
|
||||
info_output.add_text("Added Hooks for \"%s\" \n" % script_file_path)
|
||||
|
||||
mod_tool_store.is_hook_generation_done = true
|
||||
info_output.add_text("Mod Hook generation completed successfully!\n")
|
||||
|
||||
mod_tool_store.save_store()
|
||||
restart.show()
|
||||
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
button_gen_start.disabled = true
|
||||
generate_hooks()
|
||||
|
||||
|
||||
func _on_close_requested() -> void:
|
||||
hide()
|
||||
|
||||
|
||||
func _on_button_restart_now_pressed() -> void:
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
EditorInterface.restart_editor()
|
||||
|
||||
|
||||
func _on_button_restart_later_pressed() -> void:
|
||||
restart.hide()
|
||||
hide()
|
||||
|
||||
|
||||
func _on_restart_close_requested() -> void:
|
||||
restart.hide()
|
||||
|
||||
|
||||
func _on_button_hooks_exist_pressed() -> void:
|
||||
mod_tool_store.is_hook_generation_done = true
|
||||
hooks_exist_pressed.emit()
|
||||
hide()
|
1
addons/mod_tool/interface/hook_gen/hook_gen.gd.uid
Normal file
1
addons/mod_tool/interface/hook_gen/hook_gen.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://j06uud1328hl
|
105
addons/mod_tool/interface/hook_gen/hook_gen.tscn
Normal file
105
addons/mod_tool/interface/hook_gen/hook_gen.tscn
Normal file
@@ -0,0 +1,105 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cpll5clcnemyj"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/mod_tool/interface/hook_gen/hook_gen.gd" id="1_lrahv"]
|
||||
|
||||
[node name="HookGen" type="Window"]
|
||||
title = "Mod Dev Tool"
|
||||
initial_position = 1
|
||||
size = Vector2i(640, 375)
|
||||
wrap_controls = true
|
||||
script = ExtResource("1_lrahv")
|
||||
|
||||
[node name="Restart" type="Window" parent="."]
|
||||
unique_name_in_owner = true
|
||||
title = "Mod Dev Tool"
|
||||
initial_position = 1
|
||||
size = Vector2i(440, 117)
|
||||
visible = false
|
||||
wrap_controls = true
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Restart"]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_bottom = 10
|
||||
|
||||
[node name="VBC" type="VBoxContainer" parent="Restart/MarginContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 20
|
||||
|
||||
[node name="LabelInfoText" type="RichTextLabel" parent="Restart/MarginContainer/VBC"]
|
||||
custom_minimum_size = Vector2(400, 0)
|
||||
layout_mode = 2
|
||||
text = "Successfully generated mod hooks.
|
||||
To start modding, a restart of the editor is required."
|
||||
fit_content = true
|
||||
|
||||
[node name="HBC" type="HBoxContainer" parent="Restart/MarginContainer/VBC"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_constants/separation = 30
|
||||
|
||||
[node name="ButtonRestartNow" type="Button" parent="Restart/MarginContainer/VBC/HBC"]
|
||||
layout_mode = 2
|
||||
text = "Restart Now"
|
||||
|
||||
[node name="ButtonRestartLater" type="Button" parent="Restart/MarginContainer/VBC/HBC"]
|
||||
layout_mode = 2
|
||||
text = "Restart Later"
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_bottom = 15
|
||||
|
||||
[node name="VBC" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 20
|
||||
|
||||
[node name="LabelInfoText" type="RichTextLabel" parent="MarginContainer/VBC"]
|
||||
custom_minimum_size = Vector2(600, 0)
|
||||
layout_mode = 2
|
||||
text = "This will modify all existing scripts in the project, so please make sure to save your files before continuing.
|
||||
|
||||
The process may take some time depending on the number of scripts."
|
||||
fit_content = true
|
||||
|
||||
[node name="VBC" type="VBoxContainer" parent="MarginContainer/VBC"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="ButtonGenStart" type="Button" parent="MarginContainer/VBC/VBC"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Generate mod hooks"
|
||||
|
||||
[node name="ButtonHooksExist" type="Button" parent="MarginContainer/VBC/VBC"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Hooks already exist"
|
||||
|
||||
[node name="VBC2" type="VBoxContainer" parent="MarginContainer/VBC"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 15
|
||||
|
||||
[node name="InfoOutput" type="RichTextLabel" parent="MarginContainer/VBC/VBC2"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(600, 100)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
scroll_following = true
|
||||
|
||||
[connection signal="close_requested" from="." to="." method="_on_close_requested"]
|
||||
[connection signal="close_requested" from="Restart" to="." method="_on_restart_close_requested"]
|
||||
[connection signal="pressed" from="Restart/MarginContainer/VBC/HBC/ButtonRestartNow" to="." method="_on_button_restart_now_pressed"]
|
||||
[connection signal="pressed" from="Restart/MarginContainer/VBC/HBC/ButtonRestartLater" to="." method="_on_button_restart_later_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/VBC/VBC/ButtonGenStart" to="." method="_on_button_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/VBC/VBC/ButtonHooksExist" to="." method="_on_button_hooks_exist_pressed"]
|
Reference in New Issue
Block a user