added the game

This commit is contained in:
JHDev2006
2025-09-13 16:30:32 +01:00
parent 5ef689109b
commit 3773bdaf64
3616 changed files with 263702 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
@tool
class_name ModToolInterfaceHookRestore
extends Window
@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_restore_start: Button = %ButtonRestoreStart
func start_restore() -> 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"])
var encountered_error := false
for script_path in mod_tool_store.hooked_scripts.keys():
var error := ModToolHookGen.restore(script_path, mod_tool_store)
if not error == OK:
encountered_error = true
info_output.add_text("ERROR: Accessing file at path \"%s\" failed with error: %s \n" % [script_path, error_string(error)])
break
info_output.add_text("Restored \"%s\" \n" % script_path)
if encountered_error:
info_output.add_text("ERROR: Restore aborted.\n")
else:
mod_tool_store.is_hook_generation_done = false
info_output.add_text("Restore completed successfully!\n")
mod_tool_store.save_store()
restart.show()
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_restore_start_pressed() -> void:
button_restore_start.disabled = true
start_restore()

View File

@@ -0,0 +1 @@
uid://dy72tnwnjxxpb

View File

@@ -0,0 +1,100 @@
[gd_scene load_steps=2 format=3 uid="uid://camcc83bvu086"]
[ext_resource type="Script" path="res://addons/mod_tool/interface/hook_restore/hook_restore.gd" id="1_wq3ld"]
[node name="HookRestore" type="Window"]
title = "Mod Dev Tool"
initial_position = 1
size = Vector2i(640, 375)
wrap_controls = true
script = ExtResource("1_wq3ld")
[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
alignment = 1
[node name="LabelInfoText" type="RichTextLabel" parent="Restart/MarginContainer/VBC"]
custom_minimum_size = Vector2(400, 0)
layout_mode = 2
text = "Successfully restored all scripts.
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 restore all scripts to their state before mod hooks were added. Any changes made to these scripts will be lost!
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="ButtonRestoreStart" type="Button" parent="MarginContainer/VBC/VBC"]
unique_name_in_owner = true
layout_mode = 2
text = "Start Restore"
[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/ButtonRestoreStart" to="." method="_on_button_restore_start_pressed"]