mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Fix "Cannot get ratio when minimum and maximum value are equal." Errors, and small tweaks to Nameplates.
This commit is contained in:
parent
3ad461adb5
commit
4ceb9f134c
@ -46,7 +46,7 @@ var health_bar_label : Label = null
|
|||||||
var entity : Entity = null
|
var entity : Entity = null
|
||||||
var health : EntityResource = null
|
var health : EntityResource = null
|
||||||
|
|
||||||
func _ready():
|
func _enter_tree():
|
||||||
name_label = get_node(name_label_path) as Label
|
name_label = get_node(name_label_path) as Label
|
||||||
health_bar = get_node(health_bar_path) as TextureProgress
|
health_bar = get_node(health_bar_path) as TextureProgress
|
||||||
health_bar_label = get_node(health_bar_label_path) as Label
|
health_bar_label = get_node(health_bar_label_path) as Label
|
||||||
@ -126,6 +126,7 @@ func c_health_changed(stat : EntityResource) -> void:
|
|||||||
if stat.max_value == 0:
|
if stat.max_value == 0:
|
||||||
health_bar.max_value = 1
|
health_bar.max_value = 1
|
||||||
health_bar.value = 0
|
health_bar.value = 0
|
||||||
|
return
|
||||||
|
|
||||||
health_bar.max_value = stat.max_value
|
health_bar.max_value = stat.max_value
|
||||||
health_bar.value = stat.current_value
|
health_bar.value = stat.current_value
|
||||||
|
@ -133,8 +133,16 @@ func cname_changed(entity: Entity) -> void:
|
|||||||
func clevel_changed(entity: Entity, value : int) -> void:
|
func clevel_changed(entity: Entity, value : int) -> void:
|
||||||
_level_text.text = str(_player.ccharacter_level)
|
_level_text.text = str(_player.ccharacter_level)
|
||||||
|
|
||||||
|
var xpreq : int = ESS.get_resource_db().get_xp_data().get_character_xp(_player.ccharacter_level)
|
||||||
|
|
||||||
|
if xpreq == 0:
|
||||||
|
_xp_range.value = 0
|
||||||
_xp_range.min_value = 0
|
_xp_range.min_value = 0
|
||||||
_xp_range.max_value = ESS.get_resource_db().get_xp_data().get_character_xp(_player.ccharacter_level)
|
_xp_range.max_value = 1
|
||||||
|
return
|
||||||
|
|
||||||
|
_xp_range.min_value = 0
|
||||||
|
_xp_range.max_value = xpreq
|
||||||
|
|
||||||
func notification_cxp_gained(entity: Entity, val: int) -> void:
|
func notification_cxp_gained(entity: Entity, val: int) -> void:
|
||||||
_xp_range.value = _player.ccharacter_xp
|
_xp_range.value = _player.ccharacter_xp
|
||||||
|
Loading…
Reference in New Issue
Block a user