Refactor code structure for improved readability and maintainability
This commit is contained in:
+7
-8
@@ -30,19 +30,18 @@ func get_description(item_id: String, items: Array = []) -> String:
|
||||
var description: String = Templates[Locale][item_id]["text"]
|
||||
var value = 0
|
||||
for item in items:
|
||||
description.replace("value"+str(value), str(item))
|
||||
description.replace("value" + str(value), str(item))
|
||||
return description
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
OwniverseEntities = _read_from_csv("res://autoload/owniverse_entitites.txt")
|
||||
OwniverseItems = _read_from_csv("res://autoload/owniverse_items.txt")
|
||||
OwniverseEntities = _read_from_csv("res://data/owniverse_entitites.txt")
|
||||
OwniverseItems = _read_from_csv("res://data/owniverse_items.txt")
|
||||
|
||||
Locales["en"] = _read_from_csv("res://autoload/locale.en.txt")
|
||||
Locales["ru"] = _read_from_csv("res://autoload/locale.ru.txt")
|
||||
Locales["en"] = _read_from_csv("res://data/locale.en.txt")
|
||||
Locales["ru"] = _read_from_csv("res://data/locale.ru.txt")
|
||||
|
||||
Templates["en"] = _read_from_csv("res://autoload/templates.en.txt")
|
||||
Templates["en"] = _read_from_csv("res://data/templates.en.txt")
|
||||
|
||||
|
||||
func _read_from_csv(file_path: String) -> Dictionary:
|
||||
@@ -65,7 +64,7 @@ func _read_from_csv(file_path: String) -> Dictionary:
|
||||
|
||||
while not file.eof_reached():
|
||||
var raw_row = file.get_csv_line("|")
|
||||
if raw_row.is_empty(): # пропускаем пустые строки
|
||||
if raw_row.is_empty(): # пропускаем пустые строки
|
||||
continue
|
||||
|
||||
var trimmed_row: PackedStringArray = []
|
||||
|
||||
Reference in New Issue
Block a user