JHRGB/StatsWindow.gd

44 lines
857 B
GDScript

extends Window
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_timer_timeout():
var pl=0
var po=0
var rpl=0
var gpl=0
var bpl=0
var rpo=0
var gpo=0
var bpo=0
for node in %Map.get_children():
if node is Player:
pl+=1
rpl+=node.carrying_r
gpl+=node.carrying_g
bpl+=node.carrying_b
if node is Pool:
po+=1
rpo+=node.mana_r
gpo+=node.mana_g
bpo+=node.mana_b
$Label.text=\
"Players: "+str(pl)+"\n"+ \
"Pools: "+str(po)+"\n"+ \
"R: "+str(rpo+rpl)+" ("+str(rpo)+"+"+str(rpl)+")\n"+\
"G: "+str(gpo+gpl)+" ("+str(gpo)+"+"+str(gpl)+")\n"+\
"B: "+str(bpo+bpl)+" ("+str(bpo)+"+"+str(bpl)+")\n"
func _on_close_requested():
hide()