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

@ -30,17 +30,17 @@ func _unhandled_input(event : InputEvent) -> void:
elif event.is_action_released("scoreboard"):
hide()
func add_player(player : Player) -> void:
_add_scoreboard_entry.rpc(player.player_id, player.nickname)
func add_participant(participant : MatchParticipantComponent) -> void:
_add_scoreboard_entry.rpc(participant.player_id, participant.nickname)
func remove_player(player : Player) -> void:
_remove_scoreboard_entry.rpc(player.player_id)
func remove_participant(participant : MatchParticipantComponent) -> void:
_remove_scoreboard_entry.rpc(participant.player_id)
func increment_kill_count(player : Player) -> void:
_entries[player.player_id].kills += 1
func increment_kill_count(participant : MatchParticipantComponent) -> void:
_entries[participant.player_id].kills += 1
func add_score_to_player(player : Player, amount : int) -> void:
var player_id : int = player.player_id
func add_score_to_player(participant : MatchParticipantComponent, amount : int) -> void:
var player_id : int = participant.player_id
var entry : ScoreboardEntry = _entries[player_id]
_update_scoreboard_entry.rpc(player_id, entry.nickname, entry.kills, entry.score + amount)