33 lines
1.2 KiB
GDScript
33 lines
1.2 KiB
GDScript
extends Node
|
|
const ORT := "/tmp/claude-1000/-home-arbeit-projects-pirate-dice/00de2cf5-7327-4fce-b543-2b4db6d3b775/scratchpad"
|
|
var game: Node
|
|
func _ready() -> void:
|
|
Engine.time_scale = 8.0
|
|
add_child(preload("res://scenes/main.tscn").instantiate())
|
|
_lauf()
|
|
func _find(n: Node, w: String) -> Node:
|
|
if n.name == w: return n
|
|
for c in n.get_children():
|
|
var r := _find(c, w)
|
|
if r != null: return r
|
|
return null
|
|
func _lauf() -> void:
|
|
var t := 0.0
|
|
var runden := 0
|
|
var letzte := ""
|
|
while t < 4500.0:
|
|
await get_tree().create_timer(0.5).timeout; t += 0.5
|
|
if game == null:
|
|
game = _find(get_tree().root, "Game"); continue
|
|
if not is_instance_valid(game) or game.phase == "over": break
|
|
if game.phase != letzte:
|
|
letzte = game.phase
|
|
if letzte == "roll": runden += 1
|
|
if is_instance_valid(game):
|
|
print("SERVER: Ende %s '%s' nach %.0fs, Runden=%d" % [game.phase, game.banner, t, runden])
|
|
for i in game.seats.size():
|
|
print("SERVER: Platz %d %s count=%d alive=%s" % [i, game.seats[i].name, game.seats[i].count, game.seats[i].alive])
|
|
# Den Clients Zeit lassen, das Ende zu sehen und selbst zu gehen.
|
|
await get_tree().create_timer(80.0).timeout
|
|
get_tree().quit()
|