host client can now start round and send out shuffled cards, server can spread them to all connected clients

This commit is contained in:
2025-07-07 22:40:46 +02:00
parent 4ac3fbd962
commit 3122df893a
5 changed files with 76 additions and 14 deletions
+3 -3
View File
@@ -2,17 +2,17 @@ extends Node
@export var full_deck: Dictionary[int, Card]
func get_shuffled_cards(player_count: int, cards_to_pick: int) -> Dictionary: # Dictionary[String, Array[int]]
func get_shuffled_cards(client_ids: Array[String], cards_to_pick: int) -> Dictionary: # Dictionary[String, Array[int]]
var dict: Dictionary = {}
var deck: Array[int] = full_deck.keys()
deck.shuffle()
var card_index = 0
for i in player_count:
for client_id in client_ids:
var player_deck: Array[int] = []
for j in cards_to_pick:
player_deck.append(deck[card_index])
card_index += 1
dict[i] = player_deck
dict[client_id] = player_deck
# Add trump card, if there are cards left in the deck
if card_index == 60: