diff --git a/scenes/rooms/floor1/Lab.tscn b/scenes/rooms/floor1/Lab.tscn index 3c7d001..e47b495 100644 --- a/scenes/rooms/floor1/Lab.tscn +++ b/scenes/rooms/floor1/Lab.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=3 uid="uid://cozypaw_lab"] +[gd_scene load_steps=4 format=3 uid="uid://cozypaw_lab"] [ext_resource type="PackedScene" path="res://scenes/objects/InteractiveObject.tscn" id="1_iobj"] [ext_resource type="Script" path="res://scripts/objects/snap_point.gd" id="2_snap"] +[ext_resource type="Script" path="res://scripts/objects/room_chest.gd" id="3_chest"] [node name="Lab" type="Node2D"] @@ -25,7 +26,7 @@ color = Color(0.88, 0.92, 0.94, 1) size = Vector2(40, 620) position = Vector2(1240, 0) -[node name="LabBench" type="ColorRect" parent="."] +[node name="LabBenchSurface" type="ColorRect" parent="."] color = Color(0.88, 0.88, 0.92, 1) size = Vector2(800, 40) position = Vector2(240, 480) @@ -77,3 +78,8 @@ script = ExtResource("2_snap") [node name="SnapLabBench2" type="Node2D" parent="."] position = Vector2(750, 470) script = ExtResource("2_snap") + +[node name="LabBench" type="Node2D" parent="."] +position = Vector2(150.0, 400.0) +script = ExtResource("3_chest") +chest_id = "lab_bench" diff --git a/scenes/rooms/floor1/PatientRoom.tscn b/scenes/rooms/floor1/PatientRoom.tscn index 455bc1b..18afbdd 100644 --- a/scenes/rooms/floor1/PatientRoom.tscn +++ b/scenes/rooms/floor1/PatientRoom.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=3 uid="uid://cozypaw_patientroom"] +[gd_scene load_steps=4 format=3 uid="uid://cozypaw_patientroom"] [ext_resource type="PackedScene" path="res://scenes/objects/InteractiveObject.tscn" id="1_iobj"] [ext_resource type="Script" path="res://scripts/objects/snap_point.gd" id="2_snap"] +[ext_resource type="Script" path="res://scripts/objects/room_chest.gd" id="3_chest"] [node name="PatientRoom" type="Node2D"] @@ -93,3 +94,8 @@ pose = "lying" position = Vector2(810, 465) script = ExtResource("2_snap") pose = "lying" + +[node name="PatientCabinet" type="Node2D" parent="."] +position = Vector2(150.0, 400.0) +script = ExtResource("3_chest") +chest_id = "patient_cabinet" diff --git a/scenes/rooms/floor1/Pharmacy.tscn b/scenes/rooms/floor1/Pharmacy.tscn index 59d4ea9..bb21821 100644 --- a/scenes/rooms/floor1/Pharmacy.tscn +++ b/scenes/rooms/floor1/Pharmacy.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=3 uid="uid://cozypaw_pharmacy"] +[gd_scene load_steps=4 format=3 uid="uid://cozypaw_pharmacy"] [ext_resource type="PackedScene" path="res://scenes/objects/InteractiveObject.tscn" id="1_iobj"] [ext_resource type="Script" path="res://scripts/objects/snap_point.gd" id="2_snap"] +[ext_resource type="Script" path="res://scripts/objects/room_chest.gd" id="3_chest"] [node name="Pharmacy" type="Node2D"] @@ -73,3 +74,13 @@ position = Vector2(640, 430) [node name="SnapCounter" type="Node2D" parent="."] position = Vector2(640, 520) script = ExtResource("2_snap") + +[node name="PharmacyMedicine" type="Node2D" parent="."] +position = Vector2(350.0, 320.0) +script = ExtResource("3_chest") +chest_id = "pharmacy_medicine" + +[node name="PharmacyTools" type="Node2D" parent="."] +position = Vector2(900.0, 320.0) +script = ExtResource("3_chest") +chest_id = "pharmacy_tools" diff --git a/scenes/rooms/floor1/XRay.tscn b/scenes/rooms/floor1/XRay.tscn index a483fb8..3f07a7f 100644 --- a/scenes/rooms/floor1/XRay.tscn +++ b/scenes/rooms/floor1/XRay.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=4 format=3 uid="uid://cozypaw_xray"] +[gd_scene load_steps=5 format=3 uid="uid://cozypaw_xray"] [ext_resource type="PackedScene" path="res://scenes/objects/InteractiveObject.tscn" id="1_iobj"] [ext_resource type="PackedScene" path="res://scenes/objects/XRayMachine.tscn" id="2_xraymachine"] [ext_resource type="Script" path="res://scripts/objects/snap_point.gd" id="3_snap"] +[ext_resource type="Script" path="res://scripts/objects/room_chest.gd" id="4_chest"] [node name="XRay" type="Node2D"] @@ -59,3 +60,8 @@ position = Vector2(900, 560) position = Vector2(640, 480) script = ExtResource("3_snap") pose = "lying" + +[node name="XRayCabinet" type="Node2D" parent="."] +position = Vector2(150.0, 400.0) +script = ExtResource("4_chest") +chest_id = "xray_cabinet" diff --git a/test/unit/test_room_chests_floor1.gd b/test/unit/test_room_chests_floor1.gd new file mode 100644 index 0000000..8017f0a --- /dev/null +++ b/test/unit/test_room_chests_floor1.gd @@ -0,0 +1,67 @@ +## Tests for RoomChest presence and item counts in Floor 1 rooms. +extends GutTest + + +func test_xray_has_chest_xray_cabinet() -> void: + var room: Node = preload("res://scenes/rooms/floor1/XRay.tscn").instantiate() + add_child_autofree(room) + assert_not_null(room.get_node_or_null("XRayCabinet")) + + +func test_xray_cabinet_has_three_items() -> void: + var room: Node = preload("res://scenes/rooms/floor1/XRay.tscn").instantiate() + add_child_autofree(room) + var chest: RoomChest = room.get_node_or_null("XRayCabinet") as RoomChest + assert_eq(chest.get_item_config_count(), 3) + + +func test_pharmacy_has_chest_pharmacy_medicine() -> void: + var room: Node = preload("res://scenes/rooms/floor1/Pharmacy.tscn").instantiate() + add_child_autofree(room) + assert_not_null(room.get_node_or_null("PharmacyMedicine")) + + +func test_pharmacy_medicine_has_two_items() -> void: + var room: Node = preload("res://scenes/rooms/floor1/Pharmacy.tscn").instantiate() + add_child_autofree(room) + var chest: RoomChest = room.get_node_or_null("PharmacyMedicine") as RoomChest + assert_eq(chest.get_item_config_count(), 2) + + +func test_pharmacy_has_chest_pharmacy_tools() -> void: + var room: Node = preload("res://scenes/rooms/floor1/Pharmacy.tscn").instantiate() + add_child_autofree(room) + assert_not_null(room.get_node_or_null("PharmacyTools")) + + +func test_pharmacy_tools_has_two_items() -> void: + var room: Node = preload("res://scenes/rooms/floor1/Pharmacy.tscn").instantiate() + add_child_autofree(room) + var chest: RoomChest = room.get_node_or_null("PharmacyTools") as RoomChest + assert_eq(chest.get_item_config_count(), 2) + + +func test_lab_has_chest_lab_bench() -> void: + var room: Node = preload("res://scenes/rooms/floor1/Lab.tscn").instantiate() + add_child_autofree(room) + assert_not_null(room.get_node_or_null("LabBench")) + + +func test_lab_bench_has_three_items() -> void: + var room: Node = preload("res://scenes/rooms/floor1/Lab.tscn").instantiate() + add_child_autofree(room) + var chest: RoomChest = room.get_node_or_null("LabBench") as RoomChest + assert_eq(chest.get_item_config_count(), 3) + + +func test_patient_room_has_chest_patient_cabinet() -> void: + var room: Node = preload("res://scenes/rooms/floor1/PatientRoom.tscn").instantiate() + add_child_autofree(room) + assert_not_null(room.get_node_or_null("PatientCabinet")) + + +func test_patient_cabinet_has_three_items() -> void: + var room: Node = preload("res://scenes/rooms/floor1/PatientRoom.tscn").instantiate() + add_child_autofree(room) + var chest: RoomChest = room.get_node_or_null("PatientCabinet") as RoomChest + assert_eq(chest.get_item_config_count(), 3)