Fix initial value for the nameplates.

This commit is contained in:
Relintai 2020-06-15 15:10:10 +02:00
parent e1219b26f1
commit 3ad461adb5
2 changed files with 5 additions and 4 deletions

View File

@ -123,11 +123,11 @@ func set_max_distance(var value : float) -> void:
max_distance = value max_distance = value
func c_health_changed(stat : EntityResource) -> void: func c_health_changed(stat : EntityResource) -> void:
if stat.current_value != 0: if stat.max_value == 0:
health_bar.max_value = stat.max_value
else:
health_bar.max_value = 1 health_bar.max_value = 1
health_bar.value = 0
health_bar.max_value = stat.max_value
health_bar.value = stat.current_value health_bar.value = stat.current_value
@ -173,3 +173,4 @@ func on_centity_resource_added(resorce) -> void:
health = entity.getc_health() health = entity.getc_health()
health.connect("changed", self, "c_health_changed") health.connect("changed", self, "c_health_changed")
c_health_changed(health)

View File

@ -41,7 +41,7 @@ margin_right = 62.0
margin_bottom = 2.0 margin_bottom = 2.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
value = 50.0 value = 100.0
texture_under = ExtResource( 2 ) texture_under = ExtResource( 2 )
texture_progress = ExtResource( 2 ) texture_progress = ExtResource( 2 )
tint_under = Color( 0.219608, 0.215686, 0.215686, 0.756863 ) tint_under = Color( 0.219608, 0.215686, 0.215686, 0.756863 )