mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-16 08:55:33 +00:00
🐛 multiplayer fix
This commit is contained in:
parent
7498d4206c
commit
de902271df
26 changed files with 147 additions and 147 deletions
|
|
@ -26,8 +26,8 @@ func _setup_player(player_id : int) -> Player:
|
|||
var player : Player = PLAYER.instantiate()
|
||||
player.name = str(player_id)
|
||||
add_child(player) # we can't autofree in this test setup
|
||||
var participant : MatchParticipantComponent = player.match_participant_component
|
||||
player.match_participant_component.player_id = player_id
|
||||
var participant : MatchParticipant = player.match_participant
|
||||
player.match_participant.player_id = player_id
|
||||
_scoreboard.add_participant(participant)
|
||||
_subject.subscribe_player(player)
|
||||
_subject._players = self
|
||||
|
|
@ -50,7 +50,7 @@ func after_each() -> void:
|
|||
_subject.free()
|
||||
|
||||
func _kill_player(victim : Player, killer : Player) -> void:
|
||||
victim.died.emit(victim, killer.match_participant_component.player_id)
|
||||
victim.died.emit(victim, killer.match_participant.player_id)
|
||||
|
||||
func test_player_gets_no_score_for_self_kill() -> void:
|
||||
_kill_player(_victim, _victim)
|
||||
|
|
@ -59,8 +59,8 @@ func test_player_gets_no_score_for_self_kill() -> void:
|
|||
|
||||
func test_killer_gets_score_after_kill() -> void:
|
||||
_kill_player(_victim, _killer)
|
||||
assert_called(_scoreboard, 'add_score_to_player', [_killer.match_participant_component, _subject.ON_KILL_SCORE])
|
||||
assert_called(_scoreboard, 'increment_kill_count', [_killer.match_participant_component])
|
||||
assert_called(_scoreboard, 'add_score_to_player', [_killer.match_participant, _subject.ON_KILL_SCORE])
|
||||
assert_called(_scoreboard, 'increment_kill_count', [_killer.match_participant])
|
||||
|
||||
func test_killer_leaves_before_kill() -> void:
|
||||
remove_child(_killer)
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@ func before_each() -> void:
|
|||
_subject = HealthComponent.new()
|
||||
watch_signals(_subject)
|
||||
_subject.max_health = TEST_MAX_HEALTH
|
||||
var participant : MatchParticipantComponent = MatchParticipantComponent.new()
|
||||
var participant : MatchParticipant = MatchParticipant.new()
|
||||
participant.player_id = TEST_PLAYER_ID
|
||||
participant.team_id = TEST_TEAM_ID
|
||||
_subject.match_participant_component = participant
|
||||
_subject.match_participant = participant
|
||||
add_child_autofree(_subject)
|
||||
|
||||
func after_each() -> void:
|
||||
_subject.match_participant_component.free()
|
||||
_subject.match_participant.free()
|
||||
|
||||
func test_that_it_has_max_health_when_ready() -> void:
|
||||
assert_eq(_subject.health, _subject.max_health)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ func test_that_new_scoreboard_is_empty() -> void:
|
|||
assert_eq(_subject._entries, {})
|
||||
|
||||
func test_that_added_entry_is_added_correctly() -> void:
|
||||
var participant : MatchParticipantComponent = MatchParticipantComponent.new()
|
||||
var participant : MatchParticipant = MatchParticipant.new()
|
||||
participant.username = "test_username"
|
||||
_subject.add_participant(participant)
|
||||
var entries : Array = _subject._entries.values()
|
||||
|
|
@ -38,7 +38,7 @@ func test_that_added_entry_is_added_correctly() -> void:
|
|||
participant.free()
|
||||
|
||||
func test_that_scores_are_added_correctly() -> void:
|
||||
var participant : MatchParticipantComponent = MatchParticipantComponent.new()
|
||||
var participant : MatchParticipant = MatchParticipant.new()
|
||||
_subject.add_participant(participant)
|
||||
_subject.add_score_to_player(participant, 10)
|
||||
var tested_entry : Scoreboard.ScoreboardEntry = _subject._entries.values()[0]
|
||||
|
|
@ -46,7 +46,7 @@ func test_that_scores_are_added_correctly() -> void:
|
|||
participant.free()
|
||||
|
||||
func test_that_kill_counts_are_incremented_correctly() -> void:
|
||||
var participant : MatchParticipantComponent = MatchParticipantComponent.new()
|
||||
var participant : MatchParticipant = MatchParticipant.new()
|
||||
_subject.add_participant(participant)
|
||||
_subject.increment_kill_count(participant)
|
||||
var tested_entry : Scoreboard.ScoreboardEntry = _subject._entries.values()[0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue