Extract MatchParticipantComponent from Player entity and fix HealthComponent tests

This commit is contained in:
Squinty 2024-04-27 13:32:03 +00:00
parent d238c29f76
commit b339bf34f0
23 changed files with 149 additions and 124 deletions

View file

@ -15,6 +15,7 @@
extends Control
@export var player : Player
@export var match_participant_component : MatchParticipantComponent
@export var attach_point : Marker3D
@export var healthbar_low_health_color : Color = Color(1 ,0 ,0, 0.78)
@export var healthbar_mid_health_color : Color = Color(1, 1, 0, 0.78)
@ -28,8 +29,8 @@ extends Control
@onready var is_within_los : bool = false
@onready var healthbar_fill_stylebox : StyleBoxFlat = _health_bar.get_theme_stylebox("fill")
func _ready() -> void:
_player_name_label.text = player.nickname
func set_nickname(new_nickname : String) -> void:
_player_name_label.text = new_nickname
func _process(_delta : float) -> void:
# retrieve camera for current viewport
@ -44,7 +45,7 @@ func _process(_delta : float) -> void:
# Show the correct IFF based on whether the player we're looking at belongs is a friend or a foe
# in other words if their team_ids are the same as the "pawn" player
if player.pawn_player != null:
if player.pawn_player.team_id == player.team_id:
if player.pawn_player.match_participant_component.team_id == player.match_participant_component.team_id:
%FoeChevron.hide()
%FriendChevron.show()
else: