From ae09b0194e5d8916f090c03d52833a295d205214 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 1 Feb 2020 11:20:05 +0100 Subject: [PATCH] ESS update. --- HEADS | 2 +- game/autoload/EntityDataManager.gd | 8 +++++--- game/autoload/EntityDataManager.tscn | 2 +- game/data/item_templates/1_gold.tres | 1 + game/player/Mob.gd | 4 ++-- game/player/Player.gd | 4 ++-- game/project.godot | 15 +++++++++++++++ game/scenes/CharacterCreationMenu.gd | 4 ++-- game/ui/actionbars/ActionBarEntry.gd | 2 +- game/ui/unitframes/UnitframeBase.gd | 2 +- 10 files changed, 31 insertions(+), 13 deletions(-) diff --git a/HEADS b/HEADS index 54c129ab..31ecf0d0 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": "188dc714b000bbdb086513dcff3dd4bc4f75a0e7", "world_generator": "09372b146936fda509f5c23a522e998d12f38e13", "entity_spell_system": "29a26d9774ba6c05858aba6b5fe442c282bbd117", "ui_extensions": "38acc650db260a831dc26ca96fe9d9a087230bdc", "voxelman": "db77530ec1b70861fb2e3783d3ea6ba75a4ac793", "texture_packer": "7bff901e4946b903a73b266d6a02c317f079ab33", "fastnoise": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e", "entity-spell-system-addons": "d60e746b158d3ebf9d2ea306af1dd24bcae49be5", "mesh_data_resource": "4bda19b12be2c2a79a6121de6d22e48f3934e726", "ess_data": "3bd637fdd3304b64a18287a49a6b7387acf2f5de", "prop_tool": "df438053ebc900966f8f842fc65f0264f1271d49", "procedural_animations": "9c287b9e54dc8d306668a6118a6d2c78415eb8de", "fast_quadratic_mesh_simplifier": "63d55b154967321212a6426e9b327c95e007785d"} \ No newline at end of file +{"engine": "f26e2f65cd4af638a5e64a42aa519abc9cde6604", "world_generator": "09372b146936fda509f5c23a522e998d12f38e13", "entity_spell_system": "5f5cdac043e2add5c54d165c6b507b0e02289497", "ui_extensions": "38acc650db260a831dc26ca96fe9d9a087230bdc", "voxelman": "db77530ec1b70861fb2e3783d3ea6ba75a4ac793", "texture_packer": "7bff901e4946b903a73b266d6a02c317f079ab33", "fastnoise": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e", "entity-spell-system-addons": "d60e746b158d3ebf9d2ea306af1dd24bcae49be5", "mesh_data_resource": "4bda19b12be2c2a79a6121de6d22e48f3934e726", "ess_data": "3bd637fdd3304b64a18287a49a6b7387acf2f5de", "prop_tool": "df438053ebc900966f8f842fc65f0264f1271d49", "procedural_animations": "9c287b9e54dc8d306668a6118a6d2c78415eb8de", "fast_quadratic_mesh_simplifier": "63d55b154967321212a6426e9b327c95e007785d"} \ No newline at end of file diff --git a/game/autoload/EntityDataManager.gd b/game/autoload/EntityDataManager.gd index 86d328e7..f66a6226 100644 --- a/game/autoload/EntityDataManager.gd +++ b/game/autoload/EntityDataManager.gd @@ -38,6 +38,8 @@ var _players : Array var _mobs : Array func _ready(): + EntityDataManager.load_all() + _spawn_parent = get_node(spawn_parent_path) # get_tree().connect("network_peer_connected", self, "_player_connected") @@ -121,7 +123,7 @@ puppet func spawn_owned_player(data : String, position : Vector3) -> void: func load_player(file_name : String, position : Vector3, network_owner : int) -> Entity: # var createinfo : EntityCreateInfo = EntityCreateInfo.new() # -# var cls : EntityData = Entities.get_player_character_data(class_id) +# var cls : EntityData = EntityDataManager.get_player_character_data(class_id) # # var class_profile : ClassProfile = Profiles.get_class_profile(class_id) # @@ -163,7 +165,7 @@ func spawn_display_player(name : String) -> Entity: func spawn_player_for_menu(class_id : int, name : String, parent : Node) -> Entity: var createinfo : EntityCreateInfo = EntityCreateInfo.new() - var cls : EntityData = Entities.get_player_character_data(class_id) + var cls : EntityData = EntityDataManager.get_player_character_data(class_id) var class_profile : ClassProfile = Profiles.get_class_profile(class_id) createinfo.entity_data = cls @@ -251,7 +253,7 @@ func spawn_player(class_id : int, position : Vector3, name : String, node_name func spawn_mob(class_id : int, level : int, position : Vector3) -> Entity: var createinfo : EntityCreateInfo = EntityCreateInfo.new() - var cls : EntityData = Entities.get_entity_data(class_id) + var cls : EntityData = EntityDataManager.get_entity_data(class_id) if cls == null: print("clsnull") diff --git a/game/autoload/EntityDataManager.tscn b/game/autoload/EntityDataManager.tscn index 2404c927..d87885af 100644 --- a/game/autoload/EntityDataManager.tscn +++ b/game/autoload/EntityDataManager.tscn @@ -6,7 +6,7 @@ [ext_resource path="res://player/Mob.tscn" type="PackedScene" id=4] [ext_resource path="res://player/DisplayPlayer.tscn" type="PackedScene" id=5] -[node name="EntityDataManager" type="EntityDataManager"] +[node name="EntityDataManager" type="Node"] xp_data_path = "res://data/xp/xp_data.tres" entity_resources_folder = "res://data/entity_resources" entity_skills_folder = "res://data/entity_skills" diff --git a/game/data/item_templates/1_gold.tres b/game/data/item_templates/1_gold.tres index 0495c019..b2d791e6 100644 --- a/game/data/item_templates/1_gold.tres +++ b/game/data/item_templates/1_gold.tres @@ -3,6 +3,7 @@ [ext_resource path="res://data/icons/items/gold.tres" type="Texture" id=1] [resource] +resource_name = "Gold" id = 1 text_name = "Gold" item_type = 13 diff --git a/game/player/Mob.gd b/game/player/Mob.gd index a9781eb7..b163e751 100644 --- a/game/player/Mob.gd +++ b/game/player/Mob.gd @@ -289,10 +289,10 @@ func _setup(): sentity_name = sentity_data.text_name func _son_xp_gained(value : int) -> void: - if not Entities.get_xp_data().can_level_up(gets_level()): + if not EntityDataManager.get_xp_data().can_level_up(gets_level()): return - var xpr : int = Entities.get_xp_data().get_xp(gets_level()); + var xpr : int = EntityDataManager.get_xp_data().get_xp(gets_level()); if xpr <= sxp: slevelup(1) diff --git a/game/player/Player.gd b/game/player/Player.gd index 83d4fccc..e8ef66fb 100644 --- a/game/player/Player.gd +++ b/game/player/Player.gd @@ -428,10 +428,10 @@ func _con_spell_cast_success(info): anim_node_state_machine.travel("run-loop") func _son_xp_gained(value : int) -> void: - if not Entities.get_xp_data().can_level_up(gets_level()): + if not EntityDataManager.get_xp_data().can_level_up(gets_level()): return - var xpr : int = Entities.get_xp_data().get_xp(gets_level()); + var xpr : int = EntityDataManager.get_xp_data().get_xp(gets_level()); if xpr <= sxp: slevelup(1) diff --git a/game/project.godot b/game/project.godot index 7b6a843e..186f0dfd 100644 --- a/game/project.godot +++ b/game/project.godot @@ -257,6 +257,21 @@ window/size/viewport_scale=100 enabled=PoolStringArray( "ess_data", "prop_tool" ) +[ess] + +data/xp_data_path="res://data/xp/xp_data.tres" +data/entity_resources_folder="res://data/entity_resources" +data/entity_skills_folder="res://data/entity_skills" +data/entity_datas_folder="res://data/entities" +data/spells_folder="res://data/spells" +data/auras_folder="res://data/auras" +data/world_spell_datas_folder="res://data/world_spells" +data/craft_data_folder="res://data/crafting" +data/item_template_folder="res://data/item_templates" +data/mob_data_folder="res://data/mob_data" +data/player_character_data_folder="res://data/player_character_data" +data/automatic_load=true + [importer_defaults] texture_array={ diff --git a/game/scenes/CharacterCreationMenu.gd b/game/scenes/CharacterCreationMenu.gd index 594f0343..298973dc 100644 --- a/game/scenes/CharacterCreationMenu.gd +++ b/game/scenes/CharacterCreationMenu.gd @@ -36,8 +36,8 @@ func _ready(): var fb : Button = null - for i in range(Entities.get_player_character_data_count()): - var d : EntityData = Entities.get_player_character_data_index(i) + for i in range(EntityDataManager.get_player_character_data_count()): + var d : EntityData = EntityDataManager.get_player_character_data_index(i) var ce : Button = character_entry.instance() as Button diff --git a/game/ui/actionbars/ActionBarEntry.gd b/game/ui/actionbars/ActionBarEntry.gd index b19bb3f6..7ba5459b 100644 --- a/game/ui/actionbars/ActionBarEntry.gd +++ b/game/ui/actionbars/ActionBarEntry.gd @@ -161,7 +161,7 @@ func setup_icon() -> void: ThemeAtlas.unref_texture(icon_rect.texture) icon_rect.texture = null - var spell = Entities.get_spell(button_entry.item_id) + var spell = EntityDataManager.get_spell(button_entry.item_id) if spell.icon != null: icon_rect.texture = ThemeAtlas.add_texture(spell.icon) diff --git a/game/ui/unitframes/UnitframeBase.gd b/game/ui/unitframes/UnitframeBase.gd index 81a402bd..ce727700 100644 --- a/game/ui/unitframes/UnitframeBase.gd +++ b/game/ui/unitframes/UnitframeBase.gd @@ -96,7 +96,7 @@ func clevel_changed(entity: Entity, value : int) -> void: _level_text.text = str(_player.clevel) _xp_range.min_value = 0 - _xp_range.max_value = Entities.get_xp_data().get_xp(_player.clevel) + _xp_range.max_value = EntityDataManager.get_xp_data().get_xp(_player.clevel) func con_xp_gained(entity: Entity, val: int) -> void: _xp_range.value = _player.cxp