Added shield and armor sprite usage

This commit is contained in:
2025-11-30 23:18:12 +03:00
parent 1e8adcb23b
commit 741ebcf316
13 changed files with 159 additions and 74 deletions
+6 -6
View File
@@ -2,9 +2,9 @@ class_name Health
extends Node
signal shield_updated(value: int)
signal armor_updated(value: int)
signal hull_updated(value: int)
signal shield_updated(value: int, max_value: int)
signal armor_updated(value: int, max_value: int)
signal hull_updated(value: int, max_value: int)
signal depleted
@@ -32,15 +32,15 @@ var hull: int:
@onready var _shield := max_shield:
set(value):
_shield = value
shield_updated.emit(_shield)
shield_updated.emit(_shield, max_shield)
@onready var _armor := max_armor:
set(value):
_armor = value
armor_updated.emit(_armor)
armor_updated.emit(_armor, max_armor)
@onready var _hull := max_hull:
set(value):
_hull = value
hull_updated.emit(_hull)
hull_updated.emit(_hull, max_hull)
@onready var _shield_regen := floori(max_shield/30.0)
+12 -8
View File
@@ -33,18 +33,22 @@ func _ready() -> void:
health.hull_updated.connect(_on_hull_updated)
func _on_shield_updated(new_value: int) -> void:
small_shield_part.set_value(new_value)
large_shield_part.set_value(new_value)
func _on_shield_updated(value: int, max_value: int) -> void:
small_shield_part.set_value(value)
large_shield_part.set_value(value)
small_shield_part.set_max_value(max_value)
large_shield_part.set_max_value(max_value)
func _on_armor_updated(new_value: int) -> void:
armor_part.set_value(new_value)
_select_armor_part(new_value)
func _on_armor_updated(value: int, max_value: int) -> void:
armor_part.set_value(value)
armor_part.set_max_value(max_value)
_select_armor_part(value)
func _on_hull_updated(new_value: int) -> void:
hull_part.set_value(new_value)
func _on_hull_updated(value: int, max_value: int) -> void:
hull_part.set_value(value)
hull_part.set_max_value(max_value)
func _select_armor_part(armor_value: int) -> void: