feat: Implement tile scarcity model for tile generation and power-up inventory UI for player interaction.
This commit is contained in:
@@ -19,6 +19,7 @@ var is_match_active: bool = false
|
||||
# Score tracking: peer_id -> score
|
||||
var player_scores: Dictionary = {}
|
||||
var player_goal_counts: Dictionary = {} # peer_id -> count
|
||||
var stop_n_go_winner_id: int = -1 # Track winner for Stop n Go sorting
|
||||
|
||||
# Reference to main scene
|
||||
var main_scene: Node = null
|
||||
@@ -299,8 +300,16 @@ func _update_leaderboard():
|
||||
var sorted_scores = []
|
||||
for peer_id in player_scores.keys():
|
||||
sorted_scores.append({"peer_id": peer_id, "score": player_scores[peer_id]})
|
||||
|
||||
sorted_scores.sort_custom(func(a, b): return a.score > b.score)
|
||||
# Custom Sort for Stop n Go
|
||||
if stop_n_go_winner_id != -1:
|
||||
sorted_scores.sort_custom(func(a, b):
|
||||
if a.peer_id == stop_n_go_winner_id: return true
|
||||
if b.peer_id == stop_n_go_winner_id: return false
|
||||
return a.score > b.score
|
||||
)
|
||||
else:
|
||||
sorted_scores.sort_custom(func(a, b): return a.score > b.score)
|
||||
|
||||
emit_signal("leaderboard_updated", sorted_scores)
|
||||
|
||||
# =============================================================================
|
||||
@@ -432,7 +441,17 @@ func get_leaderboard() -> Array:
|
||||
var sorted_scores = []
|
||||
for peer_id in player_scores.keys():
|
||||
sorted_scores.append({"peer_id": peer_id, "score": player_scores[peer_id]})
|
||||
sorted_scores.sort_custom(func(a, b): return a.score > b.score)
|
||||
|
||||
# Custom Sort for Stop n Go
|
||||
if stop_n_go_winner_id != -1:
|
||||
sorted_scores.sort_custom(func(a, b):
|
||||
if a.peer_id == stop_n_go_winner_id: return true
|
||||
if b.peer_id == stop_n_go_winner_id: return false
|
||||
return a.score > b.score
|
||||
)
|
||||
else:
|
||||
sorted_scores.sort_custom(func(a, b): return a.score > b.score)
|
||||
|
||||
return sorted_scores
|
||||
|
||||
func get_time_remaining() -> float:
|
||||
|
||||
Reference in New Issue
Block a user