fix(locale): scope cur_lang across full setup in game_scene.gd

This commit is contained in:
shen
2026-09-19 18:49:17 -07:00
parent 4a2b953a4f
commit f872afb45f
+2 -2
View File
@@ -172,6 +172,8 @@ func setup(m2client: Node, assets_root: String,
var diag_after := int(OS.get_environment("MT_DIAG_AFTER_MS")) if OS.get_environment("MT_DIAG_AFTER_MS") != "" else DIAG_AFTER_MS
_diag_at = Time.get_ticks_msec() + diag_after
_ui_mobile = UiProfile.resolve() == UiProfile.Mode.MOBILE
var LocaleScript = load("res://locale.gd")
var cur_lang: String = LocaleScript.get_default_lang() if LocaleScript and LocaleScript.has_method("get_default_lang") else "zh"
# GC_MAIN_CHARACTER only carries the server-space coordinates, not the map
# folder. The old fixed A1 fallback puts characters from A2/A3 outside the
# rendered terrain, which looks like an empty map. Resolve the map from the
@@ -458,8 +460,6 @@ func setup(m2client: Node, assets_root: String,
if ClassDB.class_exists("Metin2Proto") and assets_root != "":
proto = ClassDB.instantiate("Metin2Proto")
add_child(proto)
var LocaleScript = load("res://locale.gd")
var cur_lang: String = LocaleScript.get_default_lang() if LocaleScript and LocaleScript.has_method("get_default_lang") else "zh"
var ip := assets_root.path_join("locale/locale/%s/item_proto" % cur_lang)
if not FileAccess.file_exists(ip):
ip = assets_root.path_join("locale/locale/en/item_proto")