mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Implemented mana. Also updated HEADS, as ESS had lots of changes for EntityResources so this can work.
This commit is contained in:
parent
2931751a05
commit
c00ae9b9bb
2
HEADS
2
HEADS
@ -1 +1 @@
|
|||||||
{"engine": {"3.2": "b0eca5828ccd3a5c07b77e82e567c45937de9056", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "a08917370cdef0884042bdb49fb80ece0b2e76ec"}, "entity_spell_system": {"master": "f3073c48e69a7f43fe873efcc3c0c08216a5fa15"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "91540092500d8b8bd0c12322e46f4e10a00c66ae"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "9b1868668de4242ccc0565cf3c6b5e1c375f1576"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "3144600da9dd00595518c5f0d4cc2cc400825c86"}}
|
{"engine": {"3.2": "34dc32aeb8b06947897f75399c15f3eb9c211d7b", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "a08917370cdef0884042bdb49fb80ece0b2e76ec"}, "entity_spell_system": {"master": "b66de0a8946d17913bd7f3877e2f77b7ef08c3b8"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "91540092500d8b8bd0c12322e46f4e10a00c66ae"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "9b1868668de4242ccc0565cf3c6b5e1c375f1576"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "3144600da9dd00595518c5f0d4cc2cc400825c86"}}
|
@ -1,9 +1,14 @@
|
|||||||
[gd_resource type="Spell" load_steps=5 format=2]
|
[gd_resource type="Spell" load_steps=7 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://scripts/spells/gd_spell_script.gd" type="Script" id=1]
|
[ext_resource path="res://scripts/spells/gd_spell_script.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://data/icons/naturalist/aspect_of_scorpions.tres" type="Texture" id=2]
|
[ext_resource path="res://data/icons/naturalist/aspect_of_scorpions.tres" type="Texture" id=2]
|
||||||
[ext_resource path="res://data/auras/10_aspect_of_scorpions_rank_1.tres" type="Aura" id=3]
|
[ext_resource path="res://data/auras/10_aspect_of_scorpions_rank_1.tres" type="Aura" id=3]
|
||||||
[ext_resource path="res://data/effect_data/aspect_of_scorpions.tres" type="SpellEffectVisual" id=4]
|
[ext_resource path="res://data/effect_data/aspect_of_scorpions.tres" type="SpellEffectVisual" id=4]
|
||||||
|
[ext_resource path="res://data/entity_resources/1_mana_resource.tres" type="EntityResourceData" id=5]
|
||||||
|
|
||||||
|
[sub_resource type="EntityResourceCostData" id=1]
|
||||||
|
entity_resource_data = ExtResource( 5 )
|
||||||
|
cost = 100
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
resource_name = "Aspect of Scorpions"
|
resource_name = "Aspect of Scorpions"
|
||||||
@ -23,4 +28,5 @@ cast_cast_time = 1.2
|
|||||||
heal_enabled = true
|
heal_enabled = true
|
||||||
heal_min = 123
|
heal_min = 123
|
||||||
heal_max = 333
|
heal_max = 333
|
||||||
|
resource_cost = SubResource( 1 )
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
[gd_resource type="Spell" load_steps=3 format=2]
|
[gd_resource type="Spell" load_steps=5 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://scripts/spells/gd_spell_script.gd" type="Script" id=1]
|
[ext_resource path="res://scripts/spells/gd_spell_script.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://data/icons/naturalist/root.tres" type="Texture" id=2]
|
[ext_resource path="res://data/icons/naturalist/root.tres" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://data/entity_resources/1_mana_resource.tres" type="EntityResourceData" id=3]
|
||||||
|
|
||||||
|
[sub_resource type="EntityResourceCostData" id=1]
|
||||||
|
entity_resource_data = ExtResource( 3 )
|
||||||
|
cost = 100
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
resource_name = "Regrow"
|
resource_name = "Regrow"
|
||||||
@ -21,4 +26,5 @@ heal_min = 12
|
|||||||
heal_max = 18
|
heal_max = 18
|
||||||
heal_scale_stat = 14
|
heal_scale_stat = 14
|
||||||
heal_scale_coeff = 0.1
|
heal_scale_coeff = 0.1
|
||||||
|
resource_cost = SubResource( 1 )
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
@ -32,7 +32,7 @@ func _handle_aura_damage(aura_data : AuraData, damage_info : SpellDamageInfo) ->
|
|||||||
damage_info.damage = damage_min + (randi() % (damage_max - damage_min))
|
damage_info.damage = damage_min + (randi() % (damage_max - damage_min))
|
||||||
|
|
||||||
if scale_with_level:
|
if scale_with_level:
|
||||||
damage_info.damage *= damage_info.dealer.scharacter_level / float(EntityEnums.MAX_CHARACTER_LEVEL)
|
damage_info.damage *= int(float(damage_info.dealer.scharacter_level) / float(EntityEnums.MAX_CHARACTER_LEVEL))
|
||||||
|
|
||||||
damage_info.damage_source_type = aura_data.aura.damage_type
|
damage_info.damage_source_type = aura_data.aura.damage_type
|
||||||
|
|
||||||
|
@ -21,11 +21,46 @@ class_name ManaResource
|
|||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
# SOFTWARE.
|
# SOFTWARE.
|
||||||
|
|
||||||
func _init():
|
var mana_regen : int = 10
|
||||||
should_process = false
|
var tickrate : float = 2
|
||||||
|
var timer : float = 0
|
||||||
|
|
||||||
#func _ons_stat_changed(stat : Stat):
|
func _init():
|
||||||
# print(stat.get_id())
|
should_process = true
|
||||||
|
|
||||||
|
func _ons_added(entity):
|
||||||
|
refresh()
|
||||||
|
|
||||||
|
func _ons_stat_changed(stat : Stat):
|
||||||
|
if stat.id == Stat.STAT_ID_INTELLECT || stat.id == Stat.STAT_ID_SPIRIT:
|
||||||
|
refresh()
|
||||||
|
|
||||||
|
func refresh():
|
||||||
|
var intellect : Stat = owner.get_stat_int(Stat.STAT_ID_INTELLECT)
|
||||||
|
var spirit : Stat = owner.get_stat_int(Stat.STAT_ID_SPIRIT)
|
||||||
|
|
||||||
|
var m : bool = false
|
||||||
|
|
||||||
|
if max_value == current_value:
|
||||||
|
m = true
|
||||||
|
|
||||||
|
var nv : int = int(intellect.scurrent) * 10
|
||||||
|
|
||||||
|
max_value = nv
|
||||||
|
|
||||||
|
if m:
|
||||||
|
current_value = nv
|
||||||
|
|
||||||
|
mana_regen = int(spirit.scurrent)
|
||||||
|
|
||||||
func _process_server(delta):
|
func _process_server(delta):
|
||||||
pass
|
timer += delta
|
||||||
|
|
||||||
|
if timer > tickrate:
|
||||||
|
timer -= tickrate
|
||||||
|
|
||||||
|
if current_value < max_value:
|
||||||
|
current_value += mana_regen
|
||||||
|
|
||||||
|
if current_value > max_value:
|
||||||
|
current_value = max_value
|
||||||
|
@ -21,5 +21,8 @@ extends EntityResourceData
|
|||||||
# SOFTWARE.
|
# SOFTWARE.
|
||||||
|
|
||||||
func _get_entity_resource_instance() -> EntityResource:
|
func _get_entity_resource_instance() -> EntityResource:
|
||||||
return ManaResource.new()
|
var mr = ManaResource.new()
|
||||||
|
mr.data_id = id
|
||||||
|
|
||||||
|
return mr
|
||||||
|
|
||||||
|
@ -62,9 +62,23 @@ func _sstart_casting(info : SpellCastInfo) -> void:
|
|||||||
if (c - t).length() > range_range:
|
if (c - t).length() > range_range:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if resource_cost != null and resource_cost.entity_resource_data != null:
|
||||||
|
var r : EntityResource = info.caster.gets_resource_id(resource_cost.entity_resource_data.id)
|
||||||
|
|
||||||
|
if r == null:
|
||||||
|
return
|
||||||
|
|
||||||
|
if r.current_value < resource_cost.cost:
|
||||||
|
return
|
||||||
|
|
||||||
if cast_enabled:
|
if cast_enabled:
|
||||||
info.caster.sstart_casting(info)
|
info.caster.sstart_casting(info)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if resource_cost != null and resource_cost.entity_resource_data != null:
|
||||||
|
var r : EntityResource = info.caster.gets_resource_id(resource_cost.entity_resource_data.id)
|
||||||
|
|
||||||
|
r.current_value -= resource_cost.cost
|
||||||
|
|
||||||
info.caster.sspell_cast_success(info)
|
info.caster.sspell_cast_success(info)
|
||||||
|
|
||||||
@ -81,6 +95,15 @@ func _sstart_casting(info : SpellCastInfo) -> void:
|
|||||||
handle_gcd(info)
|
handle_gcd(info)
|
||||||
|
|
||||||
func _sfinish_cast(info : SpellCastInfo) -> void:
|
func _sfinish_cast(info : SpellCastInfo) -> void:
|
||||||
|
if resource_cost != null and resource_cost.entity_resource_data != null:
|
||||||
|
var r : EntityResource = info.caster.gets_resource_id(resource_cost.entity_resource_data.id)
|
||||||
|
|
||||||
|
if r.current_value < resource_cost.cost:
|
||||||
|
info.caster.son_cast_failed(info)
|
||||||
|
return
|
||||||
|
|
||||||
|
r.current_value -= resource_cost.cost
|
||||||
|
|
||||||
info.caster.son_cast_finished(info)
|
info.caster.son_cast_finished(info)
|
||||||
info.caster.sspell_cast_success(info)
|
info.caster.sspell_cast_success(info)
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
extends UnitFrame
|
extends VBoxContainer
|
||||||
|
|
||||||
# Copyright (c) 2019-2020 Péter Magyar
|
# Copyright (c) 2019-2020 Péter Magyar
|
||||||
#
|
#
|
||||||
@ -25,20 +25,27 @@ export (PackedScene) var aura_entry_scene : PackedScene
|
|||||||
export (NodePath) var name_text_path : NodePath
|
export (NodePath) var name_text_path : NodePath
|
||||||
export (NodePath) var health_range_path : NodePath
|
export (NodePath) var health_range_path : NodePath
|
||||||
export (NodePath) var health_text_path : NodePath
|
export (NodePath) var health_text_path : NodePath
|
||||||
|
export (NodePath) var resource_range_path : NodePath
|
||||||
|
export (NodePath) var resource_text_path : NodePath
|
||||||
export (NodePath) var aura_grid_path : NodePath
|
export (NodePath) var aura_grid_path : NodePath
|
||||||
|
|
||||||
var _name_text : Label
|
var _name_text : Label
|
||||||
var _health_range : Range
|
var _health_range : Range
|
||||||
var _health_text : Label
|
var _health_text : Label
|
||||||
|
var _resource_range : Range
|
||||||
|
var _resource_text : Label
|
||||||
var _aura_grid : GridContainer
|
var _aura_grid : GridContainer
|
||||||
|
|
||||||
var _player : Entity
|
var _player : Entity
|
||||||
|
var _mana : ManaResource
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
_name_text = get_node(name_text_path) as Label
|
_name_text = get_node(name_text_path) as Label
|
||||||
_health_range = get_node(health_range_path) as Range
|
_health_range = get_node(health_range_path) as Range
|
||||||
_health_text = get_node(health_text_path) as Label
|
_health_text = get_node(health_text_path) as Label
|
||||||
|
_resource_range = get_node(resource_range_path) as Range
|
||||||
|
_resource_text = get_node(resource_text_path) as Label
|
||||||
_aura_grid = get_node(aura_grid_path) as GridContainer
|
_aura_grid = get_node(aura_grid_path) as GridContainer
|
||||||
|
|
||||||
func set_player(p_player : Entity) -> void:
|
func set_player(p_player : Entity) -> void:
|
||||||
@ -47,6 +54,11 @@ func set_player(p_player : Entity) -> void:
|
|||||||
_player.disconnect("caura_added", self, "on_caura_added")
|
_player.disconnect("caura_added", self, "on_caura_added")
|
||||||
_player.disconnect("caura_removed", self, "on_caura_removed")
|
_player.disconnect("caura_removed", self, "on_caura_removed")
|
||||||
_player.disconnect("cdied", self, "cdied")
|
_player.disconnect("cdied", self, "cdied")
|
||||||
|
_player.disconnect("centity_resource_added", self, "centity_resource_added")
|
||||||
|
|
||||||
|
if _mana != null:
|
||||||
|
_mana.disconnect("changed", self, "_on_mana_changed")
|
||||||
|
_mana = null
|
||||||
|
|
||||||
for a in _aura_grid.get_children():
|
for a in _aura_grid.get_children():
|
||||||
_aura_grid.remove_child(a)
|
_aura_grid.remove_child(a)
|
||||||
@ -70,6 +82,10 @@ func set_player(p_player : Entity) -> void:
|
|||||||
_player.connect("caura_added", self, "on_caura_added")
|
_player.connect("caura_added", self, "on_caura_added")
|
||||||
_player.connect("caura_removed", self, "on_caura_removed")
|
_player.connect("caura_removed", self, "on_caura_removed")
|
||||||
_player.connect("cdied", self, "cdied", [], CONNECT_DEFERRED)
|
_player.connect("cdied", self, "cdied", [], CONNECT_DEFERRED)
|
||||||
|
_player.connect("centity_resource_added", self, "centity_resource_added")
|
||||||
|
|
||||||
|
for i in range(_player.getc_resource_count()):
|
||||||
|
centity_resource_added(_player.getc_resource_index(i))
|
||||||
|
|
||||||
var health = _player.get_health()
|
var health = _player.get_health()
|
||||||
_on_player_health_changed(health)
|
_on_player_health_changed(health)
|
||||||
@ -79,6 +95,29 @@ func set_player(p_player : Entity) -> void:
|
|||||||
|
|
||||||
set_process(true)
|
set_process(true)
|
||||||
show()
|
show()
|
||||||
|
|
||||||
|
func centity_resource_added(res : EntityResource):
|
||||||
|
if res is ManaResource:
|
||||||
|
_mana= res as ManaResource
|
||||||
|
|
||||||
|
_mana.connect("changed", self, "_on_mana_changed")
|
||||||
|
_on_mana_changed(_mana)
|
||||||
|
|
||||||
|
func _on_mana_changed(resource: EntityResource) -> void:
|
||||||
|
if resource.max_value == 0:
|
||||||
|
_resource_range.min_value = 0
|
||||||
|
_resource_range.max_value = 1
|
||||||
|
_resource_range.value = 0
|
||||||
|
|
||||||
|
_resource_text.text = ""
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
_resource_range.min_value = 0
|
||||||
|
_resource_range.max_value = resource.max_value
|
||||||
|
_resource_range.value = resource.current_value
|
||||||
|
|
||||||
|
_resource_text.text = str(resource.current_value) + "/" + str(resource.max_value)
|
||||||
|
|
||||||
func on_caura_added(aura_data : AuraData) -> void:
|
func on_caura_added(aura_data : AuraData) -> void:
|
||||||
var created_node : Node = aura_entry_scene.instance()
|
var created_node : Node = aura_entry_scene.instance()
|
||||||
|
@ -1,75 +1,93 @@
|
|||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://ui/unitframes/TargetUnitframe.gd" type="Script" id=1]
|
[ext_resource path="res://ui/unitframes/TargetUnitframe.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://ui/auraframe/AuraEntry.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://ui/auraframe/AuraEntry.tscn" type="PackedScene" id=2]
|
||||||
|
[ext_resource path="res://ui/theme/ui_theme.tres" type="Theme" id=3]
|
||||||
|
|
||||||
[node name="TargetUnitframe" type="UnitFrame"]
|
[node name="TargetUnitframe" type="VBoxContainer"]
|
||||||
margin_left = 151.0
|
margin_left = 151.0
|
||||||
margin_right = 300.0
|
margin_right = 300.0
|
||||||
margin_bottom = 57.0
|
margin_bottom = 209.0
|
||||||
|
theme = ExtResource( 3 )
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
aura_entry_scene = ExtResource( 2 )
|
aura_entry_scene = ExtResource( 2 )
|
||||||
name_text_path = NodePath("MarginContainer/HBoxContainer/VBoxContainer/Label")
|
name_text_path = NodePath("MarginContainer/VBoxContainer/Label")
|
||||||
health_range_path = NodePath("MarginContainer/HBoxContainer/VBoxContainer/MarginContainer/ProgressBar")
|
health_range_path = NodePath("MarginContainer/VBoxContainer/MarginContainer/ProgressBar")
|
||||||
health_text_path = NodePath("MarginContainer/HBoxContainer/VBoxContainer/MarginContainer/Label")
|
health_text_path = NodePath("MarginContainer/VBoxContainer/MarginContainer/Label")
|
||||||
|
resource_range_path = NodePath("MarginContainer/VBoxContainer/MarginContainer2/ProgressBar")
|
||||||
|
resource_text_path = NodePath("MarginContainer/VBoxContainer/MarginContainer2/Label")
|
||||||
aura_grid_path = NodePath("auras")
|
aura_grid_path = NodePath("auras")
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
[node name="MarginContainer" type="PanelContainer" parent="."]
|
||||||
anchor_right = 1.0
|
margin_right = 149.0
|
||||||
anchor_bottom = 1.0
|
margin_bottom = 53.0
|
||||||
margin_bottom = -1.0
|
|
||||||
custom_constants/margin_right = 2
|
|
||||||
custom_constants/margin_top = 2
|
|
||||||
custom_constants/margin_left = 2
|
|
||||||
custom_constants/margin_bottom = 2
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
|
|
||||||
margin_left = 2.0
|
|
||||||
margin_top = 2.0
|
|
||||||
margin_right = 147.0
|
|
||||||
margin_bottom = 54.0
|
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||||
|
margin_left = 4.0
|
||||||
|
margin_top = 4.0
|
||||||
margin_right = 145.0
|
margin_right = 145.0
|
||||||
margin_bottom = 52.0
|
margin_bottom = 49.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
custom_constants/separation = 0
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer"]
|
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||||
margin_right = 145.0
|
margin_right = 141.0
|
||||||
margin_bottom = 14.0
|
margin_bottom = 15.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
valign = 1
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/HBoxContainer/VBoxContainer"]
|
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/VBoxContainer"]
|
||||||
margin_top = 18.0
|
margin_top = 15.0
|
||||||
margin_right = 145.0
|
margin_right = 141.0
|
||||||
margin_bottom = 32.0
|
margin_bottom = 30.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
custom_constants/margin_top = 0
|
||||||
|
custom_constants/margin_bottom = 0
|
||||||
|
|
||||||
[node name="ProgressBar" type="ProgressBar" parent="MarginContainer/HBoxContainer/VBoxContainer/MarginContainer"]
|
[node name="ProgressBar" type="ProgressBar" parent="MarginContainer/VBoxContainer/MarginContainer"]
|
||||||
margin_right = 145.0
|
margin_right = 141.0
|
||||||
margin_bottom = 14.0
|
margin_bottom = 15.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
percent_visible = false
|
percent_visible = false
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer/MarginContainer"]
|
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/MarginContainer"]
|
||||||
margin_right = 145.0
|
margin_right = 141.0
|
||||||
margin_bottom = 14.0
|
margin_bottom = 15.0
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
|
|
||||||
|
[node name="MarginContainer2" type="MarginContainer" parent="MarginContainer/VBoxContainer"]
|
||||||
|
margin_top = 30.0
|
||||||
|
margin_right = 141.0
|
||||||
|
margin_bottom = 45.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
custom_constants/margin_top = 0
|
||||||
|
custom_constants/margin_bottom = 0
|
||||||
|
|
||||||
|
[node name="ProgressBar" type="ProgressBar" parent="MarginContainer/VBoxContainer/MarginContainer2"]
|
||||||
|
margin_right = 141.0
|
||||||
|
margin_bottom = 15.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
percent_visible = false
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/MarginContainer2"]
|
||||||
|
margin_right = 141.0
|
||||||
|
margin_bottom = 15.0
|
||||||
align = 1
|
align = 1
|
||||||
valign = 1
|
valign = 1
|
||||||
|
|
||||||
[node name="auras" type="GridContainer" parent="."]
|
[node name="auras" type="GridContainer" parent="."]
|
||||||
margin_left = 1.0
|
|
||||||
margin_top = 61.0
|
margin_top = 61.0
|
||||||
margin_right = 149.0
|
margin_right = 149.0
|
||||||
margin_bottom = 193.0
|
margin_bottom = 209.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
columns = 9
|
columns = 9
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
|
@ -57,6 +57,11 @@ func set_player(p_player: Entity) -> void:
|
|||||||
_player.disconnect("con_level_changed", self, "clevel_changed")
|
_player.disconnect("con_level_changed", self, "clevel_changed")
|
||||||
_player.disconnect("con_xp_gained", self, "con_xp_gained")
|
_player.disconnect("con_xp_gained", self, "con_xp_gained")
|
||||||
_player.disconnect("centity_data_changed", self, "centity_data_changed")
|
_player.disconnect("centity_data_changed", self, "centity_data_changed")
|
||||||
|
_player.disconnect("centity_resource_added", self, "centity_resource_added")
|
||||||
|
|
||||||
|
if _mana != null:
|
||||||
|
_mana.disconnect("changed", self, "_on_mana_changed")
|
||||||
|
_mana = null
|
||||||
|
|
||||||
_player = null
|
_player = null
|
||||||
|
|
||||||
@ -70,12 +75,10 @@ func set_player(p_player: Entity) -> void:
|
|||||||
_player.connect("con_character_level_changed", self, "clevel_changed")
|
_player.connect("con_character_level_changed", self, "clevel_changed")
|
||||||
_player.connect("con_xp_gained", self, "con_xp_gained")
|
_player.connect("con_xp_gained", self, "con_xp_gained")
|
||||||
_player.connect("centity_data_changed", self, "centity_data_changed")
|
_player.connect("centity_data_changed", self, "centity_data_changed")
|
||||||
|
_player.connect("centity_resource_added", self, "centity_resource_added")
|
||||||
|
|
||||||
if _player.getc_resource_count() > 0:
|
for i in range(_player.getc_resource_count()):
|
||||||
var mana : ManaResource = _player.getc_resource_index(0) as ManaResource
|
centity_resource_added(_player.getc_resource_index(i))
|
||||||
|
|
||||||
if mana != null:
|
|
||||||
mana.connect("changed", self, "_on_mana_changed")
|
|
||||||
|
|
||||||
var health = _player.get_health()
|
var health = _player.get_health()
|
||||||
_on_player_health_changed(health)
|
_on_player_health_changed(health)
|
||||||
@ -87,6 +90,13 @@ func set_player(p_player: Entity) -> void:
|
|||||||
clevel_changed(_player, 0)
|
clevel_changed(_player, 0)
|
||||||
con_xp_gained(_player, 0)
|
con_xp_gained(_player, 0)
|
||||||
|
|
||||||
|
func centity_resource_added(res : EntityResource):
|
||||||
|
if res is ManaResource:
|
||||||
|
_mana = res as ManaResource
|
||||||
|
|
||||||
|
_mana.connect("changed", self, "_on_mana_changed")
|
||||||
|
_on_mana_changed(_mana)
|
||||||
|
|
||||||
func _on_player_health_changed(health: Stat) -> void:
|
func _on_player_health_changed(health: Stat) -> void:
|
||||||
if health.cmax == 0:
|
if health.cmax == 0:
|
||||||
_health_range.min_value = 0
|
_health_range.min_value = 0
|
||||||
@ -104,20 +114,20 @@ func _on_player_health_changed(health: Stat) -> void:
|
|||||||
_health_text.text = str(health.ccurrent) + "/" + str(health.cmax)
|
_health_text.text = str(health.ccurrent) + "/" + str(health.cmax)
|
||||||
|
|
||||||
func _on_mana_changed(resource: EntityResource) -> void:
|
func _on_mana_changed(resource: EntityResource) -> void:
|
||||||
if resource.max == 0:
|
if resource.max_value == 0:
|
||||||
_resource_range.min_value = 0
|
_resource_range.min_value = 0
|
||||||
_resource_range.max_value = 1
|
_resource_range.max_value = 1
|
||||||
_resource_range.value = 0
|
_resource_range.value = 0
|
||||||
|
|
||||||
_resource_range.text = ""
|
_resource_text.text = ""
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
_resource_range.min_value = 0
|
_resource_range.min_value = 0
|
||||||
_resource_range.max_value = resource.cmax
|
_resource_range.max_value = resource.max_value
|
||||||
_resource_range.value = resource.ccurrent
|
_resource_range.value = resource.current_value
|
||||||
|
|
||||||
_resource_range.text = str(resource.ccurrent) + "/" + str(resource.cmax)
|
_resource_text.text = str(resource.current_value) + "/" + str(resource.max_value)
|
||||||
|
|
||||||
func cname_changed(entity: Entity) -> void:
|
func cname_changed(entity: Entity) -> void:
|
||||||
_name_text.text = _player.centity_name
|
_name_text.text = _player.centity_name
|
||||||
|
@ -79,6 +79,8 @@ margin_right = 142.0
|
|||||||
margin_bottom = 15.0
|
margin_bottom = 15.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
|
|
||||||
[node name="XPBar" type="ProgressBar" parent="VBoxContainer"]
|
[node name="XPBar" type="ProgressBar" parent="VBoxContainer"]
|
||||||
margin_top = 48.0
|
margin_top = 48.0
|
||||||
|
@ -173,7 +173,7 @@ func n_add_chunk(b : Node) -> void:
|
|||||||
|
|
||||||
var temp_verts : Array = Array()
|
var temp_verts : Array = Array()
|
||||||
|
|
||||||
var carr : Dictionary
|
var carr : Dictionary = Dictionary()
|
||||||
|
|
||||||
for t in type_arr:
|
for t in type_arr:
|
||||||
if carr.has(t):
|
if carr.has(t):
|
||||||
|
Loading…
Reference in New Issue
Block a user