extends SceneTree func _initialize() -> void: call_deferred("run_test") func run_test() -> void: var world = load("res://scenes/main.tscn").instantiate() root.add_child(world) var office = world.get_node("OfficeAtmosphere") assert(get_nodes_in_group("office_props").size() == 6) var desks := 0 var chairs := 0 for prop in get_nodes_in_group("office_props"): if prop.name.begins_with("OfficeDesk"): desks += 1 if prop.name.begins_with("OfficeChair"): chairs += 1 assert(prop.collision_layer == 1) assert(desks == 2 and chairs == 3) print("PASS: due scrivanie, tre sedie, bidone con collisioni") var flames = office.get_node("FireBarrel/BarrelFlames") assert(flames is CPUParticles3D and flames.amount == 28 and flames.emitting) assert(office.fire_light.shadow_enabled) for i in 100: office._process(0.016) assert(office.fire_light.light_energy >= office.FIRE_MIN and office.fire_light.light_energy <= office.FIRE_MAX) print("PASS: fiamme CPU leggere e flicker continuo entro limiti") var lights: Array[Node] = world.find_children("*", "OmniLight3D", true, false) assert(lights.size() == 4) # due lampade, bidone, muzzle flash assert(world.find_children("DeskLampLight", "OmniLight3D", true, false).size() == 2) for node in world.get_children(): assert(not node is OmniLight3D) # nessuna plafoniera if node is WorldEnvironment: assert(node.environment.ambient_light_energy <= 0.15) print("PASS: plafoniera rimossa, ambient basso e quattro luci totali") await physics_frame await physics_frame var space = world.get_world_3d().direct_space_state # Cardinal routes from windows to center remain free at zombie torso height. for edge in [Vector3(0, 0.8, -8), Vector3(0, 0.8, 8), Vector3(-8, 0.8, 0), Vector3(8, 0.8, 0)]: var q := PhysicsRayQueryParameters3D.create(edge, Vector3(0, 0.8, 0), 1) q.exclude = [world.player.get_rid()] assert(space.intersect_ray(q).is_empty()) var q := PhysicsRayQueryParameters3D.create(Vector3(-5, 0.5, -2), Vector3(-5, 0.5, -4), 1) assert(not space.intersect_ray(q).is_empty()) print("PASS: corridoi cardinali liberi, scrivanie bloccano fisicamente") if "--screenshot" in OS.get_cmdline_user_args(): world.player.set_physics_process(false) world.player.position = Vector3(0, 0.1, 0) world.player.camera.rotation.x = -0.08 for i in 3: if i == 2: world.player.look_at(Vector3(-4, 0.1, 4)) else: world.player.rotation.y = -PI * 0.25 if i == 0 else PI * 0.25 + PI await create_timer(0.4).timeout await RenderingServer.frame_post_draw root.get_texture().get_image().save_png("/tmp/zombie-office-%d.png" % i) world.queue_free() await process_frame quit()