Skip to content

Commit 0a4d7f1

Browse files
committed
unit test basic surgery
1 parent c39876f commit 0a4d7f1

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

code/modules/unit_tests/surgeries.dm

+39
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,42 @@
7171
hemostat.melee_attack_chain(user, patient)
7272

7373
TEST_ASSERT(BP.get_damage() <= BP.max_damage * 0.25, "Chest did not heal to less than [BP.max_damage/2], healed to [BP.get_damage()]")
74+
75+
/datum/unit_test/test_retraction/Run()
76+
var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human)
77+
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human)
78+
var/obj/structure/table/table = allocate(/obj/structure/table/optable)
79+
var/obj/item/scalpel/scalpel = allocate(__IMPLIED_TYPE__)
80+
var/obj/item/hemostat/hemostat = allocate(__IMPLIED_TYPE__)
81+
var/obj/item/circular_saw/saw = allocate(__IMPLIED_TYPE__)
82+
83+
table.forceMove(get_turf(patient)) //Not really needed but it silences the linter and gives insurance
84+
patient.set_lying_down()
85+
86+
for(var/zone in list(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM))
87+
var/obj/item/bodypart/BP = patient.get_bodypart(zone)
88+
89+
user.zone_selected = zone
90+
user.desired_surgery = /datum/surgery_step/generic_organic/incise
91+
user.put_in_active_hand(scalpel)
92+
scalpel.melee_attack_chain(user, patient)
93+
94+
TEST_ASSERT(BP.how_open() == SURGERY_OPEN, "[parse_zone(zone)] was not incised.")
95+
96+
user.desired_surgery = /datum/surgery_step/generic_organic/retract_skin
97+
user.drop_all_held_items()
98+
user.put_in_active_hand(hemostat)
99+
hemostat.melee_attack_chain(user, patient)
100+
101+
TEST_ASSERT(BP.how_open() == SURGERY_RETRACTED, "[parse_zone(zone)]'s incision was not widened (Openness: [BP.how_open()]).")
102+
103+
if(BP.encased)
104+
user.desired_surgery = /datum/surgery_step/open_encased
105+
user.drop_all_held_items()
106+
user.put_in_active_hand(saw)
107+
saw.melee_attack_chain(user, patient)
108+
109+
TEST_ASSERT(BP.how_open() == SURGERY_DEENCASED, "[parse_zone(zone)] was not de-encased (Openness: [BP.how_open()]).")
110+
111+
user.drop_all_held_items()
112+
patient.fully_heal()

0 commit comments

Comments
 (0)