P23-03: 生活の観察
This commit is contained in:
+7
-7
@@ -62,6 +62,7 @@ func run(tree: SceneTree, directory: String, layout: String) -> bool:
|
||||
view.size = Vector2(1440, 810)
|
||||
view.set_runtime(runtime)
|
||||
tree.root.add_child(view)
|
||||
stream.watch(view)
|
||||
var finished: Dictionary = {}
|
||||
for offset: int in range(WINDOW + 1):
|
||||
if not ok: break
|
||||
@@ -77,20 +78,19 @@ func run(tree: SceneTree, directory: String, layout: String) -> bool:
|
||||
ok = stream.record("arrival-%s" % arrival[&"id"], {&"offset": offset, &"payload": payload, &"result": result.to_dictionary()}) and result.is_success() and ok
|
||||
# Typed per-minute projections retain paths, queues, density and actual
|
||||
# completed services. Whole aggregate snapshots are only sampled sparsely.
|
||||
var guest_records: Dictionary = runtime.guest_service.create_snapshot()
|
||||
ok = stream.record("tick-%03d" % offset, {&"minute": clock.absolute_minute,
|
||||
&"guests": runtime.guest_service.create_snapshot(), &"path": runtime.path_service.create_snapshot(),
|
||||
&"guests": guest_records, &"path": runtime.path_service.create_snapshot(),
|
||||
&"elevators": runtime.elevators.create_snapshot(), &"facilities": runtime.facility_service.create_snapshot()}) and ok
|
||||
for guest: GuestRuntime in runtime.guest_service.get_guests():
|
||||
if guest.current_cell != GOAL or finished.has(guest.guest_id): continue
|
||||
finished[guest.guest_id] = offset
|
||||
var leaving: Dictionary = runtime.guest_service.begin_leaving(guest.guest_id, clock.absolute_minute, &"COMPARISON_DESTINATION_REACHED")
|
||||
var despawn: Dictionary = runtime.guest_service.despawn_guest(guest.guest_id, clock.absolute_minute)
|
||||
ok = bool(leaving.get(&"ok", false)) and bool(despawn.get(&"ok", false)) and ok
|
||||
for guest: Dictionary in guest_records[&"guests"]:
|
||||
if guest[&"current_cell"] != GOAL or finished.has(guest[&"guest_id"]): continue
|
||||
finished[guest[&"guest_id"]] = offset
|
||||
if offset % 30 == 0:
|
||||
view.queue_redraw()
|
||||
await tree.process_frame
|
||||
await tree.process_frame
|
||||
ok = stream.capture("frame-%03d" % offset, runtime, view) and ok
|
||||
ok = stream.record("first-arrivals", {&"offsets": finished}) and ok
|
||||
ok = stream.record("final", runtime.create_snapshot()) and ok
|
||||
stream.close()
|
||||
view.free()
|
||||
|
||||
Reference in New Issue
Block a user