Add new entity and item definitions, refactor related code
- Introduced new CSV files for entities and items, defining various properties and characteristics. - Refactored the stage.gd script to handle item selection and descriptions instead of entities. - Updated item button script to reflect changes in item properties and signals. - Created a new entity.gd script to define the OwniverseEntity class with initialization and parsing methods. - Modified owniverse.gd to initialize entities from the new definitions. - Adjusted versioning in export presets and project files to reflect recent changes.
This commit is contained in:
+10
-8
@@ -22,35 +22,37 @@ var Owniverse: Dictionary = {
|
||||
var Locales: Dictionary = {}
|
||||
var Locale = "en"
|
||||
|
||||
var Entities: Dictionary = {}
|
||||
var OwniverseEntities: Dictionary = {}
|
||||
var OwniverseItems: Dictionary = {}
|
||||
var Templates: Dictionary = {}
|
||||
|
||||
|
||||
func get_localized_item_description(entity_id: String, item: String) -> String:
|
||||
if Locales[Locale].has(entity_id):
|
||||
return Locales[Locale][entity_id][item]
|
||||
func get_localized_item_description(item_id: String, item: String) -> String:
|
||||
if Locales[Locale].has(item_id):
|
||||
return Locales[Locale][item_id][item]
|
||||
return ""
|
||||
|
||||
|
||||
func get_description(item_id: String, values: Array = []) -> String:
|
||||
func get_description(item_id: String, items: Array = []) -> String:
|
||||
if !Templates[Locale].has(item_id):
|
||||
return ""
|
||||
#print(Templates[Locale])
|
||||
var description: String = Templates[Locale][item_id]["text"]
|
||||
var value = 0
|
||||
for item in values:
|
||||
for item in items:
|
||||
description.replace("value"+str(value), str(item))
|
||||
return description
|
||||
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Entities = _read_from_csv("res://Autoload/entities.csv")
|
||||
OwniverseEntities = _read_from_csv("res://Autoload/owniverse_entitites.csv")
|
||||
OwniverseItems = _read_from_csv("res://Autoload/owniverse_items.csv")
|
||||
|
||||
Locales["en"] = _read_from_csv("res://Autoload/locale.en.csv")
|
||||
Locales["ru"] = _read_from_csv("res://Autoload/locale.ru.csv")
|
||||
|
||||
Templates["en"] = _read_from_csv("res://Autoload/templates.en.csv")
|
||||
|
||||
|
||||
func _read_from_csv(file_path: String) -> Dictionary:
|
||||
if not FileAccess.file_exists(file_path):
|
||||
|
||||
Reference in New Issue
Block a user