feat(snap-points): add SnapPoints to all 1.OG rooms (XRay, Pharmacy, Lab, PatientRoom)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cozypaw_lab"]
|
||||
[gd_scene load_steps=3 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"]
|
||||
|
||||
[node name="Lab" type="Node2D"]
|
||||
|
||||
@@ -68,3 +69,11 @@ position = Vector2(820, 450)
|
||||
|
||||
[node name="PetriDish" parent="." instance=ExtResource("1_iobj")]
|
||||
position = Vector2(490, 450)
|
||||
|
||||
[node name="SnapLabBench1" type="Node2D" parent="."]
|
||||
position = Vector2(450, 470)
|
||||
script = ExtResource("2_snap")
|
||||
|
||||
[node name="SnapLabBench2" type="Node2D" parent="."]
|
||||
position = Vector2(750, 470)
|
||||
script = ExtResource("2_snap")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cozypaw_patientroom"]
|
||||
[gd_scene load_steps=3 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"]
|
||||
|
||||
[node name="PatientRoom" type="Node2D"]
|
||||
|
||||
@@ -82,3 +83,13 @@ position = Vector2(1100, 265)
|
||||
|
||||
[node name="BedsideTable" parent="." instance=ExtResource("1_iobj")]
|
||||
position = Vector2(500, 540)
|
||||
|
||||
[node name="SnapBed1" type="Node2D" parent="."]
|
||||
position = Vector2(250, 465)
|
||||
script = ExtResource("2_snap")
|
||||
pose = "lying"
|
||||
|
||||
[node name="SnapBed2" type="Node2D" parent="."]
|
||||
position = Vector2(810, 465)
|
||||
script = ExtResource("2_snap")
|
||||
pose = "lying"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cozypaw_pharmacy"]
|
||||
[gd_scene load_steps=3 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"]
|
||||
|
||||
[node name="Pharmacy" type="Node2D"]
|
||||
|
||||
@@ -68,3 +69,7 @@ position = Vector2(900, 270)
|
||||
|
||||
[node name="MedicineBox" parent="." instance=ExtResource("1_iobj")]
|
||||
position = Vector2(640, 430)
|
||||
|
||||
[node name="SnapCounter" type="Node2D" parent="."]
|
||||
position = Vector2(640, 520)
|
||||
script = ExtResource("2_snap")
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cozypaw_xray"]
|
||||
[gd_scene load_steps=4 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"]
|
||||
|
||||
[node name="XRay" type="Node2D"]
|
||||
|
||||
@@ -53,3 +54,8 @@ position = Vector2(500, 510)
|
||||
|
||||
[node name="PlasterStation" parent="." instance=ExtResource("1_iobj")]
|
||||
position = Vector2(900, 560)
|
||||
|
||||
[node name="SnapExamTable" type="Node2D" parent="."]
|
||||
position = Vector2(640, 480)
|
||||
script = ExtResource("3_snap")
|
||||
pose = "lying"
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
## Tests verifying SnapPoints exist in all 1.OG room scenes.
|
||||
extends GutTest
|
||||
|
||||
|
||||
func _count_snaps(room: Node2D) -> int:
|
||||
var count: int = 0
|
||||
for child: Node in room.get_children():
|
||||
if child is SnapPoint:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
func _count_snaps_with_pose(room: Node2D, pose: String) -> int:
|
||||
var count: int = 0
|
||||
for child: Node in room.get_children():
|
||||
var snap: SnapPoint = child as SnapPoint
|
||||
if snap != null and snap.pose == pose:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
func test_xray_has_one_snap_point() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor1/XRay.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps(room), 1)
|
||||
|
||||
|
||||
func test_xray_snap_is_lying() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor1/XRay.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps_with_pose(room, "lying"), 1)
|
||||
|
||||
|
||||
func test_pharmacy_has_one_snap_point() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor1/Pharmacy.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps(room), 1)
|
||||
|
||||
|
||||
func test_pharmacy_snap_is_sitting() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor1/Pharmacy.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps_with_pose(room, "sitting"), 1)
|
||||
|
||||
|
||||
func test_lab_has_two_snap_points() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor1/Lab.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps(room), 2)
|
||||
|
||||
|
||||
func test_lab_all_snaps_are_sitting() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor1/Lab.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps_with_pose(room, "sitting"), 2)
|
||||
|
||||
|
||||
func test_patient_room_has_two_snap_points() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor1/PatientRoom.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps(room), 2)
|
||||
|
||||
|
||||
func test_patient_room_all_snaps_are_lying() -> void:
|
||||
var room: Node2D = preload("res://scenes/rooms/floor1/PatientRoom.tscn").instantiate() as Node2D
|
||||
add_child_autofree(room)
|
||||
assert_eq(_count_snaps_with_pose(room, "lying"), 2)
|
||||
Reference in New Issue
Block a user