1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
# Hurry Curry! - a game about cooking
# Copyright 2024 metamuffin
# Copyright 2024 tpart
# Copyright 2024 nokoe
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, version 3 of the License only.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
extends Node
class_name Settings
static func get_root():
return SettingsRoot.new([
SettingsCategory.new("gameplay", [
ToggleSetting.new("interpolate_camera_rotation", false),
ToggleSetting.new("invert_camera", false),
ToggleSetting.new("usernames", true),
ToggleSetting.new("setup_complete", false),
ToggleSetting.new("tutorial_started", false),
ToggleSetting.new("latch_boost", true),
]),
SettingsCategory.new("graphics", [
PresetRow.new("preset", {
"low": {
"ui_blur": true,
"aa": 0,
"ssao": false,
"taa": false,
"shadows": false,
"glow": false,
"grass_amount": 0,
"lq_trees": true
},
"medium": {
"ui_blur": true,
"aa": 1,
"ssao": false,
"taa": false,
"shadows": true,
"glow": false,
"grass_amount": 0,
"lq_trees": false
},
"high": {
"ui_blur": true,
"aa": 2,
"ssao": true,
"taa": false,
"shadows": true,
"glow": true,
"grass_amount": 16,
"lq_trees": false
}
}),
DropdownSetting.new("fullscreen", "keep", ["keep", "always", "never"]),
DropdownSetting.new("aa", "ms2x" if Global.on_high_end() else "disabled", ["disabled", "fx", "ms2x", "ms4x"]),
ToggleSetting.new("ssao", true if Global.on_high_end() else false),
ToggleSetting.new("taa", false),
DropdownSetting.new("gi", "disabled", ["disabled", "sdfgi", "voxelgi"]),
ToggleSetting.new("shadows", true if Global.on_high_end() else false),
ToggleSetting.new("glow", true if Global.on_high_end() else false),
RangeSetting.new("grass_amount", 16 if Global.on_high_end() else 0, 0, 32, false),
ToggleSetting.new("lq_trees", false if Global.on_high_end() else true),
ToggleSetting.new("debug_info", false),
ToggleSetting.new("ui_blur", true)
]),
SettingsCategory.new("audio", [
RangeSetting.new("master_volume", 0, -30, 0),
RangeSetting.new("music_volume", 0, -30, 0),
RangeSetting.new("sfx_volume", 0, -30, 0),
]),
SettingsCategory.new("ui", [
DropdownSetting.new("touch_controls", 0, ["automatic", "enabled", "disabled"]),
DropdownSetting.new("language", "system", Global.languages.map(func(e): return e[1])),
DropdownSetting.new("ui_scale_mode", "resize", ["resize", "disabled"]),
RangeSetting.new("ui_scale_factor", 1. if not Global.on_mobile() else 1.5, 0.5, 1.5, 3),
]),
SettingsCategory.new("input",
InputManager.input_map_to_settings(InputManager.default_input_map)
),
SettingsCategory.new("other", [
TextSetting.new("server_binary", ""),
TextSetting.new("server_data", ""),
])
])
static func hook_changed(key: String, callable):
change_hooks[key] = callable
static var change_hooks = {
"graphics.aa": h_aa,
"graphics.taa": h_taa,
}
static func h_aa(mode):
match mode:
"disabled":
Global.get_viewport().msaa_2d = Viewport.MSAA_DISABLED
Global.get_viewport().msaa_3d = Viewport.MSAA_DISABLED
Global.get_viewport().screen_space_aa = Viewport.SCREEN_SPACE_AA_DISABLED
"fx":
Global.get_viewport().msaa_2d = Viewport.MSAA_DISABLED
Global.get_viewport().msaa_3d = Viewport.MSAA_DISABLED
Global.get_viewport().screen_space_aa = Viewport.SCREEN_SPACE_AA_FXAA
"ms2x":
Global.get_viewport().msaa_2d = Viewport.MSAA_2X
Global.get_viewport().msaa_3d = Viewport.MSAA_2X
Global.get_viewport().screen_space_aa = Viewport.SCREEN_SPACE_AA_DISABLED
"ms4x":
Global.get_viewport().msaa_2d = Viewport.MSAA_4X
Global.get_viewport().msaa_3d = Viewport.MSAA_4X
Global.get_viewport().screen_space_aa = Viewport.SCREEN_SPACE_AA_DISABLED
static func h_taa(enabled):
Global.get_viewport().use_taa = enabled
# func apply_settings():
# update_fullscreen()
# update_language()
# # Temporal Anti-aliasing
# # UI scale mode
# match get_setting("ui_scale_mode"):
# 0:
# get_tree().root.content_scale_mode = Window.CONTENT_SCALE_MODE_CANVAS_ITEMS
# 1:
# get_tree().root.content_scale_mode = Window.CONTENT_SCALE_MODE_DISABLED
# # UI scale factor
# get_tree().root.content_scale_factor = get_setting("ui_scale_factor")
# # Hints
# if not get_setting("tutorial_started"):
# for k in profile["hints"].keys():
# set_hint(k, false)
# # Sets all volumes
# Sound.set_volume(0, get_setting("master_volume"))
# Sound.set_volume(1, get_setting("music_volume"))
# Sound.set_volume(2, get_setting("sfx_volume"))
# # Touch controls
# match get_setting("touch_controls"):
# # 0: Automatically adjusted
# 1: # Enabled
# using_touch = true
# 2: # Disabled
# using_touch = false
# using_touch_change.emit()
# # Input settings
# InputManager.apply_input_map(InputManager.settings_dictionary_to_input_map(get_category_settings("input")))
# settings_changed.emit()
# func update_language():
# var language = languages[get_setting("language")][0]
# if language == "system": language = OS.get_locale_language()
# TranslationServer.set_locale(language)
# func update_fullscreen():
# match get_setting("fullscreen"):
# 0: pass
# 1: DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
# 2: if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
# DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|