sevivon

[DORMANT] multiplayer dreidel game for mobile devices w/ godot
git clone git://git.figbert.com/sevivon.git
Log | Files | Refs | README | LICENSE

commit 4b5bbb7d9909612b291d84d289f850aaa2f1b868
parent 40a85063ac937fcfa1c95a27ae02f4c9826a746d
Author: FIGBERT <figbert@figbert.com>
Date:   Sat, 13 Feb 2021 17:20:19 -0800

Add _compare_player_bool_properties function

Diffstat:
Msrc/scripts/main.gd | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/scripts/main.gd b/src/scripts/main.gd @@ -231,17 +231,18 @@ remote func vibrate_device() -> void: ## Utility Functions func _everyone_anted() -> bool: - var sum := 0 - for id in players.keys(): - sum += int(players[id]["paid_ante"]) - return true if sum == players.size() else false + return _compare_player_bool_properties("paid_ante", players.size()) func _check_for_winner() -> bool: + return _compare_player_bool_properties("in", 1) + + +func _compare_player_bool_properties(prop: String, out: int) -> bool: var sum := 0 for id in players.keys(): - sum += int(players[id]["in"]) - return true if sum == 1 else false + sum += int(players[id][prop]) + return true if sum == out else false func _find_winner() -> int: