Skip to content
Snippets Groups Projects
Verified Commit 54ae69a8 authored by McModder's avatar McModder :eggplant:
Browse files

explicit config save/reset buttons

parent d153d134
No related branches found
No related tags found
No related merge requests found
......@@ -458,3 +458,27 @@ text = "mcm_hide_live_shells"
[node name="Enabled" type="CheckBox" parent="MainBox/MainSubBox/OtherSettings/HideLiveShells"]
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 8
theme_override_constants/margin_right = 16
theme_override_constants/margin_bottom = 16
[node name="SaveResetButtonsBox" type="HBoxContainer" parent="MarginContainer"]
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 8
alignment = 2
[node name="ResetButton" type="Button" parent="MarginContainer/SaveResetButtonsBox"]
layout_mode = 2
text = "mcm_button_reset"
[node name="SaveButton" type="Button" parent="MarginContainer/SaveResetButtonsBox"]
layout_mode = 2
text = "mcm_button_save"
[connection signal="pressed" from="MarginContainer/SaveResetButtonsBox/ResetButton" to="." method="restoreConfig"]
[connection signal="pressed" from="MarginContainer/SaveResetButtonsBox/SaveButton" to="." method="saveConfig"]
......@@ -33,23 +33,21 @@ const MCM_MPO_CONFIG_CHECKBOX = {
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
# pass # Replace with function body.
currentConfig = ModLoaderConfig.get_current_config("McModder-MultiplayerOverhaul")
loadConfigToScene()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _exit_tree():
ModLoaderLog.info("_exit_tree called", MCM_MPO_CONFIG_LOG)
saveSceneToConfig()
ModLoaderLog.info("New config data: %s" % currentConfig.data, MCM_MPO_CONFIG_LOG)
ModLoaderConfig.update_config(currentConfig)
restoreConfig()
func apply_config(config: ModConfig) -> void:
ModLoaderLog.info("apply_config called", MCM_MPO_CONFIG_LOG)
currentConfig = config
loadConfigToScene()
func saveConfig():
saveSceneToConfig()
ModLoaderLog.info("New config data: %s" % currentConfig.data, MCM_MPO_CONFIG_LOG)
ModLoaderConfig.update_config(currentConfig)
func restoreConfig():
currentConfig = ModLoaderConfig.get_current_config("McModder-MultiplayerOverhaul")
loadConfigToScene()
func loadConfigToScene():
ModLoaderLog.info("Loading config to scene", MCM_MPO_CONFIG_LOG)
......
......@@ -24,3 +24,5 @@ mcm_expired_medicine,Expired Medicine,Просроченное лекарств
mcm_adrenaline,Adrenaline,Адреналин
mcm_inverter,Inverter,Инвертор
mcm_remote,Remote,Пульт
mcm_button_save,Save,Сохранить
mcm_button_reset,Reset,Сбросить
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment