Add graphical CCS physical examination

This commit is contained in:
hz
2026-08-10 03:27:45 -05:00
parent 579e1e9be4
commit 07516784d2
5 changed files with 306 additions and 15 deletions
+55 -11
View File
@@ -18,6 +18,7 @@ var current_view := ""
var cases_loaded := false
var active_loaded := false
var pending_action := ""
var pending_exam_code := ""
var restart_case_external_id := ""
@@ -89,6 +90,7 @@ func _on_cases_changed() -> void:
func _on_attempt_changed() -> void:
active_loaded = true
pending_action = ""
pending_exam_code = ""
_render_state()
@@ -127,6 +129,9 @@ func _render_attempt(attempt: Dictionary) -> void:
and bool(attempt.get("openingCompleted", false)) and not bool(node.get("isTerminal", false)):
_show_unsupported_attempt("This case has progressed beyond the graphical interview.")
return
if current_view == "physical_examination" and bool(node.get("isTerminal", false)):
_show_physical_examination(attempt)
return
_show_doctor_office(node, attempt)
@@ -222,7 +227,9 @@ func _show_doctor_office(node: Dictionary, attempt: Dictionary = {}) -> void:
if active_scene == null:
_set_active_scene(DOCTOR_SCENE.instantiate(), "doctor_office")
active_scene.choice_selected.connect(_submit_dialogue_choice)
active_scene.interview_continue_requested.connect(_handoff_to_classic_player)
active_scene.interview_continue_requested.connect(_begin_physical_examination)
active_scene.physical_exam_selected.connect(_submit_physical_exam)
active_scene.physical_exam_finish_requested.connect(_finish_physical_examination)
active_scene.debrief_return_requested.connect(_return_to_cases)
active_scene.debrief_repeat_requested.connect(_repeat_interview)
selection_view.visible = false
@@ -246,15 +253,48 @@ func _submit_dialogue_choice(choice_id: String) -> void:
CCSService.send_dialogue_choice(choice_id)
func _handoff_to_classic_player() -> void:
if str(CCSService.attempt.get("experienceMode", "")) == "graphical_interview":
pending_action = "finishing_interview"
active_scene.set_choices_pending(true)
CCSService.send_command("exit_case")
func _begin_physical_examination() -> void:
if not pending_action.is_empty():
return
current_view = "handoff"
if main != null:
main.show_screen("ccs_player")
_show_physical_examination(CCSService.attempt)
func _show_physical_examination(attempt: Dictionary) -> void:
if active_scene == null:
_set_active_scene(DOCTOR_SCENE.instantiate(), "physical_examination")
active_scene.physical_exam_selected.connect(_submit_physical_exam)
active_scene.physical_exam_finish_requested.connect(_finish_physical_examination)
active_scene.debrief_return_requested.connect(_return_to_cases)
active_scene.debrief_repeat_requested.connect(_repeat_interview)
selection_view.visible = false
stage_root.visible = true
active_scene.configure_experience_mode("graphical_interview")
active_scene.configure_presentation(
attempt.get("graphicalPresentation", {}),
str(attempt.get("simulatedStartUtc", "")),
int(attempt.get("simulatedMinute", 0)),
attempt.get("vitals", {}),
str(attempt.get("medicalHistory", "")))
active_scene.show_physical_exam(
attempt.get("availableExams", []), attempt.get("chart", []), pending_exam_code)
current_view = "physical_examination"
func _submit_physical_exam(exam_code: String) -> void:
if not pending_action.is_empty() or exam_code.is_empty():
return
pending_action = "physical_exam"
pending_exam_code = exam_code
active_scene.set_physical_exam_pending(exam_code)
CCSService.send_command("exam", exam_code)
func _finish_physical_examination() -> void:
if not pending_action.is_empty():
return
pending_action = "finishing_exam"
active_scene.set_physical_exam_pending("finishing_case")
CCSService.send_command("exit_case")
func _render_debrief(attempt: Dictionary) -> void:
@@ -329,7 +369,11 @@ func _on_request_failed(message: String) -> void:
retry_button.visible = true
return
if active_scene != null:
active_scene.set_choices_pending(false)
if current_view == "physical_examination":
pending_exam_code = ""
active_scene.show_physical_exam_error(message)
else:
active_scene.set_choices_pending(false)
else:
status_label.text = message
retry_button.visible = failed_action == "loading"
@@ -354,7 +398,7 @@ func _clear_active_scene() -> void:
active_scene.get_parent().remove_child(active_scene)
active_scene.queue_free()
active_scene = null
if current_view == "doctor_office":
if current_view in ["doctor_office", "physical_examination"]:
current_view = ""