P23-03: 生活の観察

This commit is contained in:
Agent Control Runner
2026-10-16 17:15:06 +09:00
parent 93248f4d79
commit 26f60095bf
7 changed files with 422 additions and 53 deletions
+25 -2
View File
@@ -10,19 +10,20 @@ class QueueWorld extends RefCounted:
func get_bounds() -> Dictionary:
return {&"min_x": -1, &"max_x": 2, &"min_y": 0, &"max_y": 1}
func is_walkable(cell: Vector3i) -> bool:
return cell.y == 0 and cell.x >= -1 and cell.x <= 2
return cell.y >= 0 and cell.y <= 1 and cell.x >= -1 and cell.x <= 2
func get_occupant(_cell: Vector3i) -> StringName:
return &""
class QueueLift extends RefCounted:
var layer := 0
var visual_floor := 0.3
func get_report() -> Dictionary:
var trips: Array = []
for i: int in 3:
trips.append({&"state": PathService.ELEVATOR_REQUEST_QUEUED, &"from": Vector3i(0,0,layer),
&"actor_id": "guest:q%d" % i, &"enqueued_at": i})
return {&"shafts": [{&"shaft_id": &"wide", &"stops": [Vector3i(0,0,layer), Vector3i(0,1,layer)],
&"width": 2, &"capacity": 4, &"boarded": [], &"visual_floor": 0.3,
&"width": 2, &"capacity": 4, &"boarded": [], &"visual_floor": visual_floor,
&"operational": true, &"phase": &"PICKUP"}], &"trips": trips}
class QueueRuntime extends RefCounted:
@@ -52,6 +53,28 @@ func repair28_geometry() -> void:
expect(not cabins[0][&"rect"].has_point(at), "queue anchor outside empty cabin")
expect(cabins[0][&"passenger_count"] == 0 and cabins[0][&"passengers"].is_empty(), "empty cabin has no passenger")
expect(cabins[0][&"operational"] and not cabins[0][&"doors_open"] and cabins[0][&"phase"] == &"PICKUP", "typed moving cabin state")
for floor: float in [0.0, 0.8]:
fixture.elevators.visual_floor = floor
var pose_model: Dictionary = view._observe_queues()
var cell := Vector3i(0, 0 if floor == 0 else 1, layer)
var key := "guest/landing"
var person := {&"id": &"landing", &"cell": cell, &"service": &"", &"target": &""}
pose_model.merge({&"boarded": {}, &"elevator_tracks": {}, &"paused": true,
&"actor_tracks": {key: {&"cell": cell, &"from": cell, &"at": 0.0, &"direction": 1.0}},
&"rooms": {}, &"guests": [person], &"staff": [], &"carried_patients": {},
&"resting_staff": {}, &"treated_patients": {}})
pose_model[&"cabins"] = view._observe_elevators(pose_model)
var row: Dictionary = view._actor_drawing(view.cell_to_canvas(cell), key, false,
GuestRuntime.State.MOVING, false, false, &"", false, pose_model)
var region: Dictionary = view._life_actor_region(row, person, pose_model)
expect(region.has(&"center") and not region[&"transit"], "same-floor and fractional cabin use landing region")
expect(not (region[&"bounds"] as Rect2).intersects(pose_model[&"cabins"][0][&"rect"]), "landing bounds outside cabin")
pose_model[&"actor_drawings"] = [row]
view._fit_life_actors(pose_model)
expect(pose_model[&"actor_drawings"].size() == 1 and pose_model[&"actor_aggregations"].is_empty(), "landing actor retained")
expect(not view._life_core(row).intersects(pose_model[&"cabins"][0][&"rect"]), "fitted non-passenger core outside cabin")
expect(row[&"cell"] == cell and not row[&"riding"] and row[&"state"] == GuestRuntime.State.MOVING, "landing placement preserves actual state")
fixture.elevators.visual_floor = 0.3
for operational: bool in [true,false]:
for phase: StringName in [&"IDLE", &"BOARDING", &"PICKUP"]:
var shaft: Dictionary = fixture.elevators.get_report()[&"shafts"][0]