diff --git a/.github/release.yml b/.github/release.yml index a3f33ac57..fbe9714e3 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -34,6 +34,9 @@ changelog: - title: SDK labels: - "Topic: SDK" + - title: Modifications + labels: + - "Topic: Modifications" - title: Linux labels: - "OS: Linux" diff --git a/Scripts/Globals.gd b/Scripts/Globals.gd index 5d6b86854..946083320 100644 --- a/Scripts/Globals.gd +++ b/Scripts/Globals.gd @@ -383,6 +383,7 @@ func scan_and_load_modifications_cfg(): tmp["author"] = cfg.get_value("mod_info", "author", "author") tmp["description"] = cfg.get_value("mod_info", "description") tmp["pck_files"] = cfg.get_value("mod_info", "pck_files") + tmp["supported_game_versions"] = cfg.get_value("game_info", "supported_versions") tmp["enabled"] = "True" #cfg.get_value("mod_info", "enabled", "True") tmp["sdk_version"] = cfg.get_value("sdk_info", "version") tmp["main_script_file"] = cfg.get_value("mod_info", "main_script_file") @@ -409,14 +410,15 @@ func load_modification(mod_name): if mod["enabled"] == "True": print(mod["sdk_version"]) print(str(supported_sdk_versions.has(int(mod["sdk_version"])))) - if supported_sdk_versions.has(int(mod["sdk_version"])): + var f = File.new() + f.open("res://version.dat", File.READ) + if supported_sdk_versions.has(int(mod["sdk_version"])) and Array(mod["supported_game_versions"]).has(f.get_line()): for i in mod["pck_files"]: print("Loading: " + OS.get_system_dir(OS.SYSTEM_DIR_DOCUMENTS) + "/New DEV/Foxy Adventure/Mods/" + i) ProjectSettings.load_resource_pack(OS.get_system_dir(OS.SYSTEM_DIR_DOCUMENTS) + "/New DEV/Foxy Adventure/Mods/" + i) var main_script = load(mod["main_script_file"]).new() print("Loading mod") main_script.init_mod() - dir_contents('res://more_music/') else: print(mod["name"] + " - " + "That modification uses unsupported SDK version") OS.alert(mod["name"] + " - " + "That modification uses unsupported SDK version", "Warning") @@ -424,7 +426,8 @@ func load_modification(mod_name): func load_stage_from_editor(stage_name:String, character:String): pass - +func _check_mod_game_version_support(mod_cfg_path): + pass func load_dlcs(): diff --git a/addons/foxyadventure_modcreator/Dock.gd b/addons/foxyadventure_modcreator/Dock.gd index 263de7c7b..a3a5a147a 100644 --- a/addons/foxyadventure_modcreator/Dock.gd +++ b/addons/foxyadventure_modcreator/Dock.gd @@ -8,8 +8,12 @@ extends Control onready var sdk = preload("res://bin/sdk/sdk.gdns").new() # Called when the node enters the scene tree for the first time. +func _init(): + _ready() func _ready(): - pass # Replace with function body. + var f = File.new() + f.open("res://version.dat", File.READ) + $VBoxContainer/game_versions.text = "[" + f.get_line() + "]" # Called every frame. 'delta' is the elapsed time since the previous frame. @@ -27,7 +31,10 @@ func _on_Generate_pressed(): if not $VBoxContainer/pck_files.text.length() == 0: cfg.set_value("mod_info", "pck_files", $VBoxContainer/pck_files.text) cfg.set_value("mod_info", 'enabled', str(false)) - cfg.set_value("mod_info", "main_script_file", $VBoxContainer/main_script_file.text) + cfg.set_value("mod_info", "main_script_file", $VBoxContainer/HBoxContainer/main_script_file.text) + cfg.set_value("game_info", "supported_versions", $VBoxContainer/game_versions.text) + cfg.set_value("game_info", "support_lover_versions", str($VBoxContainer/l_v_support.pressed)) + cfg.set_value("game_info", "support_higher_versions", str($VBoxContainer/h_v_support.pressed)) cfg.set_value("sdk_info", "version", sdk.get_version()) print("Generating " + "res://" + mod_name.to_lower().replace(' ', '_') + ".cfg" + "...") cfg.save("res://" + mod_name.to_lower().replace(' ', '_') + ".cfg") @@ -36,3 +43,11 @@ func _on_Generate_pressed(): file.store_line(mod_name.to_lower().replace(' ', '_') + ".cfg") print("Generated!") file.close() + + +func _on_SelectMainScriptFile_pressed(): + $GdDialog.popup_centered() + + +func _on_GdDialog_file_selected(path): + $VBoxContainer/HBoxContainer/main_script_file.text = path diff --git a/addons/foxyadventure_modcreator/Dock.tscn b/addons/foxyadventure_modcreator/Dock.tscn index 1dfa92d4f..d1184f10b 100644 --- a/addons/foxyadventure_modcreator/Dock.tscn +++ b/addons/foxyadventure_modcreator/Dock.tscn @@ -18,42 +18,89 @@ anchor_bottom = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 alignment = 1 +__meta__ = { +"_edit_use_anchors_": false +} [node name="name" type="LineEdit" parent="VBoxContainer"] -margin_top = 220.0 +margin_top = 206.0 margin_right = 1024.0 -margin_bottom = 244.0 +margin_bottom = 230.0 placeholder_text = "Name" [node name="author" type="LineEdit" parent="VBoxContainer"] -margin_top = 248.0 +margin_top = 234.0 margin_right = 1024.0 -margin_bottom = 272.0 +margin_bottom = 258.0 placeholder_text = "Author" [node name="description" type="LineEdit" parent="VBoxContainer"] -margin_top = 276.0 +margin_top = 262.0 margin_right = 1024.0 -margin_bottom = 300.0 +margin_bottom = 286.0 placeholder_text = "Description" -[node name="main_script_file" type="LineEdit" parent="VBoxContainer"] -margin_top = 304.0 +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] +margin_top = 290.0 margin_right = 1024.0 -margin_bottom = 328.0 +margin_bottom = 314.0 + +[node name="main_script_file" type="LineEdit" parent="VBoxContainer/HBoxContainer"] +margin_right = 945.0 +margin_bottom = 24.0 +size_flags_horizontal = 3 placeholder_text = "Main Script File" +[node name="SelectMainScriptFile" type="Button" parent="VBoxContainer/HBoxContainer"] +margin_left = 949.0 +margin_right = 1024.0 +margin_bottom = 24.0 +text = "Select file" + [node name="pck_files" type="LineEdit" parent="VBoxContainer"] -margin_top = 332.0 +margin_top = 318.0 +margin_right = 1024.0 +margin_bottom = 342.0 +placeholder_text = "PCK Files (will be autogenerated if blank)" + +[node name="game_versions" type="LineEdit" parent="VBoxContainer"] +margin_top = 346.0 margin_right = 1024.0 -margin_bottom = 356.0 -placeholder_text = "PCK Files" +margin_bottom = 370.0 +text = "[v0.2.3]" +placeholder_text = "Supported game version(s)" + +[node name="l_v_support" type="CheckBox" parent="VBoxContainer"] +visible = false +margin_top = 346.0 +margin_right = 1024.0 +margin_bottom = 370.0 +text = "Support lover versions" + +[node name="h_v_support" type="CheckBox" parent="VBoxContainer"] +visible = false +margin_top = 360.0 +margin_right = 1024.0 +margin_bottom = 384.0 +text = "Support higher versions" [node name="Generate" type="Button" parent="VBoxContainer"] pause_mode = 2 -margin_top = 360.0 +margin_top = 374.0 margin_right = 1024.0 -margin_bottom = 380.0 +margin_bottom = 394.0 text = "Generate .cfg file" +[node name="GdDialog" type="FileDialog" parent="."] +visible = true +margin_right = 767.0 +margin_bottom = 460.0 +rect_min_size = Vector2( 150, 52.5 ) +window_title = "Otwórz plik" +mode = 0 +filters = PoolStringArray( "*.gd ; GDScript Script", "*.py; Python Script" ) +show_hidden_files = true + +[connection signal="pressed" from="VBoxContainer/HBoxContainer/SelectMainScriptFile" to="." method="_on_SelectMainScriptFile_pressed"] [connection signal="pressed" from="VBoxContainer/Generate" to="." method="_on_Generate_pressed"] +[connection signal="file_selected" from="GdDialog" to="." method="_on_GdDialog_file_selected"] diff --git a/name.cfg b/name.cfg new file mode 100644 index 000000000..44896f9b0 --- /dev/null +++ b/name.cfg @@ -0,0 +1,17 @@ +[mod_info] + +author="dd" +name="name" +description="dd" +enabled="False" +main_script_file="res://markdown_processor/markdown_processor.gd" + +[game_info] + +supported_versions="[v0.2.3]" +support_lover_versions="False" +support_higher_versions="True" + +[sdk_info] + +version=121 diff --git a/project.godot b/project.godot index e551d1aca..79f61afb3 100644 --- a/project.godot +++ b/project.godot @@ -266,7 +266,7 @@ window/per_pixel_transparency/enabled=true [editor_plugins] -enabled=PoolStringArray( "res://addons/github_issues_bugtracker/plugin.cfg", "res://addons/godot-firebase/plugin.cfg", "res://addons/quentincaffeino-console/plugin.cfg", "res://addons/rpg_text_boxes/plugin.cfg", "res://addons/terminal/plugin.cfg" ) +enabled=PoolStringArray( "res://addons/foxyadventure_modcreator/plugin.cfg", "res://addons/github_issues_bugtracker/plugin.cfg", "res://addons/godot-firebase/plugin.cfg", "res://addons/quentincaffeino-console/plugin.cfg", "res://addons/rpg_text_boxes/plugin.cfg", "res://addons/terminal/plugin.cfg" ) [editors] diff --git a/version.dat b/version.dat index b78946bb1..20d66a3f6 100644 --- a/version.dat +++ b/version.dat @@ -1 +1 @@ -v0.2.3 \ No newline at end of file +v0.2.3.1