Files
Bubberstation/code/modules/surgery/dental_implant.dm
SkyratBot 3c3c6bc465 [MIRROR] Dental Implant surgery no longer restarts itself for every pill you implant (#28458)
* Dental Implant surgery no longer restarts itself for every pill you implant (#84273)

## About The Pull Request

Currently, the "Dental Implant" surgery requires you to restart the
operation after implanting only one pill, which is an annoying
inconvenience.

Implanting 5 pills before PR:

https://github.com/tgstation/tgstation/assets/97645027/d9bb74b6-7c7f-4b62-8b3d-4fe4b616dc2e

This PR aims to fix this problem by making the "Implant pill" portion of
the surgery repeatable by introducing a new step. After you implant a
pill, you can either search their mouth with your hands for another
tooth to implant, or use a cautery to finalize the surgery!

Implanting 5 pills after PR:

https://github.com/tgstation/tgstation/assets/97645027/ead38fb5-8ddc-463a-80c5-089434950646

## Why It's Good For The Game

If you're going through the trouble with another person to implant pills
into your teeth, you'll likely want more then one pill implanted. Aside
from making the surgery more consistent with other repeatable surgeries,
this makes the entire process less tedious to go through for the
surgeon.

## Changelog
🆑
qol: The "Dental Implant" surgery no longer forces itself to restart
after implanting one pill. Now implanting pills in the surgery has
another step to either search the patient's mouth for another tooth to
implant, or cauterization to end the surgery.
/🆑

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com>

* Dental Implant surgery no longer restarts itself for every pill you implant

---------

Co-authored-by: MGOOOOOO <97645027+MGOOOOOO@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com>
2024-06-29 10:48:26 +05:30

120 lines
4.4 KiB
Plaintext

#define MARK_TOOTH 1
/datum/surgery/dental_implant
name = "Dental implant"
possible_locs = list(BODY_ZONE_PRECISE_MOUTH)
steps = list(
/datum/surgery_step/drill/pill,
/datum/surgery_step/insert_pill,
/datum/surgery_step/search_teeth,
/datum/surgery_step/close,
)
/datum/surgery_step/drill/pill/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
. = ..()
var/count = 0
var/obj/item/bodypart/head/teeth_receptangle = target.get_bodypart(BODY_ZONE_HEAD)
ASSERT(teeth_receptangle)
for(var/obj/item/reagent_containers/pill/dental in teeth_receptangle)
count++
if(teeth_receptangle.teeth_count == 0)
to_chat(user, span_notice("[user] has no teeth, doofus!"))
return SURGERY_STEP_FAIL
if(count >= teeth_receptangle.teeth_count)
to_chat(user, span_notice("[user]'s teeth have all been replaced with pills already!"))
return SURGERY_STEP_FAIL
/datum/surgery_step/insert_pill
name = "insert pill"
implements = list(/obj/item/reagent_containers/pill = 100)
time = 16
/datum/surgery_step/insert_pill/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(
user,
target,
span_notice("You begin to wedge [tool] in [target]'s [target.parse_zone_with_bodypart(target_zone)]..."),
span_notice("[user] begins to wedge \the [tool] in [target]'s [target.parse_zone_with_bodypart(target_zone)]."),
span_notice("[user] begins to wedge something in [target]'s [target.parse_zone_with_bodypart(target_zone)]."),
)
display_pain(target, "Something's being jammed into your [target.parse_zone_with_bodypart(target_zone)]!")
/datum/surgery_step/insert_pill/success(mob/user, mob/living/carbon/target, target_zone, obj/item/reagent_containers/pill/tool, datum/surgery/surgery, default_display_results = FALSE)
if(!istype(tool))
return FALSE
// Pills go into head
user.transferItemToLoc(tool, target.get_bodypart(BODY_ZONE_HEAD), TRUE)
var/datum/action/item_action/activate_pill/pill_action = new(tool)
pill_action.name = "Activate [tool.name]"
pill_action.build_all_button_icons()
pill_action.target = tool
pill_action.Grant(target) //The pill never actually goes in an inventory slot, so the owner doesn't inherit actions from it
display_results(
user,
target,
span_notice("You wedge [tool] into [target]'s [target.parse_zone_with_bodypart(target_zone)]."),
span_notice("[user] wedges \the [tool] into [target]'s [target.parse_zone_with_bodypart(target_zone)]!"),
span_notice("[user] wedges something into [target]'s [target.parse_zone_with_bodypart(target_zone)]!"),
)
return ..()
/datum/action/item_action/activate_pill
name = "Activate Pill"
check_flags = NONE
/datum/action/item_action/activate_pill/IsAvailable(feedback)
if(owner.stat > SOFT_CRIT)
return FALSE
return ..()
/datum/action/item_action/activate_pill/Trigger(trigger_flags)
if(!..())
return FALSE
owner.balloon_alert_to_viewers("[owner] grinds their teeth!", "You grit your teeth.")
if(!do_after(owner, owner.stat * (2.5 SECONDS), owner, IGNORE_USER_LOC_CHANGE | IGNORE_INCAPACITATED))
return FALSE
var/obj/item/item_target = target
to_chat(owner, span_notice("You grit your teeth and burst the implanted [item_target.name]!"))
owner.log_message("swallowed an implanted pill, [target]", LOG_ATTACK)
if(item_target.reagents.total_volume)
item_target.reagents.trans_to(owner, item_target.reagents.total_volume, transferred_by = owner, methods = INGEST)
qdel(target)
return TRUE
/datum/surgery_step/search_teeth
name = "search teeth (hand)"
accept_hand = TRUE
time = 2 SECONDS
repeatable = TRUE
/datum/surgery_step/search_teeth/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
display_results(
user,
target,
span_notice("You begin looking in [target]'s mouth for implantable teeth..."),
span_notice("[user] begins to look in [target]'s mouth."),
span_notice("[user] begins to examine [target]'s teeth."),
)
display_pain(target, "You feel fingers poke around at your teeth.")
/datum/surgery_step/search_teeth/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
display_results(
user,
target,
span_notice("[user] marks a tooth in [target]'s mouth."),
span_notice("[user] marks a tooth in [target]'s mouth."),
span_notice("[user] prods a tooth in [target]'s mouth."),
)
surgery.status = MARK_TOOTH
return ..()
#undef MARK_TOOTH