From 153b15eb4ddcdc8222aef7c743483177f2d30837 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 20 Jun 2020 16:15:24 +0200 Subject: [PATCH] Update ESS to get the EntityResourceData removal update. Also update the Engine. --- .../entity_resources/1_mana_resource.tres | 4 +-- game/modules/core/resource_db.tres | 2 +- .../naturalist/1_naturalist.tres | 5 +-- .../auras/10_aspect_of_scorpions_rank_1.tres | 5 --- .../auras/12_aspect_of_wolves_rank_1.tres | 9 ------ .../naturalist/auras/16_ironbark_rank_1.tres | 5 --- .../naturalist/entities/1_naturalist.tres | 2 -- .../naturalist/entities/2_naturalist_mob.tres | 2 -- .../spells/10_aspect_of_scorpions_rank_1.tres | 2 +- .../naturalist/spells/36_regrow.tres | 2 +- game/player/NamePlate.gd | 16 ++++++---- game/scripts/resources/ManaResourceData.gd | 28 ---------------- game/ui/unitframes/TargetUnitframe.gd | 32 +++++++++---------- game/ui/unitframes/UnitframeBase.gd | 29 +++++++++-------- 14 files changed, 48 insertions(+), 95 deletions(-) delete mode 100644 game/scripts/resources/ManaResourceData.gd diff --git a/game/modules/core/entity_resources/1_mana_resource.tres b/game/modules/core/entity_resources/1_mana_resource.tres index b3cff4e2..909f1ad5 100644 --- a/game/modules/core/entity_resources/1_mana_resource.tres +++ b/game/modules/core/entity_resources/1_mana_resource.tres @@ -1,6 +1,6 @@ -[gd_resource type="EntityResourceData" load_steps=2 format=2] +[gd_resource type="EntityResource" load_steps=2 format=2] -[ext_resource path="res://scripts/resources/ManaResourceData.gd" type="Script" id=1] +[ext_resource path="res://scripts/resources/ManaResource.gd" type="Script" id=1] [resource] id = 1 diff --git a/game/modules/core/resource_db.tres b/game/modules/core/resource_db.tres index 4d384761..092e4114 100644 --- a/game/modules/core/resource_db.tres +++ b/game/modules/core/resource_db.tres @@ -6,7 +6,7 @@ [ext_resource path="res://modules/core/entity_skills/1_test.tres" type="EntitySkillData" id=4] [ext_resource path="res://modules/core/item_templates/1_gold.tres" type="ItemTemplate" id=5] [ext_resource path="res://modules/core/crafting/1_test_craft.tres" type="CraftRecipe" id=6] -[ext_resource path="res://modules/core/entity_resources/1_mana_resource.tres" type="EntityResourceData" id=7] +[ext_resource path="res://modules/core/entity_resources/1_mana_resource.tres" type="EntityResource" id=7] [ext_resource path="res://modules/core/xp/xp_data.tres" type="XPData" id=8] [resource] diff --git a/game/modules/entity_classes/naturalist/1_naturalist.tres b/game/modules/entity_classes/naturalist/1_naturalist.tres index 8183031d..7d44ab57 100644 --- a/game/modules/entity_classes/naturalist/1_naturalist.tres +++ b/game/modules/entity_classes/naturalist/1_naturalist.tres @@ -5,7 +5,6 @@ [ext_resource path="res://modules/entity_classes/naturalist/spells/11_aspect_of_wasps_rank_1.tres" type="Spell" id=3] [ext_resource path="res://modules/entity_classes/naturalist/spells/13_aspect_of_bees_rank_1.tres" type="Spell" id=5] [ext_resource path="res://modules/entity_classes/naturalist/spells/10_aspect_of_scorpions_rank_1.tres" type="Spell" id=7] -[ext_resource path="res://modules/core/entity_resources/1_mana_resource.tres" type="EntityResourceData" id=8] [ext_resource path="res://scripts/ai/EntityAIGD.gd" type="Script" id=9] [ext_resource path="res://modules/entity_classes/naturalist/spells/17_ironbark_rank_1.tres" type="Spell" id=10] [ext_resource path="res://modules/entity_classes/naturalist/spells/24_attunement_rank_1.tres" type="Spell" id=11] @@ -26,6 +25,8 @@ [sub_resource type="EntityAI" id=1] script = ExtResource( 9 ) +[sub_resource type="EntityResource" id=3] + [sub_resource type="CharacterSpec" id=2] id = 1 @@ -33,7 +34,7 @@ id = 1 resource_name = "Naturalist" id = 1 text_name = "Naturalist" -entity_resources = [ ExtResource( 8 ) ] +entity_resources = [ SubResource( 3 ) ] specs = [ SubResource( 2 ) ] spells = [ ExtResource( 7 ), ExtResource( 3 ), ExtResource( 15 ), ExtResource( 5 ), ExtResource( 12 ), ExtResource( 23 ), ExtResource( 1 ), ExtResource( 10 ), ExtResource( 24 ), ExtResource( 2 ), ExtResource( 19 ), ExtResource( 18 ), ExtResource( 17 ), ExtResource( 20 ), ExtResource( 11 ), ExtResource( 22 ), ExtResource( 16 ), ExtResource( 21 ), ExtResource( 14 ) ] start_spells = [ ExtResource( 7 ), ExtResource( 21 ), ExtResource( 14 ) ] diff --git a/game/modules/entity_classes/naturalist/auras/10_aspect_of_scorpions_rank_1.tres b/game/modules/entity_classes/naturalist/auras/10_aspect_of_scorpions_rank_1.tres index 8ec45016..b008d47a 100644 --- a/game/modules/entity_classes/naturalist/auras/10_aspect_of_scorpions_rank_1.tres +++ b/game/modules/entity_classes/naturalist/auras/10_aspect_of_scorpions_rank_1.tres @@ -19,9 +19,4 @@ damage_enabled = true damage_type = 8 damage_min = 4 damage_max = 5 -attribute_count = 1 -StatModAttribute_0/stat = 24 -StatModAttribute_0/base_mod = 0.0 -StatModAttribute_0/bonus_mod = 0.0 -StatModAttribute_0/percent_mod = 10.0 script = ExtResource( 1 ) diff --git a/game/modules/entity_classes/naturalist/auras/12_aspect_of_wolves_rank_1.tres b/game/modules/entity_classes/naturalist/auras/12_aspect_of_wolves_rank_1.tres index b7d8efed..88ccd74a 100644 --- a/game/modules/entity_classes/naturalist/auras/12_aspect_of_wolves_rank_1.tres +++ b/game/modules/entity_classes/naturalist/auras/12_aspect_of_wolves_rank_1.tres @@ -20,13 +20,4 @@ damage_enabled = true damage_type = 16 damage_min = 280 damage_max = 330 -attribute_count = 2 -StatModAttribute_0/stat = 26 -StatModAttribute_0/base_mod = 0.0 -StatModAttribute_0/bonus_mod = 0.0 -StatModAttribute_0/percent_mod = -10.0 -StatModAttribute_1/stat = 27 -StatModAttribute_1/base_mod = 0.0 -StatModAttribute_1/bonus_mod = 0.0 -StatModAttribute_1/percent_mod = -10.0 script = ExtResource( 1 ) diff --git a/game/modules/entity_classes/naturalist/auras/16_ironbark_rank_1.tres b/game/modules/entity_classes/naturalist/auras/16_ironbark_rank_1.tres index 32e497ce..f5cf5d93 100644 --- a/game/modules/entity_classes/naturalist/auras/16_ironbark_rank_1.tres +++ b/game/modules/entity_classes/naturalist/auras/16_ironbark_rank_1.tres @@ -11,9 +11,4 @@ time = 6.0 aura_type = 1 text_name = "Ironbark" text_description = "Reduces damage taken by 70%. This spell is not on the global cooldown." -attribute_count = 1 -StatModAttribute_0/stat = 24 -StatModAttribute_0/base_mod = 0.0 -StatModAttribute_0/bonus_mod = 0.0 -StatModAttribute_0/percent_mod = -70.0 script = ExtResource( 1 ) diff --git a/game/modules/entity_classes/naturalist/entities/1_naturalist.tres b/game/modules/entity_classes/naturalist/entities/1_naturalist.tres index 6f1baec0..faa3b5df 100644 --- a/game/modules/entity_classes/naturalist/entities/1_naturalist.tres +++ b/game/modules/entity_classes/naturalist/entities/1_naturalist.tres @@ -6,8 +6,6 @@ [ext_resource path="res://scripts/entities/EntityDataGD.gd" type="Script" id=4] [ext_resource path="res://modules/core/crafting/1_test_craft.tres" type="CraftRecipe" id=5] - - [sub_resource type="SimpleLevelStatData" id=1] agility = 4 strength = 3 diff --git a/game/modules/entity_classes/naturalist/entities/2_naturalist_mob.tres b/game/modules/entity_classes/naturalist/entities/2_naturalist_mob.tres index a949e3d7..9ea26e12 100644 --- a/game/modules/entity_classes/naturalist/entities/2_naturalist_mob.tres +++ b/game/modules/entity_classes/naturalist/entities/2_naturalist_mob.tres @@ -4,8 +4,6 @@ [ext_resource path="res://modules/entity_classes/naturalist/1_naturalist.tres" type="EntityClassData" id=2] [ext_resource path="res://scripts/entities/EntityDataGD.gd" type="Script" id=3] - - [sub_resource type="LootDataBase" id=1] [sub_resource type="SimpleLevelStatData" id=2] diff --git a/game/modules/entity_classes/naturalist/spells/10_aspect_of_scorpions_rank_1.tres b/game/modules/entity_classes/naturalist/spells/10_aspect_of_scorpions_rank_1.tres index e244aacb..a555b2b3 100644 --- a/game/modules/entity_classes/naturalist/spells/10_aspect_of_scorpions_rank_1.tres +++ b/game/modules/entity_classes/naturalist/spells/10_aspect_of_scorpions_rank_1.tres @@ -1,6 +1,6 @@ [gd_resource type="Spell" load_steps=7 format=2] -[ext_resource path="res://modules/core/entity_resources/1_mana_resource.tres" type="EntityResourceData" id=1] +[ext_resource path="res://modules/core/entity_resources/1_mana_resource.tres" type="EntityResource" id=1] [ext_resource path="res://modules/entity_classes/naturalist/auras/10_aspect_of_scorpions_rank_1.tres" type="Aura" id=2] [ext_resource path="res://modules/entity_classes/naturalist/effect_data/aspect_of_scorpions.tres" type="SpellEffectVisual" id=3] [ext_resource path="res://scripts/spells/gd_spell_script.gd" type="Script" id=4] diff --git a/game/modules/entity_classes/naturalist/spells/36_regrow.tres b/game/modules/entity_classes/naturalist/spells/36_regrow.tres index 45dc009d..ed16b1aa 100644 --- a/game/modules/entity_classes/naturalist/spells/36_regrow.tres +++ b/game/modules/entity_classes/naturalist/spells/36_regrow.tres @@ -1,6 +1,6 @@ [gd_resource type="Spell" load_steps=5 format=2] -[ext_resource path="res://modules/core/entity_resources/1_mana_resource.tres" type="EntityResourceData" id=1] +[ext_resource path="res://modules/core/entity_resources/1_mana_resource.tres" type="EntityResource" id=1] [ext_resource path="res://scripts/spells/gd_spell_script.gd" type="Script" id=2] [ext_resource path="res://modules/entity_classes/naturalist/icons/root.tres" type="Texture" id=3] diff --git a/game/player/NamePlate.gd b/game/player/NamePlate.gd index 834755ad..bf4dd450 100644 --- a/game/player/NamePlate.gd +++ b/game/player/NamePlate.gd @@ -46,6 +46,8 @@ var health_bar_label : Label = null var entity : Entity = null var health : EntityResource = null +var _health : EntityResource + func _enter_tree(): name_label = get_node(name_label_path) as Label health_bar = get_node(health_bar_path) as TextureProgress @@ -122,14 +124,14 @@ func set_max_distance(var value : float) -> void: max_distance = value -func c_health_changed(stat : EntityResource) -> void: - if stat.max_value == 0: +func c_health_changed() -> void: + if _health.max_value == 0: health_bar.max_value = 1 health_bar.value = 0 return - health_bar.max_value = stat.max_value - health_bar.value = stat.current_value + health_bar.max_value = _health.max_value + health_bar.value = _health.current_value # if stat.cmax != 0: @@ -172,6 +174,6 @@ func on_centity_resource_added(resorce) -> void: if health != null: return - health = entity.getc_health() - health.connect("changed", self, "c_health_changed") - c_health_changed(health) + _health = entity.getc_health() + _health.connect("changed", self, "c_health_changed") + c_health_changed() diff --git a/game/scripts/resources/ManaResourceData.gd b/game/scripts/resources/ManaResourceData.gd deleted file mode 100644 index 6652cf5b..00000000 --- a/game/scripts/resources/ManaResourceData.gd +++ /dev/null @@ -1,28 +0,0 @@ -extends EntityResourceData - -# Copyright (c) 2019-2020 Péter Magyar -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -func _get_entity_resource_instance() -> EntityResource: - var mr = ManaResource.new() - mr.data_path = resource_path - - return mr - diff --git a/game/ui/unitframes/TargetUnitframe.gd b/game/ui/unitframes/TargetUnitframe.gd index e81bf078..e8bbc1c6 100644 --- a/game/ui/unitframes/TargetUnitframe.gd +++ b/game/ui/unitframes/TargetUnitframe.gd @@ -38,6 +38,7 @@ var _aura_grid : GridContainer var _player : Entity var _mana : ManaResource +var _health : EntityResourceHealth # Called when the node enters the scene tree for the first time. func _ready() -> void: @@ -84,9 +85,9 @@ func set_player(p_player : Entity) -> void: for i in range(_player.resource_getc_count()): centity_resource_added(_player.resource_getc_index(i)) - var health = _player.getc_health() - _on_player_health_changed(health) - health.connect("changed", self, "_on_player_health_changed") + _health = _player.getc_health() + _on_player_health_changed() + _health.connect("changed", self, "_on_player_health_changed") _name_text.text = _player.centity_name @@ -95,13 +96,12 @@ func set_player(p_player : Entity) -> void: func centity_resource_added(res : EntityResource): if res is ManaResource: - _mana= res as ManaResource - + _mana = res as ManaResource _mana.connect("changed", self, "_on_mana_changed") - _on_mana_changed(_mana) + _on_mana_changed() -func _on_mana_changed(resource: EntityResource) -> void: - if resource.max_value == 0: +func _on_mana_changed() -> void: + if _mana.max_value == 0: _resource_range.min_value = 0 _resource_range.max_value = 1 _resource_range.value = 0 @@ -111,10 +111,10 @@ func _on_mana_changed(resource: EntityResource) -> void: return _resource_range.min_value = 0 - _resource_range.max_value = resource.max_value - _resource_range.value = resource.current_value + _resource_range.max_value = _mana.max_value + _resource_range.value = _mana.current_value - _resource_text.text = str(resource.current_value) + "/" + str(resource.max_value) + _resource_text.text = str(_mana.current_value) + "/" + str(_mana.max_value) func on_notification_caura(what : int, aura_data : AuraData) -> void: if what == SpellEnums.NOTIFICATION_AURA_ADDED: @@ -131,8 +131,8 @@ func on_notification_caura(what : int, aura_data : AuraData) -> void: bn.queue_free() return -func _on_player_health_changed(health : EntityResource) -> void: - if health.max_value == 0: +func _on_player_health_changed() -> void: + if _health.max_value == 0: _health_range.min_value = 0 _health_range.max_value = 1 _health_range.value = 0 @@ -142,10 +142,10 @@ func _on_player_health_changed(health : EntityResource) -> void: return _health_range.min_value = 0 - _health_range.max_value = health.max_value - _health_range.value = health.current_value + _health_range.max_value = _health.max_value + _health_range.value = _health.current_value - _health_text.text = str(health.current_value) + "/" + str(health.max_value) + _health_text.text = str(_health.current_value) + "/" + str(_health.max_value) func diecd(entity : Entity) -> void: set_player(null) diff --git a/game/ui/unitframes/UnitframeBase.gd b/game/ui/unitframes/UnitframeBase.gd index be428ae7..c13bac1e 100644 --- a/game/ui/unitframes/UnitframeBase.gd +++ b/game/ui/unitframes/UnitframeBase.gd @@ -39,6 +39,7 @@ var _xp_range : Range var _player : Entity var _mana : ManaResource +var _health : EntityResourceHealth func _ready() -> void: _name_text = get_node(name_text_path) @@ -78,9 +79,9 @@ func set_player(p_player: Entity) -> void: for i in range(_player.resource_getc_count()): centity_resource_added(_player.resource_getc_index(i)) - var health = _player.getc_health() - _on_player_health_changed(health) - health.connect("changed", self, "_on_player_health_changed") + _health = _player.getc_health() + _on_player_health_changed() + _health.connect("changed", self, "_on_player_health_changed") _name_text.text = _player.centity_name _level_text.text = str(_player.ccharacter_level) @@ -93,10 +94,10 @@ func centity_resource_added(res : EntityResource): _mana = res as ManaResource _mana.connect("changed", self, "_on_mana_changed") - _on_mana_changed(_mana) + _on_mana_changed() -func _on_player_health_changed(health: EntityResource) -> void: - if health.max_value == 0: +func _on_player_health_changed() -> void: + if _health.max_value == 0: _health_range.min_value = 0 _health_range.max_value = 1 _health_range.value = 0 @@ -106,13 +107,13 @@ func _on_player_health_changed(health: EntityResource) -> void: return _health_range.min_value = 0 - _health_range.max_value = health.max_value - _health_range.value = health.current_value + _health_range.max_value = _health.max_value + _health_range.value = _health.current_value - _health_text.text = str(health.current_value) + "/" + str(health.max_value) + _health_text.text = str(_health.current_value) + "/" + str(_health.max_value) -func _on_mana_changed(resource: EntityResource) -> void: - if resource.max_value == 0: +func _on_mana_changed() -> void: + if _mana.max_value == 0: _resource_range.min_value = 0 _resource_range.max_value = 1 _resource_range.value = 0 @@ -122,10 +123,10 @@ func _on_mana_changed(resource: EntityResource) -> void: return _resource_range.min_value = 0 - _resource_range.max_value = resource.max_value - _resource_range.value = resource.current_value + _resource_range.max_value = _mana.max_value + _resource_range.value = _mana.current_value - _resource_text.text = str(resource.current_value) + "/" + str(resource.max_value) + _resource_text.text = str(_mana.current_value) + "/" + str(_mana.max_value) func cname_changed(entity: Entity) -> void: _name_text.text = _player.centity_name